Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discord.js JavaScript discord clients disconnecting and reconnecting for no reason

Bot disconnects for no reason and reconnects

I am using discord.js v11.60

Image of Logs

enter image description here

Running a very basic message monitoring script, happens on all my discord bot applications after a while of being running the program.

//Inital Login
client.on("ready", () => {
    sendToLogs(`Logged in as ${client.user.tag}!`)
})

client.on('error', err => {
    sendToLogs("Error")
    console.error(err)
    process.exit(1);
});

client.on('reconnecting', message => {
    sendToLogs(`User Reconnecting`)
});

client.on('resume', message => {
    sendToLogs(`Connected ${client.user.tag}`)
});

client.on('disconnect', message => {
    sendToLogs(`User Disconnected`)
    process.exit(1);
});

//On every message
client.on("message", msg => {
    console.log(message.content)
});

client.login(token)
like image 264
RkuangDev Avatar asked Nov 16 '22 08:11

RkuangDev


1 Answers

Self botting is against TOS, so discord.js stopped supporting it..

like image 51
Jytesh Avatar answered Jan 05 '23 10:01

Jytesh