dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
684 stars 162 forks source link

input() in on_ready makes bot restart at some cases #161

Closed theAbdoSabbagh closed 2 years ago

theAbdoSabbagh commented 2 years ago

Summary

If you had input() in the bot on_ready for a long time, the bot will restart after the input() takes input

Reproduction Steps

  1. Start a bot
  2. Put input() in on_ready
  3. Wait for some time, 10 minutes minimum
  4. Press enter to deactivate input()
  5. Remember to have a print statement or something in on_ready to notice when it goes online again
  6. The bot should restart in a few seconds. Or maybe it goes down but then goes up again, not sure.

Code

@client.listen('on_ready')
async def on_ready():
  print("Bot online")
  input()
  # wait for 10 minutes or so

Expected Results

The bot shouldn't go down.

Actual Results

The bot goes down.

System Information

Checklist

Additional Information

There isn't a traceback, the bot just restarts

dolfies commented 2 years ago

Isn't a bug. input() is blocking.

theAbdoSabbagh commented 2 years ago

I didn't know bots would shutdown cuz of something blocking tbh