owengombas / discord.ts

🤖 Create your discord bot by using TypeScript and decorators!

Home Page:https://owencalvin.github.io/discord.ts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Context Menu (User and Message) Interactions

snazzyfox opened this issue · comments

Discord recently shipped context menu commands for users and messages. It would be great if these can be supported as additional decorators.

They are, for the most part, registered and handled the same way as slash commands, with the only differences being:

  • There is no description
  • There are no options (the Interaction includes the user/message that the menu was used on)

An example usage would be something like:

@ContextMenu('Mute', 'USER')
@Guild(GUILD_ID)
@Permission(ROLE_ID, "ROLE")
private async mute(interaction: ContextMenuInteraction) {
    const user = await interaction.guild.members.fetch(interaction.targetId);
    await do_some_thing_with(message);
    interaction.reply("done with message");
}

An alternative is to have separate @MessageContextMenu and @UserContextMenu decorators instead of a single one where the type can be toggled. This does not make a practical difference, since discord.js does not distinguish between the two types of responses and the function signature remains the same.

Hello, @snazzyfox

this package is currently not maintained, I suggest you should try, new improved version of this package and for context menu, try @ContextMenu

also see #62

Thanks