Context Menu Commands

Context menu commands are similar to slash commands, but instead of placing them inside the chat folder, you place them inside the message or user folder respectively. Context menu commands also use MessageCommand and UserCommand respectively.

Here's a quick example command:

import { MessageCommand } from 'slashasaurus';

export default new MessageCommand(
  {
    name: 'Mock',
  },
  (interaction, _client) => {
    const content = interaction.targetMessage.content;
    interaction.reply({
      content: content
        .split('')
        .map((letter, index) =>
          index % 2 === 0
            ? letter.toLocaleLowerCase()
            : letter.toLocaleUpperCase()
        )
        .join(''),
      ephemeral: true,
    });
  }
);

Last updated