null value from slash command option
index.js
resgister-commands.js
error
32 Replies
- 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!
- ✅
Marked as resolved by OP[nodemon] app crashed - waiting for file changes before starting...
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
a {
no
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
that was reg commands
const num1 = interaction.options.get('first-number').value;
i should change .value
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
but i ran a entirelly different command tho
no
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
wait
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
require('dotenv').config();
const { Client, IntentsBitField } = require ('discord.js');
const client = new Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
],
});
client.on('ready', (c) => {
console.log('scrodringer is expeimenting.'); //you can use ${user.tag.id(or .tag or smth)} to mention the bot like console.log(
${user.tag.id} is expeimenting.
);
});
client.on('messageCreate', (message) => {
if (message.author.bot) { // ignores bots message
return;
}
if (message.content === 'hello') {
message.reply('hi')
}
})Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
the code is too big
lemme do pastebin
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
Pastebin
require('dotenv').config();const { Client, IntentsBitField } = requ...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lemme see
but
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
the command is about embed
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
i think i got a diff error after changing .values to .getNumber
[nodemon] 3.1.0
[nodemon] to restart at any time, enter
rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting node src/index.js
scrodringer is expeimenting.
C:\Users\SWEET HOME\Desktop\BTEP\node_modules@discordjs\rest\dist\index.js:722
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\SWEET HOME\Desktop\BTEP\node_modules@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\SWEET HOME\Desktop\BTEP\node_modules@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\SWEET HOME\Desktop\BTEP\node_modules@discordjs\rest\dist\index.js:1266:22)
at async ChatInputCommandInteraction.reply (C:\Users\SWEET HOME\Desktop\BTEP\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5) {
requestBody: {
files: [],
json: {
type: 4,
data: {
content: 'The sum is 3',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
}
},
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'liiink'
}
Node.js v20.11.1
[nodemon] app crashed - waiting for file changes before starting...just to elaborate, every
interactionCreate
listener will execute for every interaction emitted
you may continue to encounter further errors without fully understanding how each of your event listeners affect each other
it's recommended to only have 1 event listener per eventwait, gimme a minute i see a problem
so basically
i didnt close the previous event listener
which was of a mathematical operation
well the more problematic listener is probably the one on line 88 of your pastebin that responds indiscriminately to every slash command interaction
by event listener you meant
right?
yes
i havent faced any prob running 5 yet?
what could be possible problems
except you have?
the errors you've posted so far are caused by this
both of them
human error
right?
Human error is due to carelessness or to the limitations of human ability.
a physics term ig
I mean depending on how you interpret it, I suppose so
got it
thanks btw