Class SlashCommandMiddleware

Represents a slash command middleware

Constructors

Properties

Constructors

  • Creates a new slash command middleware

    Parameters

    Returns SlashCommandMiddleware

    Example

    // This means that the slash command will only be ran if the user is in a voice channel
    const IsInVoiceChannel = new SlashCommandMiddleware(
    (client, interaction) => interaction.member.voice.channel !== null,
    (client, interaction) => interaction.reply('You must be in a voice channel to use this command.')
    );

    module.exports.default = new SlashCommand({
    // ...
    middlewares: [IsInVoiceChannel]
    }, (...) => { ... });

Properties

failCallback?: SlashCommandCallback

The predicate for the middleware

Generated using TypeDoc