mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Now includes getter functions to limit the amount of filters required
This commit is contained in:
18
index.js
18
index.js
@@ -25,6 +25,7 @@ exports.isUserID = function( id ) {
|
|||||||
exports.Client = function( options ) {
|
exports.Client = function( options ) {
|
||||||
|
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
|
this.options.maxmessage = 5000;
|
||||||
this.token = "";
|
this.token = "";
|
||||||
this.loggedIn = false;
|
this.loggedIn = false;
|
||||||
this.websocket = null;
|
this.websocket = null;
|
||||||
@@ -36,6 +37,23 @@ exports.Client = function( options ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.Client.prototype.getServers = function() {
|
||||||
|
return this.serverList;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.Client.prototype.getChannels = function() {
|
||||||
|
return this.serverList.concatSublists( "channels", "id" );
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.Client.prototype.getServer = function(id) {
|
||||||
|
return this.getServers().filter("id", id, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.Client.prototype.getChannel = function(id) {
|
||||||
|
return this.getChannels().filter("id", id, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.Client.prototype.triggerEvent = function( event, args ) {
|
exports.Client.prototype.triggerEvent = function( event, args ) {
|
||||||
|
|
||||||
if ( !this.ready && event !== "raw" && event !== "disconnected" ) { //if we're not even loaded yet, don't try doing anything because it always ends badly!
|
if ( !this.ready && event !== "raw" && event !== "disconnected" ) { //if we're not even loaded yet, don't try doing anything because it always ends badly!
|
||||||
|
|||||||
Reference in New Issue
Block a user