-
My code is: const commands = []; // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment // Construct and prepare an instance of the REST module // and deploy your commands!
})(); const client = new Client({ intents: [GatewayIntentBits.Guilds] }); client.commands = new Collection(); for (const file of commandFiles) { client.once(Events.ClientReady, () => { client.on(Events.InteractionCreate, async interaction => {
}); client.login(token); keepalive(); The command /ping worked until I added more commands. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
AnswerAfter testing your issue it seems to work fine on my end. I assume it has to do something with your env declaration. Try changing your env into a {
"token": "token-here",
"clientId": "clientid-here",
"guildId": "guildid-here",
} Some AdviceKeepalive()In your main code. Why do you exactly have const keepalive = require('./keepalive.js');
// ...
keepalive(); Discord.js automatically keeps your bot alive as long as its being hosted on the server. Use code blockswhen asking for help on anything code related. Use code blocks to make life easier for people trying to help you. Example:console.log Hope this helped 😄 |
Beta Was this translation helpful? Give feedback.
Answer
After testing your issue it seems to work fine on my end. I assume it has to do something with your env declaration. Try changing your env into a
./config.json
file like this if your just hosting the bot yourself. If your using a Host platform like render or heroku. Look at their env file docs.Some Advice
Keepalive()
In your main code. Why do you exactly have
Discord.js automatically keeps your bot alive as long as its being hosted on the server.
Use code blocks
when asking for help on anything code related. Use code blocks…