Estaba codificando mi bot esta mañana, funcionaba bien hasta que fui a comer. Cuando regresé, el bot ya no quería iniciarse cuando estaba ejecutando mi código. Lo extraño es que no cambié nada en mi código, no tengo ningún mensaje de registro en la consola (generalmente registro de éxito cuando se inicia correctamente) y funcionaba bien hace aproximadamente 1 hora. He intentado restablecer el token del bot pero no funciona. Estoy usando Replit.com como proyecto Node.js, aquí está el enlace .
const TOKEN = process.env['token'] const { Client, Intents } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); function getLastWord(str) { return (str.toLowerCase().match(/(\w+)\W*$/) || [])[1]; } const activities = [ "test activity 1", "test activity 2", "test activity 3", "test activity 4" ]; client.on("ready", () => { console.log(`Logged in as ${client.user.tag}!`) // run every 10 seconds setInterval(() => { // generate random number between 1 and list length. const randomIndex = Math.floor(Math.random() * (activities.length - 1) + 1); const newActivity = activities[randomIndex]; client.user.setActivity(newActivity,{ type: 'LISTENING' }); }, 10000); }); client.on("message", msg => { if (getLastWord(msg.content) === "quoi") { msg.reply("feur"); } if (client.users.cache.find(user => user.id === '422449611035115520') && msg.author.bot === false){ msg.reply("spotted"); } }) client.login(TOKEN)Funcionó nuevamente durante 3 horas sin ningún motivo y ahora ya no funciona (nuevamente), a veces el bot no arranca, no entiendo, eso es muy aleatorio.