My one Guild commands Handler are stuck in refreshing

My one Guild commands Handler are stuck in refreshing and dont reloade what can i do there is no error in the Terminal. it stopped working from one day to the next and i wonder why
19 Replies
d.js toolkit
d.js toolkit14mo 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! - Marked as resolved by OP
Joni
JoniOP14mo ago
const fs = require('fs'); const { REST, Routes } = require('discord.js'); const clientId = (process.env.DISCORD_APPLICATION_ID); const guildId = ("809535850710302770"); module.exports = (client) => { client.handleCommands = async (commandFolders, path) => { client.commandArray = []; for (folder of commandFolders) { const commandFiles = fs.readdirSync(${path}/${folder}).filter(file => file.endsWith('.js')); for (const file of commandFiles) { const command = require(../commands/${folder}/${file}); // Set a new item in the Collection // With the key as the command name and the value as the exported module client.commands.set(command.data.name + -${guildId}, command); client.commandArray.push(command.data.toJSON()); } } const rest = new REST({version: '10'}).setToken(process.env.token); (async () => { try { console.log('Started refreshing application (/) commands.');
const response = await rest.put( Routes.applicationGuildCommands(clientId, guildId), { body: client.commandArray }, );
console.log('Successfully reloaded application (/) commands:', response); } catch (error) { console.error('Error while reloading application (/) commands:', error); } })();
} }
treble/luna
treble/luna14mo ago
do you run that code every time your bot starts?
Joni
JoniOP14mo ago
Yes
treble/luna
treble/luna14mo ago
yeah dont The rest script is meant to be in a separate file You dont need to deploy every time your bot restarts Only when you make changes to your commands
Joni
JoniOP14mo ago
but every time I restart I make changes and it has always worked for a year but suddenly it no longer works.
treble/luna
treble/luna14mo ago
when yoy make changes to your slasg commands, not the code behind them And define not working Do you get any errors, what logs and what doesnt
Joni
JoniOP14mo ago
Nothing its starts refrashing and dont reloaded
No description
treble/luna
treble/luna14mo ago
why are you doing it so many times? Thats your issue right there You're ratelimited
Joni
JoniOP14mo ago
I have also tried to start only this one guild but it does not work for this guild.
treble/luna
treble/luna14mo ago
Use global commands Not guild commands if you're deploying them to every guild
Joni
JoniOP14mo ago
But my bot manages so many guilds with many different commands.
Joni
JoniOP14mo ago
so i removed a few guilds from the rest but still it won't reload that one guild
No description
treble/luna
treble/luna14mo ago
Then at the least deploy just when joining Not on every start Thats just plain api spam also you set the same commands for every guild in the code you show
Joni
JoniOP14mo ago
yes i know i will fix the ha later but i just have the problem with a guild
treble/luna
treble/luna14mo ago
Probably ratelimited, maybe wait a while
Joni
JoniOP14mo ago
but can there also only be one guild ratelimited because all the others are working?
Joni
JoniOP14mo ago
Thanks for the tip anyway, then I have implemented it now.
No description
Joni
JoniOP14mo ago
Okay, thanks for the information, I'll wait 24 hours and if it works, I'll be very grateful to you and if not, I'll get back to you Yes I will do that Thanks for the help I waited a while and now it works again and I adjusted my code so that it doesn't refresh the commands every time.
Want results from more Discord servers?
Add your server