Closed RaezDev1 closed 1 year ago
Solution: use the module Logging
to catch the errors and handle them your way.
Example:
import logging
# Configure the logging module
logging.basicConfig(filename='errors.log', level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s')
@events.on_ready
async def on_ready():
try:
bot.send_message(nochannelgiven, "I'm online!")
except Exception as e:
logging.exception(e)
you really should add a @events.on_error async def on_error_example(error): bot.send_message(f"There is a new error {error}") so make something like that so every time there is a error it sends it to the channel and does not turn off the bot