Context menus are a new, cool way to for users to interact with your bot. Context menus can be accessed by right clicking or tapping on messages/users. They're a great way to surface quick actions for your bot that target messages/users.
Don't forget to add the onInteraction event to your main file. For example:
bot.addEvent([
"onMessage",
"onInteraction"
])
Creating Application Command Data
To create a context menu application, you can use the createApplicationCommandData method in bot class:
Deploy this context menu to a guild (or globally).
Template:
bot.commands.add({
name: "deploy",
type: "basicCommand",
code: `$if[$botOwnerID!==$authorID;
You can't use this command!
;
$createContextMenuApplication[guildID/global;contextMenuName]
Successfully created context menu app!
]`
})
Example:
bot.commands.add({
name: "deploy",
type: "basicCommand",
code: `$if[$botOwnerID!==$authorID;
You can't use this command!
;
$createContextMenuApplication[$guildID;Punch]
Successfully created context menu app!
]`
})
Responding to Context Menu Interactions
To respond to an interaction of a context menu, you can use the contextMenuCommand type.