Skip to content

extendContext

1
extendContext<T>(cb: (interaction: ChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | ComponentInteraction<boolean, APIMessageComponentInteraction>) => T): (interaction: ChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | ComponentInteraction<boolean, APIMessageComponentInteraction>) => T

Extends the context of a command interaction.

Type parameters

Type parameter
T extends Object

Parameters

ParameterTypeDescription
cb(interaction: ChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | ComponentInteraction<boolean, APIMessageComponentInteraction>) => TThe callback function to extend the context.

Returns

Function

The extended context.

Parameters

ParameterType
interactionChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | ComponentInteraction<boolean, APIMessageComponentInteraction>

Returns

T

Example

1
const customContext = extendContext((interaction) => {
2
return {
3
owner: '123456789012345678',
4
// Add your custom properties here
5
};
6
});

Source

seyfert/src/index.ts:104