Skip to content

Client

classe · Source

The main hub for user-account Discord workflows.

Extends: BaseClient

Constructor

new Client(options?: ClientOptions)

Parameters

NameTypeDescription
options?ClientOptionsOptions for the client

Properties

_cleanups

private

_cleanups: Set<function()>

Functions called when a cache is garbage collected or the Client is destroyed Source

_finalizers

private

_finalizers: FinalizationRegistry

The finalizers used to cleanup items. Source

ws

ws: WebSocketManager

The WebSocket manager of the client Source

actions

private

actions: ActionsManager

The action manager of the client Source

voice

voice: ClientVoiceManager

The voice manager of the client Source

voiceStates

voiceStates: VoiceStateManager

A manager of the voice states of this client (Support DM / Group DM) Source

shard

nullable

shard: ShardClientUtil

Shard helpers for the client (only if the process was spawned from a ShardingManager) Source

users

users: UserManager

The user manager of this client Source

guilds

guilds: GuildManager

A manager of all the guilds the client is currently handling - this will be every guild the user account is a member of Source

channels

channels: ChannelManager

All of the Channels that the client is currently handling - this will be every cached channel in every guild the user account is a member of. Note that DM channels will not be initially cached, and thus not be present in the Manager without their explicit fetching or use. Source

sweepers

sweepers: Sweepers

The sweeping functions and their intervals used to periodically sweep caches Source

presence

private

presence: ClientPresence

The presence of the Client Source

presences

presences: PresenceManager

A manager of the presences belonging to this client Source

notes

notes: UserManager

All of the note that have been cached at any point, mapped by their ids Source

relationships

relationships: RelationshipManager

All of the relationships UserSource

billing

billing: BillingManager

Manages the API methods Source

sessions

sessions: SessionManager

All of the sessions of the client Source

settings

settings: ClientUserSettingManager

All of the settings ObjectSource

token

nullable

token: string

Authorization token for the logged in user account. If present, this defaults to process.env.DISCORD_TOKEN when instantiating the client This should be kept private at all times. Source

user

nullable

user: ClientUser

User that the client is logged in as Source

readyAt

nullable

readyAt: Date

Time at which the client was last regarded as being in the READY state (each time the client disconnects and successfully reconnects, this will be overwritten) Source

authenticator

authenticator: Object

The authenticator used for TOTP Source

emojis

readonly

emojis: BaseGuildEmojiManager

A manager of all the custom emojis that the client has access to Source

readyTimestamp

readonly · nullable

readyTimestamp: number

Timestamp of the time the client was last READY at Source

uptime

readonly · nullable

uptime: number

How long it has been since the client last entered the READY state in milliseconds Source

sessionId

nullable

sessionId: string

The current session id of the shard Source

options

options: ClientOptions

The options the client was instantiated with Source

rest

private

rest: RESTManager

The REST manager of the client Source

api

readonly · private

api: Object

API shortcut Source

Methods

login

async

async login(token?: string): Promise<string>

Logs the client in, establishing a WebSocket connection to Discord. Parameters

NameTypeDescription
token?stringToken of the account to log in with Default: this.token.

Returns: Promise<string> — Token of the account used

js
client.login('my token');

Source

passLogin

async · deprecated

async passLogin(email: string, password: string): string | null

Logs the client in, establishing a WebSocket connection to Discord. Parameters

NameTypeDescription
emailstringThe email associated with the account
passwordstringThe password assicated with the account

Returns: string \| null — Token of the account used

js
client.passLogin("test@gmail.com", "SuperSecretPa$$word", 1234)

Source

isReady

isReady(): boolean

Returns whether the client has logged in, indicative of being able to access properties such as user. Returns: booleanSource

destroy

destroy(): void

Logs out, terminates the connection to Discord, and destroys the client. Returns: voidSource

logout

async

async logout(): Promise<void>

Logs out, terminates the connection to Discord, destroys the client and destroys the token. Returns: Promise<void>Source

fetchInvite

async

async fetchInvite(invite: InviteResolvable, options?: ClientFetchInviteOptions): Promise<Invite>

Obtains an invite from Discord. Parameters

