Rate limit protection

master
Cristiano Pires 2 years ago
parent da158fa3a7
commit 045abde606

@ -49,11 +49,24 @@ const bot = new Client({ intents: [
Partials.Message
]
});
var retryCounter = 0;
(function login()
{
bot.login(process.env.discord_token).catch(()=>{login()});
bot.login(process.env.discord_token).catch(()=>
{
if(retryCounter==900) return startLimitProtectionTimer();
login();
retryCounter++;
});
})()
function startLimitProtectionTimer()
{
console.log('Server: Rate Limit Protection - Waiting before trying again.')
setTimeout(() => {
login();
retryCounter = 0;
}, 30*60*1000);
}
function connectToDB()
{
try {

Loading…
Cancel
Save