ContextMenu Build

I want to make a contextmenu command the problem is it says:
8 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
kileroxx
kileroxxOP8mo ago
data: new ContextMenuCommandBuilder() ^ TypeError: ContextMenuCommandBuilder is not a constructor at Object.<anonymous> (C:\Users\jakso\Desktop\bsbot\commands\test.js:5:11) at Module._compile (node:internal/modules/cjs/loader:1368:14) at Module._extensions..js (node:internal/modules/cjs/loader:1426:10) at Module.load (node:internal/modules/cjs/loader:1205:32) at Module._load (node:internal/modules/cjs/loader:1021:12) at Module.require (node:internal/modules/cjs/loader:1230:19) at require (node:internal/modules/helpers:179:18) at Object.<anonymous> (C:\Users\jakso\Desktop\bsbot\index.js:13:21) at Module._compile (node:internal/modules/cjs/loader:1368:14) at Module._extensions..js (node:internal/modules/cjs/loader:1426:10) someone said that the command loading like a slash command but its doesent work for me:(
const { ContextMenuCommandBuilder, ApplicationCommandType } = require('discord.js');


module.exports = {
data: new ContextMenuCommandBuilder()
.setName('Get User Avatar')
.setType(ApplicationCommandType.User)
.toJSON(),

async execute(interaction) {
const user = interaction.targetUser;
const avatarURL = user.avatarURL({ dynamic: true, size: 2048 });

await interaction.reply({ content: `Avatar of ${user.username}: ${avatarURL}`, ephemeral: true });
}
};
const { ContextMenuCommandBuilder, ApplicationCommandType } = require('discord.js');


module.exports = {
data: new ContextMenuCommandBuilder()
.setName('Get User Avatar')
.setType(ApplicationCommandType.User)
.toJSON(),

async execute(interaction) {
const user = interaction.targetUser;
const avatarURL = user.avatarURL({ dynamic: true, size: 2048 });

await interaction.reply({ content: `Avatar of ${user.username}: ${avatarURL}`, ephemeral: true });
}
};
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
kileroxx
kileroxxOP8mo ago
Oh okay but i dont need a extra handle? someone said its loading like a / command i only have a slashcommandbuilder
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
kileroxx
kileroxxOP8mo ago
perfect but need to import the slashcommandhandler or is this doesent matter?
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server