NameTypeDescription
inviteInviteResolvableInvite code or URL
options?ClientFetchInviteOptionsOptions for fetching the invite

Returns: Promise<Invite>

js
client.fetchInvite('https://discord.gg/djs')
  .then(invite => console.log(`Obtained invite with code: ${invite.code}`))
  .catch(console.error);

Source

fetchGuildTemplate

async

async fetchGuildTemplate(template: GuildTemplateResolvable): Promise<GuildTemplate>

Obtains a template from Discord. Parameters

NameTypeDescription
templateGuildTemplateResolvableTemplate code or URL

Returns: Promise<GuildTemplate>

js
client.fetchGuildTemplate('https://discord.new/FKvmczH2HyUf')
  .then(template => console.log(`Obtained template with code: ${template.code}`))
  .catch(console.error);

Source

fetchWebhook

async

async fetchWebhook(id: Snowflake, token?: string): Promise<Webhook>

Obtains a webhook from Discord. Parameters

NameTypeDescription
idSnowflakeThe webhook's id
token?stringToken for the webhook

Returns: Promise<Webhook>

js
client.fetchWebhook('id', 'token')
  .then(webhook => console.log(`Obtained webhook with name: ${webhook.name}`))
  .catch(console.error);

Source

fetchVoiceRegions

async

async fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>

Obtains the available voice regions from Discord. Returns: Promise<Collection<string, VoiceRegion>>

js
client.fetchVoiceRegions()
  .then(regions => console.log(`Available regions are: ${regions.map(region => region.name).join(', ')}`))
  .catch(console.error);

Source

fetchSticker

async

async fetchSticker(id: Snowflake): Promise<Sticker>

Obtains a sticker from Discord. Parameters

NameTypeDescription
idSnowflakeThe sticker's id

Returns: Promise<Sticker>

js
client.fetchSticker('id')
  .then(sticker => console.log(`Obtained sticker with name: ${sticker.name}`))
  .catch(console.error);

Source

fetchPremiumStickerPacks

async

async fetchPremiumStickerPacks(): Promise<Collection<Snowflake, StickerPack>>

Obtains the list of sticker packs available to Nitro subscribers from Discord. Returns: Promise<Collection<Snowflake, StickerPack>>

js
client.fetchPremiumStickerPacks()
  .then(packs => console.log(`Available sticker packs are: ${packs.map(pack => pack.name).join(', ')}`))
  .catch(console.error);

Source

_finalize

private

_finalize(options.cleanup: function, options.message?: string, options.name?: string)

A last ditch cleanup function for garbage collection. Parameters

NameTypeDescription
options.cleanupfunctionThe function called to GC
options.message?stringThe message to send after a successful GC
options.name?stringThe name of the item being GCed
Source

sweepMessages

sweepMessages(lifetime?: number): number

Sweeps all text-based channels' messages and removes the ones older than the max message lifetime. If the message has been edited, the time of the edit is used rather than the time of the original message. Parameters

NameTypeDescription
lifetime?numberMessages that are older than this (in seconds)
will be removed from the caches. The default is based on ClientOptions#messageCacheLifetime Default: this.options.messageCacheLifetime.

Returns: number — Amount of messages that were removed from the caches, or -1 if the message cache lifetime is unlimited

js
// Remove all messages older than 1800 seconds from the messages cache
const amount = client.sweepMessages(1800);
console.log(`Successfully removed ${amount} messages from the cache.`);

Source

fetchGuildPreview

async

async fetchGuildPreview(guild: GuildResolvable): Promise<GuildPreview>

Obtains a guild preview from Discord, available for joined guilds and Discoverable guilds. Parameters

NameTypeDescription
guildGuildResolvableThe guild to fetch the preview for

Returns: Promise<GuildPreview>Source

fetchGuildWidget

async

async fetchGuildWidget(guild: GuildResolvable): Promise<Widget>

Obtains the widget data of a guild from Discord, available for guilds with the widget enabled. Parameters

NameTypeDescription
guildGuildResolvableThe guild to fetch the widget data for

Returns: Promise<Widget>Source

refreshAttachmentURL

async

async refreshAttachmentURL(urls: string): Promise<Array<{original: string, refreshed: string}>>

