mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
KeyboardInterrupts might work
This commit is contained in:
parent
96acfe2874
commit
31e6b5354d
2 changed files with 9 additions and 4 deletions
|
@ -356,9 +356,6 @@ class RoyalDiscordBot(discord.Client):
|
|||
if msg == "get cv":
|
||||
discord_members = list(self.main_guild.members)
|
||||
connection.send(discord_members)
|
||||
elif msg == "stop":
|
||||
await self.logout()
|
||||
exit(0)
|
||||
elif msg.startswith("!"):
|
||||
data = msg.split(" ")
|
||||
if data[0] not in self.commands:
|
||||
|
@ -740,7 +737,12 @@ def process(users_connection=None):
|
|||
logging.info("Logging in...")
|
||||
loop.run_until_complete(bot.login(config["Discord"]["bot_token"], bot=True))
|
||||
logging.info("Connecting...")
|
||||
try:
|
||||
loop.run_until_complete(bot.connect())
|
||||
except KeyboardInterrupt:
|
||||
logging.info("Now stopping...")
|
||||
loop.run_until_complete(self.logout())
|
||||
exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -635,6 +635,9 @@ def process(arg_discord_connection):
|
|||
logging.warning("Timed out, restarting in 1 minute.")
|
||||
time.sleep(60)
|
||||
logging.info("Now restarting...")
|
||||
except KeyboardInterrupt:
|
||||
logging.info("Now stopping...")
|
||||
break
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue