About the Code Help - Discord category

Writing a Discord bot? Interested in how Glitch can host your bot and the limitations you need to be aware of? Just want to help out and share your expertise?

This is the place for you!

5 Likes

This is the Error i am getting suddenly my bot is working fine for 5 months now tomorrow suddenly bot goes down and get these errors below.
(node:10926) UnhandledPromiseRejectionWarning: Error: 429 Too Many Requests

10:02 PM

at /rbd/pnpm-volume/d30be60e-0420-45e7-b509-0b938a16901f/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:195:23

10:02 PM

at processTicksAndRejections (internal/process/task_queues.js:88:5)

10:02 PM

(node:10926) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

10:02 PM

(node:10926) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

10:02 PM

a few seconds ago

(node:11010) UnhandledPromiseRejectionWarning: Error: 429 Too Many Requests

10:02 PM

at /rbd/pnpm-volume/d30be60e-0420-45e7-b509-0b938a16901f/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:195:23

10:02 PM

at processTicksAndRejections (internal/process/task_queues.js:88:5)

10:02 PM

(node:11010) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

10:02 PM

(node:11010) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Type refresh in the console. Also, this could be too many incoming or out going requests.

What about this:
throw err;
^

Error: ENOENT: no such file or directory, scandir ‘./commands’
at Object.readdirSync (fs.js:974:3)
at Object. (c:\Users\Aaron\Desktop\Discord Bot\node_modules\index.js:7:25)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
errno: -4058,
syscall: ‘scandir’,
code: ‘ENOENT’,
path: ‘./commands’
}
Some of My code :
const fs = require(‘fs’);

const Discord = require(‘discord.js’);

// create a new Discord client

const config = require(’./config.json’);

const client = new Discord.Client();

client.commands = new Discord.Collection();

const commandFiles = fs.readdirSync(’./commands’).filter(file => file.endsWith(’.js’));

for (const file of commandFiles) {

const command = require(`./commands/${file}`);

client.commands.set(command.name, command);

}

Basically they cant find the file or directory called commands/ or ./commands

@TH3_UNKNOWN But I cannot make a file called that, It won’t work. There has to be like something.___

Can you sent the project name so I can take a look?

I have to eat lunch. Ill help ASAP

@TH3_UNKNOWN
???
image

im getting this error help please

(node:452) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.

7:39 PM

at WebSocketManager.connect (/rbd/pnpm-volume/87d96cdb-805b-4be6-80cd-862a932859c7/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/websocket/WebSocketManager.js:135:26)

7:39 PM

at Client.login (/rbd/pnpm-volume/87d96cdb-805b-4be6-80cd-862a932859c7/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/Client.js:221:21)

7:39 PM

at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:54:5)

7:39 PM

at Function.Module.runMain (internal/modules/cjs/loader.js:828:11)

7:39 PM

at internal/main/run_main_module.js:17:11

7:39 PM

(node:452) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

7:39 PM

(node:452) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

7:39 PM

a few seconds ago

(node:510) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.

7:39 PM

at WebSocketManager.connect (/rbd/pnpm-volume/87d96cdb-805b-4be6-80cd-862a932859c7/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/websocket/WebSocketManager.js:135:26)

7:39 PM

at Client.login (/rbd/pnpm-volume/87d96cdb-805b-4be6-80cd-862a932859c7/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/Client.js:221:21)

7:39 PM

at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:54:5)

7:39 PM

at Function.Module.runMain (internal/modules/cjs/loader.js:828:11)

7:39 PM

at internal/main/run_main_module.js:17:11

7:39 PM

(node:510) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

7:39 PM

(node:510) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

PLease make a new topic

You have to put valid token of your bot

It cannot find a directory called commands, make one by making a new file an adding an example file (like js.js). I stopped using Glitch because my bot broke every single time I tried it.

link nereden alacağım aktifleştirmek için botumu