Refresh the Discord CDN links with hashes so they can be usable. Parameters

NameTypeDescription
urlsstringDiscord CDN URLs

Returns: Promise<Array<{original: string, refreshed: string}>>Source

sleep

sleep(timeout: number): void

The sleep function in JavaScript returns a promise that resolves after a specified timeout. Parameters

NameTypeDescription
timeoutnumberThe timeout parameter is the amount of time, in milliseconds, that the sleep
function will wait before resolving the promise and continuing execution.

Returns: void — The sleep function is returning a Promise. Source

acceptInvite

async

async acceptInvite(invite: InviteResolvable, options?: AcceptInviteOptions): Promise<(Guild|DMChannel|GroupDMChannel)>

Join this Guild / GroupDMChannel using this invite Parameters

NameTypeDescription
inviteInviteResolvableInvite code or URL
options?AcceptInviteOptionsOptions

Returns: Promise<(Guild\|DMChannel\|GroupDMChannel)>

js
await client.acceptInvite('https://discord.gg/genshinimpact', { bypassOnboarding: true, bypassVerify: true })

Source

redeemNitro

redeemNitro(nitro: string, channel?: TextChannelResolvable, paymentSourceId?: Snowflake): Promise<any>

Redeem nitro from code or url. Parameters

NameTypeDescription
nitrostringNitro url or code
channel?TextChannelResolvableChannel that the code was sent in
paymentSourceId?SnowflakePayment source id

Returns: Promise<any>Source

authorizeURL

authorizeURL(urlOAuth2: string, options?: OAuth2AuthorizeOptions): Promise<{location: string}>

Authorize an application. Parameters

NameTypeDescription
urlOAuth2stringDiscord Auth URL
options?OAuth2AuthorizeOptionsOauth2 options

Returns: Promise<{location: string}>

js
client.authorizeURL(`https://discord.com/api/oauth2/authorize?client_id=botID&permissions=8&scope=applications.commands%20bot`, {
      guild_id: "guildID",
    })

Source

installUserApps

installUserApps(applicationId: Snowflake): Promise<void>

Install User Apps Parameters

NameTypeDescription
applicationIdSnowflakeDiscord Application id

Returns: Promise<void>Source

deauthorize

deauthorize(id: Snowflake, type?: 'application' | 'token'): Promise<void>

Deauthorizes an application or token. Parameters

NameTypeDescription
idSnowflakeThe ID of the Discord Application or Token.
type?'application' | 'token'The type of the ID provided. Defaults to 'application'. Default: 'application'.

Returns: Promise<void> — A promise that resolves when the deauthorization is complete. Source

authorizedApplications

authorizedApplications(): Promise<Collection<Snowflake, AuthorizedApplicationData>>

Retrieves the list of authorized applications (OAuth2 tokens). Returns: Promise<Collection<Snowflake, AuthorizedApplicationData>>Source

_eval

private

_eval(script: string): *

Calls https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/eval on a script with the client as this. Parameters

NameTypeDescription
scriptstringScript to eval

Returns: *Source

_validateOptions

private

_validateOptions(options?: ClientOptions)

Validates the client options. Parameters

NameTypeDescription
options?ClientOptionsOptions to validate Default: this.options.
Source

incrementMaxListeners

private

incrementMaxListeners()

Increments max listeners by one, if they are not zero. Source

decrementMaxListeners

private

decrementMaxListeners()

Decrements max listeners by one, if they are not zero. Source

Events

applicationCommandPermissionsUpdate

applicationCommandPermissionsUpdate: unknown

Emitted whenever permissions for an application command in a guild were updated. This includes permission updates for other applications in addition to the logged in client, check data.applicationId to verify which application the update is for Parameters

NameTypeDescription
dataApplicationCommandPermissionsUpdateDataThe updated permissions
Source

autoModerationActionExecution

deprecated

autoModerationActionExecution: unknown

Emitted whenever an auto moderation rule is triggered. This event requires the Permissions.FLAGS.MANAGE_GUILD permission. Parameters

NameTypeDescription
autoModerationActionExecutionAutoModerationActionExecutionThe data of the execution
Source

autoModerationRuleCreate

deprecated

autoModerationRuleCreate: unknown

