new Client()
- Source:
Properties:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
channels |
Store | Where channels are being cached |
|||||||||||||||||||||||||||||||||||||||||
connectedShards |
Store | A store of connected shards |
|||||||||||||||||||||||||||||||||||||||||
guilds |
Store | Where guilds are being cached |
|||||||||||||||||||||||||||||||||||||||||
token |
String | The token of the client |
|||||||||||||||||||||||||||||||||||||||||
users |
Store | Where users are being cached |
|||||||||||||||||||||||||||||||||||||||||
shards |
Store | A store of Shards |
|||||||||||||||||||||||||||||||||||||||||
shardCount |
Number | The amount of shards to connect to Discord. ( useful for by shard status ) |
|||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Options for the Discord Client Properties
|
Extends
- EventEmitter
Methods
createDM(user) → {Promise.<DMChannel>}
- Source:
Creates a DMChannel between a user
Parameters:
Name | Type | Description |
---|---|---|
user |
Snowflake | The id of the recipient for the DM |
Returns:
- Type
- Promise.<DMChannel>
createEmbed(channel, embed) → {Promise.<Message>}
- Source:
- Deprecated:
- Use Client#sendMessage() instead.
Creates an embed to a channel
Parameters:
Name | Type | Description |
---|---|---|
channel |
Snowflake | The id of the channel to send a message to |
embed |
Object | The embed to send |
Returns:
- Type
- Promise.<Message>
createGuild(name, optionsopt) → {Promise.<Guild>}
- Source:
Creates a guild
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
String | The name for the new guild |
|||||||||||||
options |
Object |
<optional> |
Options for the new guild Properties
|
Returns:
- Type
- Promise.<Guild>
createMessage(channel, content) → {Promise.<Message>}
- Source:
- Deprecated:
- Use Client#sendMessage() instead.
Creates a message to a channel
Parameters:
Name | Type | Description |
---|---|---|
channel |
Snowflake | The id of the channel to send a message to |
content |
String | The content to send |
Returns:
- Type
- Promise.<Message>
customLog(type, color, message) → {Object}
- Source:
Make your own log with your own type and color
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The type of the log, can be anything |
color |
String | The color of the type |
message |
String | The message to log |
Returns:
- Type
- Object
getUser(user) → {Promise.<User>}
- Source:
Fetches the user from cache, if it doesn't exist use the REST API to fetch it and add to the cache
Parameters:
Name | Type | Description |
---|---|---|
user |
Snowflake | The id of the user to fetch |
Returns:
- Type
- Promise.<User>
(async) initiate(token) → {Void}
- Source:
This will start connecting to the gateway using the given bot token
Parameters:
Name | Type | Description |
---|---|---|
token |
String | The token of the user |
Returns:
- Type
- Void
leaveGuild(guild) → {Promise.<Boolean>}
- Source:
Makes the bot leave the guild
Parameters:
Name | Type | Description |
---|---|---|
guild |
Snowflake | The id of the guild |
Returns:
Will return true if it's a success
- Type
- Promise.<Boolean>
log(type, message) → {Object}
- Source:
Logs something to the console that is colored.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The type of the log |
message |
String | The message to log |
Returns:
- Type
- Object
patchMessage(channel, options) → {Promise.<Message>}
- Source:
Edits a message
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
channel |
Snowflake | The id of the channel |
||||||||||||
options |
Object | Options for the message editing Properties
|
Returns:
- Type
- Promise.<Message>
rgbLog(type, message, optionsopt) → {Object}
- Source:
Make your own log with your own type and color using RGB
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type |
String | The type of the log, can be anything |
|||||||||||||||||||||
message |
String | The message to log |
|||||||||||||||||||||
options |
Object |
<optional> |
The options for the RGB Color Properties
|
Returns:
- Type
- Object
sendMessage(channel, options) → {Promise.<Message>}
- Source:
Sends a message to a channel
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
channel |
Snowflake | |||||||||||||
options |
Object |
Properties
|
Returns:
- Type
- Promise.<Message>
setActivity(shard, optionsopt) → {Object}
- Source:
Sends an activity to the shard
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
shard |
String | The id of the shard, or |
||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
The options for the Activity Properties
|
Returns:
The options for the Activity
- Type
- Object
spawn(id) → {Boolean}
- Source:
Spawns a shard
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | The id of the shard |
Returns:
- Type
- Boolean
Events
CHANNEL_CREATE
- Source:
Properties:
Type | Description |
---|---|
TextChannel | VoiceChannel | CategoryChannel | DMChannel |
Emitted once a channel has been created
CHANNEL_DELETE
- Source:
Properties:
Name | Type | Description |
---|---|---|
channel |
DMChannel | TextChannel | VoiceChannel | CategoryChannel | The channel that got deleted |
Emitted once a channel gets deleted
CHANNEL_UPDATE
- Source:
Properties:
Name | Type | Description |
---|---|---|
oldChannel |
DMChannel | TextChannel | VoiceChannel | CategoryChannel | The old data of the channel ( Not Cached ) |
newChannel |
DMChannel | TextChannel | VoiceChannel | CategoryChannel | The new data of the channel |
Emitted once a channel gets updated
GUILD_AVAILABLE
- Source:
Properties:
Name | Type | Description |
---|---|---|
guild |
Guild | The guild that became available |
Emitted once a guild becomes available
GUILD_CREATE
- Source:
Properties:
Name | Type | Description |
---|---|---|
guild |
Guild | The guild that became available |
Emitted once a bot joins a guild
GUILD_DELETE
- Source:
Properties:
Name | Type | Description |
---|---|---|
guild |
Guild |
Emitted once a Guild becomes Unavailable or the bot leaves a Guild
GUILD_MEMBER_ADD
- Source:
Properties:
Name | Type | Description |
---|---|---|
member |
Member | The member object that joined |
guild |
Guild | The guild the member joined |
Emits once a user joins a guild
GUILD_MEMBER_REMOVE
Properties:
Name | Type | Description |
---|---|---|
member |
Member | The member object that left |
guild |
Guild | The guild the member left |
Emits once a user leaves a guild
GUILD_MEMBER_UPDATE
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
member |
Member | The new member data ( Cached ) |
||||||||||||
oldMember |
Member | The old member data ( Partial, not cached ) Properties
|
Emits once a user joins a guild
GUILD_MEMBERS_CHUNK
Properties:
Name | Type | Description |
---|---|---|
guild |
Guild | The guild that requested for all members to be fetced |
Emitted when a guild requests all members to be fetched
MESSAGE_CREATE
- Source:
Properties:
Name | Type | Description |
---|---|---|
message |
Message |
Emitted once a message is seen/sent
READY
- Source:
Emitted once all Shards are ready
ROLE_CREATE
- Source:
Properties:
Name | Type | Description |
---|---|---|
role |
Role | The role that was created |
Emitted once a role is created
ROLE_DELETE
- Source:
Properties:
Name | Type | Description |
---|---|---|
role |
Role | The deleted role |
Emitted once a role is deleted, this also emits one or multiple Client#GUILD_MEMBER_UPDATE
ROLE_UPDATE
- Source:
Properties:
Name | Type | Description |
---|---|---|
oldRole |
Role | The old role data |
role |
Role | The new role data |
Emitted once a role gets updated
SHARD_DISCONNECT
- Source:
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
shard |
Shard | Partial Shard data Properties
|
Emitted once a Shard Disconnects
SHARD_DISCONNECT_ALL
- Source:
Properties:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
data |
Object | The data of the event Properties
|
Emitted once all shards disconnect
SHARD_LOADING
- Source:
Properties:
Name | Type | Description |
---|---|---|
id |
String | The id of the shard |
Emitted once a Shard is loading, inner data is a partial Shard Data
SHARD_READY
- Source:
Properties:
Name | Type | Description |
---|---|---|
shard |
Shard | The data of the shard |
Emitted once a Shard becomes ready
USER_UPDATE
- Source:
Properties:
Name | Type | Description |
---|---|---|
oldUser |
User | The old data of the user ( Not present in cache ) |
newUser |
User | The new data of the user ( Present in cache ) |
Emitted once a User updates his/her info