I want my discord bot to wait for some time and retry to connect if it failed to connect at first try.
I tried this:
[Other codes]
.
.
.
while True:
client = MyClient()
try:
client.run(botToken)
except aiohttp.client_exceptions.ClientConnectorError:
print('Error, Trying again after 10 sec')
time.sleep(10)
I run the code by turning off the internet but this give me another error.
RuntimeError: Event loop is closed
sys:1: RuntimeWarning: coroutine 'Client.run.<locals>.runner' was never awaited