Emitted whenever an auto moderation rule is created. This event requires the Permissions.FLAGS.MANAGE_GUILD permission. Parameters

NameTypeDescription
autoModerationRuleAutoModerationRuleThe created auto moderation rule
Source

autoModerationRuleDelete

deprecated

autoModerationRuleDelete: unknown

Emitted whenever an auto moderation rule is deleted. This event requires the Permissions.FLAGS.MANAGE_GUILD permission. Parameters

NameTypeDescription
autoModerationRuleAutoModerationRuleThe deleted auto moderation rule
Source

autoModerationRuleUpdate

deprecated

autoModerationRuleUpdate: unknown

Emitted whenever an auto moderation rule gets updated. This event requires the Permissions.FLAGS.MANAGE_GUILD permission. Parameters

NameTypeDescription
oldAutoModerationRuleAutoModerationRuleThe auto moderation rule before the update
newAutoModerationRuleAutoModerationRuleThe auto moderation rule after the update
Source

channelCreate

channelCreate: unknown

Emitted whenever a guild channel is created. Parameters

NameTypeDescription
channelGuildChannelThe channel that was created
Source

channelDelete

channelDelete: unknown

Emitted whenever a channel is deleted. Parameters

NameTypeDescription
channelDMChannel | GuildChannelThe channel that was deleted
Source

guildAuditLogEntryCreate

guildAuditLogEntryCreate: unknown

Emitted whenever a guild audit log entry is created. Parameters

NameTypeDescription
auditLogEntryGuildAuditLogsEntryThe entry that was created
guildGuildThe guild where the entry was created
Source

guildBanAdd

guildBanAdd: unknown

Emitted whenever a member is banned from a guild. Parameters

NameTypeDescription
banGuildBanThe ban that occurred
Source

guildBanRemove

guildBanRemove: unknown

Emitted whenever a member is unbanned from a guild. Parameters

NameTypeDescription
banGuildBanThe ban that was removed
Source

guildUnavailable

guildUnavailable: unknown

Emitted whenever a guild becomes unavailable, likely due to a server outage. Parameters

NameTypeDescription
guildGuildThe guild that has become unavailable
Source

guildDelete

guildDelete: unknown

Emitted whenever a guild kicks the client or the guild is deleted/left. Parameters

NameTypeDescription
guildGuildThe guild that was deleted
Source

emojiCreate

emojiCreate: unknown

Emitted whenever a custom emoji is created in a guild. Parameters

NameTypeDescription
emojiGuildEmojiThe emoji that was created
Source

emojiDelete

emojiDelete: unknown

Emitted whenever a custom emoji is deleted in a guild. Parameters

NameTypeDescription
emojiGuildEmojiThe emoji that was deleted
Source

emojiUpdate

emojiUpdate: unknown

Emitted whenever a custom emoji is updated in a guild. Parameters

NameTypeDescription
oldEmojiGuildEmojiThe old emoji
newEmojiGuildEmojiThe new emoji
Source

guildIntegrationsUpdate

guildIntegrationsUpdate: unknown

Emitted whenever a guild integration is updated Parameters

NameTypeDescription
guildGuildThe guild whose integrations were updated
Source

guildMemberRemove

deprecated

guildMemberRemove: unknown

Emitted whenever a member leaves a guild, or is kicked. Parameters

NameTypeDescription
memberGuildMemberThe member that has left/been kicked from the guild
Source

guildMemberUpdate

deprecated

guildMemberUpdate: unknown

Emitted whenever a guild member changes - i.e. new role, removed role, nickname. Parameters

NameTypeDescription
oldMemberGuildMemberThe member before the update
newMemberGuildMemberThe member after the update
Source

guildMemberAvailable

guildMemberAvailable: unknown

Emitted whenever a member becomes available. Parameters

NameTypeDescription
memberGuildMemberThe member that became available
Source

roleCreate

roleCreate: unknown

Emitted whenever a role is created. Parameters

NameTypeDescription
roleRoleThe role that was created
Source

roleDelete

roleDelete: unknown

Emitted whenever a guild role is deleted. Parameters

NameTypeDescription
roleRoleThe role that was deleted
Source

roleUpdate

