Skip to content

Commit 84fad99

Browse files
committed
Added ContextMenus
1 parent c0510fd commit 84fad99

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/events/interactionCreate.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
export default {
22
event: 'interactionCreate',
33
async execute(client, interaction) {
4-
try {
4+
try {
5+
6+
if (interaction.isUserContextMenuCommand() === true) {
7+
const contextMenu = client.contextMenus.get(interaction.commandName);
8+
if (!contextMenu) return;
9+
try {
10+
contextMenu.execute(client, interaction);
11+
} catch (error) {
12+
interaction.reply({ content: 'There was an error while executing this context menu!', ephemeral: true });
13+
console.log(error);
14+
}
15+
}
16+
517
if (interaction.isCommand()) {
618
const command = client.slashCommands.get(interaction.commandName);
719
if (!command) return;

0 commit comments

Comments
 (0)