Client
The main client used to interact with Discord
Constructors
Constructor
new Client(
options
,handlers
,plugins
):Client
Creates a new client
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
options | ClientOptions | undefined | The options used to initialize the client |
handlers | { commands : BaseCommand []; listeners : BaseListener []; } | undefined | The handlers that the client has registered |
handlers.commands? | BaseCommand [] | undefined | - |
handlers.listeners? | BaseListener [] | undefined | - |
plugins | Plugin [] | [] | The plugins that the client should use |
Returns
Client
Properties
Property | Type | Default value | Description |
---|---|---|---|
commandHandler | CommandHandler | undefined | Internal The handler for the modal interactions sent from Discord |
commands | BaseCommand [] | undefined | The commands that the client has registered |
componentHandler | ComponentHandler | undefined | Internal The handler for the component interactions sent from Discord |
eventHandler | EventHandler | undefined | Internal The handler for events sent from Discord |
listeners | BaseListener [] | [] | The event listeners that the client has registered |
modalHandler | ModalHandler | undefined | Internal The handler for the modal interactions sent from Discord |
options | ClientOptions | undefined | The options used to initialize the client |
plugins | Plugin [] | [] | The plugins that the client has registered |
rest | RequestClient | undefined | The rest client used to interact with the Discord API |
routes | Route [] | [] | The routes that the client will handle |
Methods
fetchChannel()
fetchChannel(
id
):Promise
<null
|DmChannel
<false
> |GroupDmChannel
<false
> |GuildTextChannel
<false
> |GuildVoiceChannel
<false
> |GuildCategoryChannel
<false
> |GuildAnnouncementChannel
<false
> |GuildThreadChannel
<ThreadChannelType
,false
> |GuildStageChannel
<false
> |GuildForumChannel
<false
> |GuildMediaChannel
>
Fetch a channel from the Discord API
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The ID of the channel to fetch |
Returns
Promise
<null
| DmChannel
<false
> | GroupDmChannel
<false
> | GuildTextChannel
<false
> | GuildVoiceChannel
<false
> | GuildCategoryChannel
<false
> | GuildAnnouncementChannel
<false
> | GuildThreadChannel
<ThreadChannelType
, false
> | GuildStageChannel
<false
> | GuildForumChannel
<false
> | GuildMediaChannel
>
The channel data
fetchGuild()
Fetch a guild from the Discord API
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The ID of the guild to fetch |
Returns
The guild data
fetchMember()
fetchMember(
guildId
,id
):Promise
<GuildMember
<false
,true
>>
Fetch a member from the Discord API
Parameters
Parameter | Type | Description |
---|---|---|
guildId | string | The ID of the guild the member is in |
id | string | The ID of the member to fetch |
Returns
Promise
<GuildMember
<false
, true
>>
The member data
fetchMessage()
Fetch a message from the Discord API
Parameters
Parameter | Type | Description |
---|---|---|
channelId | string | The ID of the channel the message is in |
messageId | string | The ID of the message to fetch |
Returns
The message data
fetchRole()
Fetch a role from the Discord API
Parameters
Parameter | Type | Description |
---|---|---|
guildId | string | - |
id | string | The ID of the role to fetch |
Returns
The role data
fetchUser()
Fetch a user from the Discord API
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The ID of the user to fetch |
Returns
The user data
handleDeployRequest()
Handle a request to deploy the commands to Discord
Returns
A response
handleEventsRequest()
Handle an interaction request from Discord
Parameters
Parameter | Type | Description |
---|---|---|
req | Request | The request to handle |
Returns
A response
handleInteractionsRequest()
Handle an interaction request from Discord
Parameters
Returns
A response