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 toolkit6d 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
Pyncre6d ago
Do you have an error ?
oploffty
oplofftyOP6d 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
NyR6d ago
And what is the error? Show that
oploffty
oplofftyOP6d ago
Okay
oploffty
oplofftyOP6d ago
No description
NyR
NyR6d ago
That's is your own custom error, d.js does not throw it, and is pretty self explanatory really.
oploffty
oplofftyOP6d ago
The problem is there is a name but it still dosnt work
NyR
NyR6d ago
And does it have run function? Show your joke.js file
oploffty
oplofftyOP6d ago
I have
NyR
NyR6d 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
oplofftyOP6d ago
Yes I used discord.js website to make it
Want results from more Discord servers?
Add your server