Could someone help me with a problem I’m getting

I run my bot from my pc using npm index.js or node index. Js cannot remember of the top Of my head and when I run it it says my command has no name or function when it does
12 Replies
d.js toolkit
d.js toolkit2mo 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!
Pyncre
Pyncre2mo ago
Do you have an error ?
oploffty
oplofftyOP2mo ago
No It lists all the commands that are online and then it says unable to load that command I’ll show code
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('mason-mum')
.setDescription('sends message about masons mum')
.addStringOption(option =>
option.setName('username')
.setDescription('Enter a username from this server')
.setRequired(true)
.addChoices(
{ name: 'Masons mum', value: 'mason_user_id' }, // user id goes here
{ name: 'Louies mum', value: 'louie_user_id' }, // user id goes here
{ name: 'Charlie w dad', value: 'charlie_w_user_id' }, // user id goes here
{ name: 'Kumials dad', value: 'kumial_user_id' }, // user id goes here
{ name: 'Archies mum', value: 'archie_user_id'}, // user id goes here
{ name: 'Armandas mum', value: 'armandas_user_id'} // user id goes here
)),
async execute(interaction) {
const username = interaction.options.getString('username');
const userId = username;

await interaction.reply(`Hey guess what! <@${interaction.user.id}>! thinks <@${userId}>! is a baddie`);
},
};
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('mason-mum')
.setDescription('sends message about masons mum')
.addStringOption(option =>
option.setName('username')
.setDescription('Enter a username from this server')
.setRequired(true)
.addChoices(
{ name: 'Masons mum', value: 'mason_user_id' }, // user id goes here
{ name: 'Louies mum', value: 'louie_user_id' }, // user id goes here
{ name: 'Charlie w dad', value: 'charlie_w_user_id' }, // user id goes here
{ name: 'Kumials dad', value: 'kumial_user_id' }, // user id goes here
{ name: 'Archies mum', value: 'archie_user_id'}, // user id goes here
{ name: 'Armandas mum', value: 'armandas_user_id'} // user id goes here
)),
async execute(interaction) {
const username = interaction.options.getString('username');
const userId = username;

await interaction.reply(`Hey guess what! <@${interaction.user.id}>! thinks <@${userId}>! is a baddie`);
},
};
NyR
NyR2mo ago
And what is the error? Show that
oploffty
oplofftyOP2mo ago
Okay
oploffty
oplofftyOP2mo ago
No description
NyR
NyR2mo ago
That's is your own custom error, d.js does not throw it, and is pretty self explanatory really.
oploffty
oplofftyOP2mo ago
The problem is there is a name but it still dosnt work
NyR
NyR2mo ago
And does it have run function? Show your joke.js file
oploffty
oplofftyOP2mo ago
I have
NyR
NyR2mo ago
Your function there is named execute while your handler expect run, judging from the error if I'd have to guess Did you even write this code?
oploffty
oplofftyOP2mo ago
Yes I used discord.js website to make it
Want results from more Discord servers?
Add your server