roleUpdate: unknown

Emitted whenever a guild role is updated. Parameters

NameTypeDescription
oldRoleRoleThe role before the update
newRoleRoleThe role after the update
Source

guildScheduledEventCreate

guildScheduledEventCreate: unknown

Emitted whenever a guild scheduled event is created. Parameters

NameTypeDescription
guildScheduledEventGuildScheduledEventThe created guild scheduled event
Source

guildScheduledEventDelete

guildScheduledEventDelete: unknown

Emitted whenever a guild scheduled event is deleted. Parameters

NameTypeDescription
guildScheduledEventGuildScheduledEventThe deleted guild scheduled event
Source

guildScheduledEventUpdate

guildScheduledEventUpdate: unknown

Emitted whenever a guild scheduled event gets updated. Parameters

NameTypeDescription
oldGuildScheduledEventGuildScheduledEventThe guild scheduled event object before the update
newGuildScheduledEventGuildScheduledEventThe guild scheduled event object after the update
Source

guildScheduledEventUserAdd

guildScheduledEventUserAdd: unknown

Emitted whenever a user subscribes to a guild scheduled event Parameters

NameTypeDescription
guildScheduledEventGuildScheduledEventThe guild scheduled event
userUserThe user who subscribed
Source

guildScheduledEventUserRemove

guildScheduledEventUserRemove: unknown

Emitted whenever a user unsubscribes from a guild scheduled event Parameters

NameTypeDescription
guildScheduledEventGuildScheduledEventThe guild scheduled event
userUserThe user who unsubscribed
Source

stickerCreate

stickerCreate: unknown

Emitted whenever a custom sticker is created in a guild. Parameters

NameTypeDescription
stickerStickerThe sticker that was created
Source

stickerDelete

stickerDelete: unknown

Emitted whenever a custom sticker is deleted in a guild. Parameters

NameTypeDescription
stickerStickerThe sticker that was deleted
Source

stickerUpdate

stickerUpdate: unknown

Emitted whenever a custom sticker is updated in a guild. Parameters

NameTypeDescription
oldStickerStickerThe old sticker
newStickerStickerThe new sticker
Source

guildUpdate

guildUpdate: unknown

Emitted whenever a guild is updated - e.g. name change. Parameters

NameTypeDescription
oldGuildGuildThe guild before the update
newGuildGuildThe guild after the update
Source

inviteCreate

inviteCreate: unknown

Emitted when an invite is created. This event only triggers if the client has MANAGE_GUILD permissions for the guild, or MANAGE_CHANNELS permissions for the channel. Parameters

NameTypeDescription
inviteInviteThe invite that was created
Source

inviteDelete

inviteDelete: unknown

Emitted when an invite is deleted. This event only triggers if the client has MANAGE_GUILD permissions for the guild, or MANAGE_CHANNELS permissions for the channel. Parameters

NameTypeDescription
inviteInviteThe invite that was deleted
Source

messageCreate

messageCreate: unknown

Emitted whenever a message is created. Parameters

NameTypeDescription
messageMessageThe created message
Source

message

deprecated

message: unknown

Emitted whenever a message is created. Parameters

NameTypeDescription
messageMessageThe created message
Source

messageDelete

messageDelete: unknown

Emitted whenever a message is deleted. Parameters

NameTypeDescription
messageMessageThe deleted message
Source

messageDeleteBulk

messageDeleteBulk: unknown

Emitted whenever messages are deleted in bulk. Parameters

NameTypeDescription
messagesCollection<Snowflake, Message>The deleted messages, mapped by their id
Source

messagePollVoteAdd

messagePollVoteAdd: unknown

Emitted whenever a user votes in a poll. Parameters

NameTypeDescription
pollAnswerPollAnswerThe answer that was voted on
userIdSnowflakeThe id of the user that voted
Source

messagePollVoteRemove

messagePollVoteRemove: unknown

Emitted whenever a user removes their vote in a poll. Parameters

NameTypeDescription
pollAnswerPollAnswerThe answer where the vote was removed
userIdSnowflakeThe id of the user that removed their vote
Source

messageReactionAdd

messageReactionAdd: unknown

Emitted whenever a reaction is added to a cached message. Parameters

