When i try to /authkey or /wl i have this problem
When i try to /authkey or /wl i have this problem
14 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!C:\Users\enzo
-- (empty)
v20.11.0
Here.
So,
Here is my code:
```js
const { Client, Collection, GatewayIntentBits, SlashCommandBuilder } = require('discord.js');
const data = new SlashCommandBuilder()
.setName('keyauth')
.setDescription('Generate an authentication key.')
.setDefaultPermission(false)
.addStringOption((option) => option
.setName('duration')
.setDescription('Duration of the key')
.setRequired(true)
.addChoices(
{ name: '1 day', value: '1day' },
{ name: '3 days', value: '3days' },
{ name: '1 week', value: '1week' },
{ name: '1 month', value: '1month' },
{ name: '1 year', value: '1year' },
{ name: 'Lifetime', value: 'lifetime' },
)
);
module.exports = {
data,
async execute(interaction) {
const duration = interaction.options.getString('duration');
if (!duration || !keyAuth[duration]) {
await interaction.reply('Please specify a valid duration (1day, 3days, 1week, 1month, 1year, lifetime).');
return;
}
if (!whitelist.has(interaction.user.id)) {
await interaction.reply('You are not authorized to generate authentication keys.');
return;
}
// Generate a unique key
const key = generateKey();
// Store the key in a database or any other storage method
// Calculate the expiration date
const expirationDate = keyAuth[duration] === 'lifetime' ? 'Lifetime' : new Date(Date.now() + keyAuth[duration]);
await interaction.reply(
Generated authentication key: ${key}\nDuration: ${duration}\nExpiration date: ${expirationDate}`);
},
};
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.execute(interaction);
} catch (error) {
console.error('An error occurred:', error);
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
});
const keyauth = require('./keyauth');
const commands = new Collection();
commands.set('keyauth', keyauth);
client.commands = commands;
client.login('mine ');```
Yes?
This is the keyauth.jsthis is index
file
ayo
Why i have that..
No..
I am the owner..
ye
I have MrBest1.
And this.
And the ID
Its MrBeast1
so idk
already reset token
but still not working
ye
Error: Started refreshing 2 application (/) commands.
DiscordAPIError[0]: 401: Unauthorized
at handleErrors (C:\Users\enzo\bot\uwu\node_modules@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\enzo\bot\uwu\node_modules@discordjs\rest\dist\index.js:1120:23)
at async SequentialHandler.queueRequest (C:\Users\enzo\bot\uwu\node_modules@discordjs\rest\dist\index.js:953:14)
at async _REST.request (C:\Users\enzo\bot\uwu\node_modules@discordjs\rest\dist\index.js:1266:22)
at async C:\Users\enzo\bot\uwu\deploy-commands.js:34:16 {
requestBody: { files: undefined, json: [ [Object], [Object] ] },
rawError: { message: '401: Unauthorized', code: 0 },
code: 0,
status: 401,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1200996227739815987/guilds/1200230495271788645/commands'
}
C:\Users\enzo\bot\uwu\node_modules@discordjs\ws\dist\index.js:1132
error: new Error("Used disallowed intents")
^
Error: Used disallowed intents
at WebSocketShard.onClose (C:\Users\enzo\bot\uwu\node_modules@discordjs\ws\dist\index.js:1132:18)
at connection.onclose (C:\Users\enzo\bot\uwu\node_modules@discordjs\ws\dist\index.js:676:17)
at callListener (C:\Users\enzo\bot\uwu\node_modules\ws\lib\event-target.js:290:14)
at WebSocket.onClose (C:\Users\enzo\bot\uwu\node_modules\ws\lib\event-target.js:220:9)
at WebSocket.emit at WebSocket.emitClose (C:\Users\enzo\bot\uwu\node_modules\ws\lib\websocket.js:260:10)
at TLSSocket.socketOnClose (C:\Users\enzo\bot\uwu\node_modules\ws\lib\websocket.js:1272:15)
at TLSSocket.emit at node:net:337:12
at TCP.done (node:_tls_wrap:657:7)
-
Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
- Error: Used disallowed intents
If you are using the GuildMembers
, GuildPresences
, or MessageContent
intents, you need to enable them via Developer Portal > Your app > Bot > Privileged Gateway IntentsOkay and now i have only this problem DiscordAPIError[0]: 401: Unauthorized
at handleErrors (C:\Users\enzo\bot\uwu\node_modules@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\enzo\bot\uwu\node_modules@discordjs\rest\dist\index.js:1120:23)
at async SequentialHandler.queueRequest (C:\Users\enzo\bot\uwu\node_modules@discordjs\rest\dist\index.js:953:14)
at async _REST.request (C:\Users\enzo\bot\uwu\node_modules@discordjs\rest\dist\index.js:1266:22)
at async C:\Users\enzo\bot\uwu\deploy-commands.js:34:16 {
requestBody: { files: undefined, json: [ [Object], [Object] ] },
rawError: { message: '401: Unauthorized', code: 0 },
code: 0,
status: 401,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1200996227739815987/guilds/1200230495271788645/commands
and in deploy script
my token is already updated
so
what is ttc message?
idk
developer
portal
see
No?
well, it's not their bot
so no
Oh..
I receive a message.
From discord.
Breh..
Okay updated now i will try to node commands
rror: Cannot find module 'C:\Users\enzo\bot\uwu\deploy-commands.py'
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Bro
I am stupid
i put .py
at the end mb
Error [TokenInvalid]: An invalid token was provided.
at WebSocketManager.connect (C:\Users\enzo\bot\uwu\node_modules\discord.js\src\client\websocket\WebSocketManager.js:136:26)
at Client.login (C:\Users\enzo\bot\uwu\node_modules\discord.js\src\client\Client.js:228:21)
at Object.<anonymous> (C:\Users\enzo\bot\uwu\index.js:17:8)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'TokenInvalid'
}
Node.js v20.11.0
Yes i receive a dm from discord
i changed the tok en
and now
idk why that not work
Bro i promise than i changed
wait
can you VC?
I will share you my screen.
Oh
Wait wrong acc
i think
yeah nah
i have an error
ReferenceError: keyAuth is not defined
-
ReferenceError: "x" is not defined
: learn more
- TypeError: Cannot read properties of undefined/null (reading "x")
: learn more