Carbon
CoreClasses

Client

The main client used to interact with Discord

Extends

Constructors

new Client()

new Client(options, commands): Client

Creates a new client

Parameters

ParameterTypeDescription
optionsClientOptionsThe options used to initialize the client
commandsBaseCommand[]The commands that the client has registered

Returns

Client

Overrides

Plugin.constructor

Properties

PropertyTypeDefault valueDescriptionInherited from
commandHandlerCommandHandlerundefinedInternal The handler for the modal interactions sent from Discord-
commandsBaseCommand[]undefinedThe commands that the client has registered-
componentHandlerComponentHandlerundefinedInternal The handler for the component interactions sent from Discord-
modalHandlerModalHandlerundefinedInternal The handler for the modal interactions sent from Discord-
optionsClientOptionsundefinedThe options used to initialize the client-
restRequestClientundefinedThe rest client used to interact with the Discord API-
routesRoute[][]-Plugin.routes

Methods

fetchChannel()

fetchChannel(id): Promise<null | GuildCategoryChannel<false> | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel>

Fetch a channel from the Discord API

Parameters

ParameterTypeDescription
idstringThe ID of the channel to fetch

Returns

Promise<null | GuildCategoryChannel<false> | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel>

The channel data


fetchGuild()

fetchGuild(id): Promise<Guild<false>>

Fetch a guild from the Discord API

Parameters

ParameterTypeDescription
idstringThe ID of the guild to fetch

Returns

Promise<Guild<false>>

The guild data


fetchMember()

fetchMember(guildId, id): Promise<GuildMember<false, true>>

Fetch a member from the Discord API

Parameters

ParameterTypeDescription
guildIdstringThe ID of the guild the member is in
idstringThe ID of the member to fetch

Returns

Promise<GuildMember<false, true>>

The member data


fetchRole()

fetchRole(guildId, id): Promise<Role<false>>

Fetch a role from the Discord API

Parameters

ParameterTypeDescription
guildIdstring-
idstringThe ID of the role to fetch

Returns

Promise<Role<false>>

The role data


fetchUser()

fetchUser(id): Promise<User<false>>

Fetch a user from the Discord API

Parameters

ParameterTypeDescription
idstringThe ID of the user to fetch

Returns

Promise<User<false>>

The user data


handleDeployRequest()

handleDeployRequest(): Promise<Response>

Handle a request to deploy the commands to Discord

Returns

Promise<Response>

A response


handleInteractionsRequest()

handleInteractionsRequest(req, ctx): Promise<Response>

Handle an interaction request from Discord

Parameters

ParameterTypeDescription
reqRequestThe request to handle
ctxContextThe context for the request

Returns

Promise<Response>

A response

On this page

Edit on GitHub