NameTypeDescription
messageReactionMessageReactionThe reaction object
userUserThe user that applied the guild or reaction emoji
detailsMessageReactionEventDetailsDetails of adding the reaction
Source

messageReactionRemove

messageReactionRemove: unknown

Emitted whenever a reaction is removed from a cached message. Parameters

NameTypeDescription
messageReactionMessageReactionThe reaction object
userUserThe user whose emoji or reaction emoji was removed
detailsMessageReactionEventDetailsDetails of removing the reaction
Source

messageReactionRemoveAll

messageReactionRemoveAll: unknown

Emitted whenever all reactions are removed from a cached message. Parameters

NameTypeDescription
messageMessageThe message the reactions were removed from
reactionsCollection<(string|Snowflake), MessageReaction>The cached message reactions that were removed.
Source

messageReactionRemoveEmoji

messageReactionRemoveEmoji: unknown

Emitted when a bot removes an emoji reaction from a cached message. Parameters

NameTypeDescription
reactionMessageReactionThe reaction that was removed
Source

presenceUpdate

presenceUpdate: unknown

Emitted whenever a guild member's presence (e.g. status, activity) is changed. Parameters

NameTypeDescription
oldPresencePresenceThe presence before the update, if one at all
newPresencePresenceThe presence after the update
Source

stageInstanceCreate

stageInstanceCreate: unknown

Emitted whenever a stage instance is created. Parameters

NameTypeDescription
stageInstanceStageInstanceThe created stage instance
Source

stageInstanceDelete

stageInstanceDelete: unknown

Emitted whenever a stage instance is deleted. Parameters

NameTypeDescription
stageInstanceStageInstanceThe deleted stage instance
Source

stageInstanceUpdate

stageInstanceUpdate: unknown

Emitted whenever a stage instance gets updated - e.g. change in topic or privacy level Parameters

NameTypeDescription
oldStageInstanceStageInstanceThe stage instance before the update
newStageInstanceStageInstanceThe stage instance after the update
Source

threadCreate

threadCreate: unknown

Emitted whenever a thread is created or when the client user is added to a thread. Parameters

NameTypeDescription
threadThreadChannelThe thread that was created
newlyCreatedbooleanWhether the thread was newly created
Source

threadDelete

threadDelete: unknown

Emitted whenever a thread is deleted. Parameters

NameTypeDescription
threadThreadChannelThe thread that was deleted
Source

threadListSync

threadListSync: unknown

Emitted whenever the client user gains access to a text or news channel that contains threads Parameters

NameTypeDescription
threadsCollection<Snowflake, ThreadChannel>The threads that were synced
Source

threadMembersUpdate

threadMembersUpdate: unknown

Emitted whenever members are added or removed from a thread. Requires GUILD_MEMBERS privileged intent Parameters

NameTypeDescription
oldMembersCollection<Snowflake, ThreadMember>The members before the update
newMembersCollection<Snowflake, ThreadMember>The members after the update
Source

threadMemberUpdate

threadMemberUpdate: unknown

Emitted whenever the client user's thread member is updated. Parameters

NameTypeDescription
oldMemberThreadMemberThe member before the update
newMemberThreadMemberThe member after the update
Source

typingStart

typingStart: unknown

Emitted whenever a user starts typing in a channel. Parameters

NameTypeDescription
typingTypingThe typing state
Source

userUpdate

userUpdate: unknown

Emitted whenever a user's details (e.g. username) are changed. Triggered by the Discord gateway events USER_UPDATE, GUILD_MEMBER_UPDATE, and PRESENCE_UPDATE. Parameters

NameTypeDescription
oldUserUserThe user before the update
newUserUserThe user after the update
Source

voiceStateUpdate

voiceStateUpdate: unknown

Emitted whenever a member changes voice state - e.g. joins/leaves a channel, mutes/unmutes. Parameters

NameTypeDescription
oldStateVoiceStateThe voice state before the update
newStateVoiceStateThe voice state after the update
Source

webhookUpdate

webhookUpdate: unknown

Emitted whenever a channel has its webhooks changed. Parameters

NameTypeDescription
channelTextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | MediaChannelThe channel that had a webhook update
Source

