Skip to main content
yor.ts / Exports / YorClient

Class: YorClient

Table of contents

Constructors

Properties

Methods

Constructors

constructor

• new YorClient(options): YorClient Creates a new instance of the class.

Parameters

Returns

YorClient

Defined in

src/structures/YorClient.ts:95

Properties

api

• api: YorClientAPI

Defined in

src/structures/YorClient.ts:83

commands

• Readonly commands: Collection<string, YorSlashCommand>

Defined in

src/structures/YorClient.ts:67

components

• Readonly components: Collection<string, YorInteractionComponent>

Defined in

src/structures/YorClient.ts:68

messageCommands

• Readonly messageCommands: Collection<string, YorMessageContextMenuCommand>

Defined in

src/structures/YorClient.ts:73

middlewares

• middlewares: Record<MiddlewareFunctionNames, ((context: CommandContext) => void | Promise<void> | (context: MessageContextMenuCommandInteraction) => void | Promise<void> | (context: CommandContext) => void | Promise<void> | (context: ComponentContext) => void | Promise<void> | (context: ModalContext) => void | Promise<void> | (context: AutocompleteCommandContext) => void | Promise<void>)[]>

Defined in

src/structures/YorClient.ts:85

modals

• Readonly modals: Collection<string, YorInteractionModal>

Defined in

src/structures/YorClient.ts:72

options

• Readonly options: YorClientOptions

Defined in

src/structures/YorClient.ts:66

rest

• rest: REST

Defined in

src/structures/YorClient.ts:82

userCommands

• Readonly userCommands: Collection<string, YorUserContextMenuCommand>

Defined in

src/structures/YorClient.ts:77

Methods

createMiddleware

▸ createMiddleware<T>(name, middleware): void Creates middleware for a given name and adds it to the middlewares array.

Type parameters

Parameters

Returns

void

Defined in

src/structures/YorClient.ts:410

deployCommands

▸ deployCommands(guild?): Promise<RESTPutAPIApplicationCommandsResult> Deploys the commands to the API application and returns the result.

Parameters

Returns

Promise<RESTPutAPIApplicationCommandsResult> The result of the deployment.

Defined in

src/structures/YorClient.ts:246

handleInteraction

▸ handleInteraction(request): Promise<APIInteractionResponse> Handles an interaction request from the API.

Parameters

Returns

Promise<APIInteractionResponse>
  • An object containing a promise for the response.

Defined in

src/structures/YorClient.ts:423

handleInteractionRequest

▸ handleInteractionRequest(data): Promise<{ type: InteractionResponseType = InteractionResponseType.PONG }> Handles the interaction request.

Parameters

Returns

Promise<{ type: InteractionResponseType = InteractionResponseType.PONG }>

Defined in

src/structures/YorClient.ts:459

registerCommand

▸ registerCommand(command): Collection<string, YorSlashCommand> Registers a slash command.

Parameters

Returns

Collection<string, YorSlashCommand>
  • The updated commands collection.

Defined in

src/structures/YorClient.ts:119

registerCommands

▸ registerCommands(commands): Collection<string, YorSlashCommand> Registers the provided slash commands.

Parameters

Returns

Collection<string, YorSlashCommand>
  • The updated commands map.

Defined in

src/structures/YorClient.ts:137

registerComponent

▸ registerComponent(component): Collection<string, YorInteractionComponent> Registers a component in the collection.

Parameters

Returns

Collection<string, YorInteractionComponent>
  • The updated collection of components.

Defined in

src/structures/YorClient.ts:274

registerComponents

▸ registerComponents(components): Collection<string, YorInteractionComponent> Registers the given components in the collection.

Parameters

Returns

Collection<string, YorInteractionComponent>
  • The updated collection of components.

Defined in

src/structures/YorClient.ts:293

registerMessageCommand

▸ registerMessageCommand(command): Collection<string, YorMessageContextMenuCommand> Registers a message command.

Parameters

Returns

Collection<string, YorMessageContextMenuCommand>
  • The updated message commands collection.

Defined in

src/structures/YorClient.ts:195

registerModal

▸ registerModal(modal): Collection<string, YorInteractionModal> Registers a modal in the collection.

Parameters

Returns

Collection<string, YorInteractionModal>
  • The updated collection of modals.

Defined in

src/structures/YorClient.ts:344

registerModals

▸ registerModals(modals): Collection<string, YorInteractionModal> Registers the given modals in the collection.

Parameters

Returns

Collection<string, YorInteractionModal>
  • The updated collection of modals.

Defined in

src/structures/YorClient.ts:361

registerUserCommand

▸ registerUserCommand(command): Collection<string, YorUserContextMenuCommand> Registers a user command.

Parameters

Returns

Collection<string, YorUserContextMenuCommand>
  • The updated user commands collection.

Defined in

src/structures/YorClient.ts:221

unregisterAllCommands

▸ unregisterAllCommands(): Collection<string, YorSlashCommand> Unregisters all slash commands.

Returns

Collection<string, YorSlashCommand>
  • The updated commands map.

Defined in

src/structures/YorClient.ts:184

unregisterCommand

▸ unregisterCommand(command): Collection<string, YorSlashCommand> Unregisters a slash command.

Parameters

Returns

Collection<string, YorSlashCommand>
  • The updated commands collection.

Defined in

src/structures/YorClient.ts:157

unregisterCommands

▸ unregisterCommands(commands): Collection<string, YorSlashCommand> Unregisters the provided slash commands.

Parameters

Returns

Collection<string, YorSlashCommand>
  • The updated commands map.

Defined in

src/structures/YorClient.ts:170

unregisterComponent

▸ unregisterComponent(component): Collection<string, YorInteractionComponent> Deletes the specified component from the collection and returns the updated collection.

Parameters

Returns

Collection<string, YorInteractionComponent>
  • The updated collection of components.

Defined in

src/structures/YorClient.ts:314

unregisterComponents

▸ unregisterComponents(components): Collection<string, YorInteractionComponent> Unregisters components from the collection.

Parameters

Returns

Collection<string, YorInteractionComponent>
  • The updated components collection.

Defined in

src/structures/YorClient.ts:328

unregisterMessageCommand

▸ unregisterMessageCommand(command): Collection<string, YorMessageContextMenuCommand> Unregisters a message command.

Parameters

Returns

Collection<string, YorMessageContextMenuCommand>
  • The updated message commands collection.

Defined in

src/structures/YorClient.ts:208

unregisterModal

▸ unregisterModal(modal): Collection<string, YorInteractionModal> Deletes the specified modal from the collection and returns the updated collection.

Parameters

Returns

Collection<string, YorInteractionModal>
  • The updated collection of modals.

Defined in

src/structures/YorClient.ts:380

unregisterModals

▸ unregisterModals(modals): Collection<string, YorInteractionModal> Unregisters modals from the collection.

Parameters

Returns

Collection<string, YorInteractionModal>
  • The updated collection of modals.

Defined in

src/structures/YorClient.ts:394

unregisterUserCommand

▸ unregisterUserCommand(command): Collection<string, YorUserContextMenuCommand> Unregisters a user command.

Parameters

Returns

Collection<string, YorUserContextMenuCommand>
  • The updated user commands collection.

Defined in

src/structures/YorClient.ts:234