Discord bot goes offline but app is still on


#1

I’m making a discord bot with my friend but pretty much every 5-40 minutes the bot goes off but the app is still on. My friend is pinging on uptimerobot and it says it’s down but if it is I don’t know what is causing it, I don’t get any errors when this occurs and ive tried all the things that keep people say keep the app online. The app name is called “pkkfriend”.


#2

It sounds like there’s a problem with how the route that uptimerobot is pinging was setup. It looks like your project is private, but if you DM me a join link I’ll take a look.


#3

Ok, and here is a screenshot of the uptime downtime rate my friend sent me. unknown%20(1)


#4

You had a duplicate route and two methods of keeping the project alive, so I’ve removed the dupes. Not certain it will help, so let me know if you keep having the issue.


#5

I’m about to go to bed now so il tell my friend to show me the downtime tomorrow and il be sure to let you know about it, thanks!


#6

The bot was down 5 and 6 today for me (BST), and is still off.


#7

Then you need to check your logs for errors from the bot - you now know it’s not a problem with keeping the project awake.


#8

No errors in logs, just install stuff and on messages…


#9

Heres a downtime update for todayunknown


#10

I suggest adding additional logging around key bot events so you can start to associate downtime with events and spot the underlying issue.


#11

Assuming you are using Discord.js lib - use event handlers, something like this (use debug with caution, because it reveals the bot’s token):

...
client.on('disconnect', () => console.error('Connection lost...'));
client.on('reconnecting', () => console.log('Attempting to reconnect...'));
client.on('error', error => console.error(error));
client.on('warn', info => console.error(info));
// client.on('debug', info => console.log(info));
...
client.login(token);

#12

Hm, il be sure to try that when I get back from school. Thanks!


#13

Hm so i noticed theres a error and its a “DiscordAPI: Missing Permissions” error, is there any way that i can check if that error throws and get the server its erroring in and make it leave the server?


#14

(The console is now spamming that error)