warn

warn: unknown

Emitted for general warnings. Parameters

NameTypeDescription
infostringThe warning
Source

guildMemberSpeaking

guildMemberSpeaking: unknown

Emitted once a guild member changes speaking state. Parameters

NameTypeDescription
memberGuildMemberThe member that started/stopped speaking
speakingReadonly<Speaking>The speaking state of the member
Source

applicationCommandCreate

deprecated

applicationCommandCreate: unknown

Emitted when a guild application command is created. Parameters

NameTypeDescription
commandApplicationCommandThe command which was created
Source

applicationCommandDelete

deprecated

applicationCommandDelete: unknown

Emitted when a guild application command is deleted. Parameters

NameTypeDescription
commandApplicationCommandThe command which was deleted
Source

applicationCommandUpdate

deprecated

applicationCommandUpdate: unknown

Emitted when a guild application command is updated. Parameters

NameTypeDescription
oldCommandApplicationCommandThe command before the update
newCommandApplicationCommandThe command after the update
Source

callCreate

callCreate: unknown

Emitted whenever received a call Parameters

NameTypeDescription
callCallStateCall
Source

callDelete

callDelete: unknown

Emitted whenever delete a call Parameters

NameTypeDescription
callCallCall
Source

callUpdate

callUpdate: unknown

Emitted whenever update a call Parameters

NameTypeDescription
callCallCall
Source

channelPinsUpdate

channelPinsUpdate: unknown

Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event, not much information can be provided easily here - you need to manually check the pins yourself. Parameters

NameTypeDescription
channelTextBasedChannelsThe channel that the pins update occurred in
timeDateThe time of the pins update
Source

channelRecipientAdd

channelRecipientAdd: unknown

Emitted whenever a recipient is added from a group DM. Parameters

NameTypeDescription
channelGroupDMChannelGroup DM channel
userUserUser
Source

channelRecipientRemove

channelRecipientRemove: unknown

Emitted whenever a recipient is removed from a group DM. Parameters

NameTypeDescription
channelGroupDMChannelGroup DM channel
userUserUser
Source

channelUpdate

channelUpdate: unknown

Emitted whenever a channel is updated - e.g. name change, topic change, channel type change. Parameters

NameTypeDescription
oldChannelDMChannel | GuildChannelThe channel before the update
newChannelDMChannel | GuildChannelThe channel after the update
Source

guildAvailable

guildAvailable: unknown

Emitted whenever a guild becomes available. Parameters

NameTypeDescription
guildGuildThe guild that became available
Source

guildCreate

guildCreate: unknown

Emitted whenever the client joins a guild. Parameters

NameTypeDescription
guildGuildThe created guild
Source

guildMemberAdd

deprecated

guildMemberAdd: unknown

Emitted whenever a user joins a guild. Parameters

NameTypeDescription
memberGuildMemberThe member that has joined a guild
Source

guildMembersChunk

guildMembersChunk: unknown

Emitted whenever a chunk of guild members is received (all members come from the same guild). Parameters

NameTypeDescription
membersCollection<Snowflake, GuildMember>The members in the chunk
guildGuildThe guild related to the member chunk
chunkGuildMembersChunkProperties of the received chunk
Source

interactionModalCreate

interactionModalCreate: unknown

Emitted whenever client user receive interaction.showModal() Parameters

NameTypeDescription
modalModalThe modal (extended)
Source

messageUpdate

messageUpdate: unknown

Emitted whenever a message is updated - e.g. embed or content change. Parameters

NameTypeDescription
oldMessageMessageThe message before the update
newMessageMessageThe message after the update
Source

relationshipAdd

relationshipAdd: unknown

Emitted when a relationship is created, relevant to the current user. Parameters

NameTypeDescription
userSnowflakeTarget userId
shouldNotifybooleanWhether the client should notify the user of this relationship's creation
Source

relationshipRemove

relationshipRemove: unknown

Emitted when a relationship is removed, relevant to the current user. Parameters

NameTypeDescription
userSnowflakeThe userID that was updated
typeRelationshipTypeThe type of the old relationship
nicknamestring | nullThe nickname of the user in this relationship (1-32 characters)
Source

relationshipUpdate

