Is there a way to make kord automatically reconnect after an error?
Each time i get the error 502 in the terminal output, the bot goes offline.
Is there a way to automatically make it reconnect?
11 Replies
console of your bot? what do you mean?
i mean in the terminal output
in what part of your code does the exception occur?
it doesn't exectly pinpoint where in my code does the exception occur but i have this screenshot
but from what i know exceptions in
kord.on<E> {}
shouldn't make the bot crashthat's right
do you have some code outside of this?
also how often do you get 502s? and do you have an idea why you get them?
The first time it happend was today at 9 AM and after that was it happening today at around 3 PM
i don't have any other code that would interact with kord outside of
kord.on<E> {}
expect for launching and stopping kordhm, then the reason your bot goes offline might be that the gateway connection dies and can't reconnect because the retry limit exceeded (this should log a warning, do you see something in the logs about this?).
no, i don't see any warnings mentioning the rate limit, here's the full log:
ok, these logged errors come from
DefaultGateway
because the start
call (coming from kord.login
) was cancelled - so something leads to cancellation of the scope you call login
in, which must be outside of kord.on
because that should catch and log excpetions
try enabling stackTraceRecovery - that way it'll be easier to see where in your code you call into kord when kord throws an exception:
ok, i think i have found the cause which was a task running each few seconds and that didn't use
kord.on<E> {}