Class: YorClient
Table of contents
Constructors
Properties
Methods
- createMiddleware
- deployCommands
- handleInteraction
- handleInteractionRequest
- registerCommand
- registerCommands
- registerComponent
- registerComponents
- registerMessageCommand
- registerModal
- registerModals
- registerUserCommand
- unregisterAllCommands
- unregisterCommand
- unregisterCommands
- unregisterComponent
- unregisterComponents
- unregisterMessageCommand
- unregisterModal
- unregisterModals
- unregisterUserCommand
Constructors
constructor
• new YorClient(options): YorClient
Creates a new instance of the class.
Parameters
| Name | Type | Description |
|---|---|---|
options | YorClientOptions | The configuration options for the client. |
Returns
YorClient
Defined in
src/structures/YorClient.ts:95Properties
api
• api:YorClientAPI
Defined in
src/structures/YorClient.ts:83commands
•Readonly commands: Collection<string, YorSlashCommand>
Defined in
src/structures/YorClient.ts:67components
•Readonly components: Collection<string, YorInteractionComponent>
Defined in
src/structures/YorClient.ts:68messageCommands
•Readonly messageCommands: Collection<string, YorMessageContextMenuCommand>
Defined in
src/structures/YorClient.ts:73middlewares
• 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:85modals
•Readonly modals: Collection<string, YorInteractionModal>
Defined in
src/structures/YorClient.ts:72options
•Readonly options: YorClientOptions
Defined in
src/structures/YorClient.ts:66rest
• rest:REST
Defined in
src/structures/YorClient.ts:82userCommands
•Readonly userCommands: Collection<string, YorUserContextMenuCommand>
Defined in
src/structures/YorClient.ts:77Methods
createMiddleware
▸ createMiddleware<T>(name, middleware): void
Creates middleware for a given name and adds it to the middlewares array.
Type parameters
| Name | Type |
|---|---|
T | extends MiddlewareFunctionNames |
Parameters
| Name | Type | Description |
|---|---|---|
name | T | The name of the middleware. |
middleware | MiddlewareFunction<T> | The middleware function. |
Returns
void
Defined in
src/structures/YorClient.ts:410deployCommands
▸ deployCommands(guild?): Promise<RESTPutAPIApplicationCommandsResult>
Deploys the commands to the API application and returns the result.
Parameters
| Name | Type |
|---|---|
guild? | string |
Returns
Promise<RESTPutAPIApplicationCommandsResult>
The result of the deployment.
Defined in
src/structures/YorClient.ts:246handleInteraction
▸ handleInteraction(request): Promise<APIInteractionResponse>
Handles an interaction request from the API.
Parameters
| Name | Type | Description |
|---|---|---|
request | Request | The request object containing the interaction data. |
Returns
Promise<APIInteractionResponse>
- An object containing a promise for the response.
Defined in
src/structures/YorClient.ts:423handleInteractionRequest
▸ handleInteractionRequest(data): Promise<{ type: InteractionResponseType = InteractionResponseType.PONG }>
Handles the interaction request.
Parameters
| Name | Type | Description |
|---|---|---|
data | APIInteraction | The interaction data. |
Returns
Promise<{ type: InteractionResponseType = InteractionResponseType.PONG }>
Defined in
src/structures/YorClient.ts:459registerCommand
▸ registerCommand(command): Collection<string, YorSlashCommand>
Registers a slash command.
Parameters
| Name | Type | Description |
|---|---|---|
command | YorSlashCommand | The slash command to register. |
Returns
Collection<string, YorSlashCommand>
- The updated commands collection.
Defined in
src/structures/YorClient.ts:119registerCommands
▸ registerCommands(commands): Collection<string, YorSlashCommand>
Registers the provided slash commands.
Parameters
| Name | Type | Description |
|---|---|---|
commands | YorSlashCommand[] | The slash commands to register. |
Returns
Collection<string, YorSlashCommand>
- The updated commands map.
Defined in
src/structures/YorClient.ts:137registerComponent
▸ registerComponent(component): Collection<string, YorInteractionComponent>
Registers a component in the collection.
Parameters
| Name | Type | Description |
|---|---|---|
component | YorInteractionComponent | The component to register. |
Returns
Collection<string, YorInteractionComponent>
- The updated collection of components.
Defined in
src/structures/YorClient.ts:274registerComponents
▸ registerComponents(components): Collection<string, YorInteractionComponent>
Registers the given components in the collection.
Parameters
| Name | Type | Description |
|---|---|---|
components | YorInteractionComponent[] | The components to register. |
Returns
Collection<string, YorInteractionComponent>
- The updated collection of components.
Defined in
src/structures/YorClient.ts:293registerMessageCommand
▸ registerMessageCommand(command): Collection<string, YorMessageContextMenuCommand>
Registers a message command.
Parameters
| Name | Type | Description |
|---|---|---|
command | YorMessageContextMenuCommand | The message command to register. |
Returns
Collection<string, YorMessageContextMenuCommand>
- The updated message commands collection.
Defined in
src/structures/YorClient.ts:195registerModal
▸ registerModal(modal): Collection<string, YorInteractionModal>
Registers a modal in the collection.
Parameters
| Name | Type | Description |
|---|---|---|
modal | YorInteractionModal | The modal to be registered. |
Returns
Collection<string, YorInteractionModal>
- The updated collection of modals.
Defined in
src/structures/YorClient.ts:344registerModals
▸ registerModals(modals): Collection<string, YorInteractionModal>
Registers the given modals in the collection.
Parameters
| Name | Type | Description |
|---|---|---|
modals | YorInteractionModal[] | The modals to be registered. |
Returns
Collection<string, YorInteractionModal>
- The updated collection of modals.
Defined in
src/structures/YorClient.ts:361registerUserCommand
▸ registerUserCommand(command): Collection<string, YorUserContextMenuCommand>
Registers a user command.
Parameters
| Name | Type | Description |
|---|---|---|
command | YorUserContextMenuCommand | The user command to register. |
Returns
Collection<string, YorUserContextMenuCommand>
- The updated user commands collection.
Defined in
src/structures/YorClient.ts:221unregisterAllCommands
▸ unregisterAllCommands():Collection<string, YorSlashCommand>
Unregisters all slash commands.
Returns
Collection<string, YorSlashCommand>
- The updated commands map.
Defined in
src/structures/YorClient.ts:184unregisterCommand
▸ unregisterCommand(command): Collection<string, YorSlashCommand>
Unregisters a slash command.
Parameters
| Name | Type | Description |
|---|---|---|
command | YorSlashCommand | The slash command to unregister. |
Returns
Collection<string, YorSlashCommand>
- The updated commands collection.
Defined in
src/structures/YorClient.ts:157unregisterCommands
▸ unregisterCommands(commands): Collection<string, YorSlashCommand>
Unregisters the provided slash commands.
Parameters
| Name | Type | Description |
|---|---|---|
commands | YorSlashCommand[] | The slash commands to unregister. |
Returns
Collection<string, YorSlashCommand>
- The updated commands map.
Defined in
src/structures/YorClient.ts:170unregisterComponent
▸ unregisterComponent(component): Collection<string, YorInteractionComponent>
Deletes the specified component from the collection and returns the updated collection.
Parameters
| Name | Type | Description |
|---|---|---|
component | YorInteractionComponent | The component to unregister. |
Returns
Collection<string, YorInteractionComponent>
- The updated collection of components.
Defined in
src/structures/YorClient.ts:314unregisterComponents
▸ unregisterComponents(components): Collection<string, YorInteractionComponent>
Unregisters components from the collection.
Parameters
| Name | Type | Description |
|---|---|---|
components | YorInteractionComponent[] | The components to unregister. |
Returns
Collection<string, YorInteractionComponent>
- The updated components collection.
Defined in
src/structures/YorClient.ts:328unregisterMessageCommand
▸ unregisterMessageCommand(command): Collection<string, YorMessageContextMenuCommand>
Unregisters a message command.
Parameters
| Name | Type | Description |
|---|---|---|
command | YorMessageContextMenuCommand | The message command to unregister. |
Returns
Collection<string, YorMessageContextMenuCommand>
- The updated message commands collection.
Defined in
src/structures/YorClient.ts:208unregisterModal
▸ unregisterModal(modal): Collection<string, YorInteractionModal>
Deletes the specified modal from the collection and returns the updated collection.
Parameters
| Name | Type | Description |
|---|---|---|
modal | YorInteractionModal | The modal to unregister. |
Returns
Collection<string, YorInteractionModal>
- The updated collection of modals.
Defined in
src/structures/YorClient.ts:380unregisterModals
▸ unregisterModals(modals): Collection<string, YorInteractionModal>
Unregisters modals from the collection.
Parameters
| Name | Type | Description |
|---|---|---|
modals | YorInteractionModal[] | The modals to unregister. |
Returns
Collection<string, YorInteractionModal>
- The updated collection of modals.
Defined in
src/structures/YorClient.ts:394unregisterUserCommand
▸ unregisterUserCommand(command): Collection<string, YorUserContextMenuCommand>
Unregisters a user command.
Parameters
| Name | Type | Description |
|---|---|---|
command | YorUserContextMenuCommand | The user command to unregister. |
Returns
Collection<string, YorUserContextMenuCommand>
- The updated user commands collection.