relationshipUpdate: unknown

Emitted when a relationship is updated, relevant to the current user (e.g. friend nickname changed). This is not sent when the type of a relationship changes; see Client#relationshipAdd and Client#relationshipRemove for that. Parameters

NameTypeDescription
userSnowflakeThe userID that was updated
oldDataRelationshipUpdateObjectOld data
newDataRelationshipUpdateObjectNew data
Source

shardResume

shardResume: unknown

Emitted when a shard resumes successfully. Parameters

NameTypeDescription
idnumberThe shard id that resumed
replayedEventsnumberThe amount of replayed events
Source

threadUpdate

threadUpdate: unknown

Emitted whenever a thread is updated - e.g. name change, archive state change, locked state change. Parameters

NameTypeDescription
oldThreadThreadChannelThe thread before the update
newThreadThreadChannelThe thread after the update
Source

voiceChannelEffectSend

voiceChannelEffectSend: unknown

Emmited when someone sends an effect, such as an emoji reaction, in a voice channel the client is connected to. Parameters

NameTypeDescription
voiceChannelEffectVoiceChannelEffectThe sent voice channel effect
Source

shardReady

shardReady: unknown

Emitted when a shard turns ready. Parameters

NameTypeDescription
idnumberThe shard id that turned ready
unavailableGuildsSet<Snowflake>Set of unavailable guild ids, if any
Source

shardDisconnect

shardDisconnect: unknown

Emitted when a shard's WebSocket disconnects and will no longer reconnect. Parameters

NameTypeDescription
eventCloseEventThe WebSocket close event
idnumberThe shard id that disconnected
Source

shardReconnecting

shardReconnecting: unknown

Emitted when a shard is attempting to reconnect or re-identify. Parameters

NameTypeDescription
idnumberThe shard id that is attempting to reconnect
Source

invalidated

invalidated: unknown

Emitted when the client's session becomes invalidated. You are expected to handle closing the process gracefully and preventing a boot loop if you are listening to this event. Source

unhandledPacket

unhandledPacket: unknown

Emitted whenever a packet isn't handled. Parameters

NameTypeDescription
packetObjectThe packet (t: EVENT_NAME, d: any)
shardNumberThe shard that received the packet (Shard 0)
Source

ready

ready: unknown

Emitted when the client becomes ready to start working. Parameters

NameTypeDescription
clientClientThe client
Source

shardError

shardError: unknown

Emitted whenever a shard's WebSocket encounters a connection error. Parameters

NameTypeDescription
errorErrorThe encountered error
shardIdnumberThe shard that encountered this error
Source

error

error: unknown

Emitted when the client encounters an error. Errors thrown within this event do not have a catch handler, it is recommended to not use async functions as error event handlers. See the Node.js docs for details. Parameters

NameTypeDescription
errorErrorThe error encountered
Source

debug

debug: unknown

Emitted for general debugging information. Parameters

NameTypeDescription
infostringThe debug information
Source

rateLimit

rateLimit: unknown

Emitted when the client hits a rate limit while making a request Parameters

NameTypeDescription
rateLimitDataRateLimitDataObject containing the rate limit info
Source

apiRequest

apiRequest: unknown

Emitted before every API request. This event can emit several times for the same request, e.g. when hitting a rate limit. This is an informational event that is emitted quite frequently, it is highly recommended to check request.path to filter the data. Parameters

NameTypeDescription
requestAPIRequestThe request that is about to be sent
Source

apiResponse

apiResponse: unknown

Emitted after every API request has received a response. This event does not necessarily correlate to completion of the request, e.g. when hitting a rate limit. This is an informational event that is emitted quite frequently, it is highly recommended to check request.path to filter the data. Parameters

NameTypeDescription
requestAPIRequestThe request that triggered this response
responseResponseThe response received from the Discord API
Source

invalidRequestWarning

invalidRequestWarning: unknown

Emitted periodically when the process sends invalid requests to let users avoid the 10k invalid requests in 10 minutes threshold that causes a ban Parameters

NameTypeDescription
invalidRequestWarningDataInvalidRequestWarningDataObject containing the invalid request info
Source

Unofficial software. Not affiliated with or supported by Discord.