diff --git a/guild2.py b/guild2.py index 1fc891c..5c1d3fb 100644 --- a/guild2.py +++ b/guild2.py @@ -57,8 +57,8 @@ class SweeBotTestException(Exception): pass class SweeBotSystemException(Exception): pass -def die(): - client.close() +async def die(): + await client.close() os.system("python " + " ".join(sys.argv)) sys.exit() # Client itself @@ -105,7 +105,7 @@ async def on_message(message): if "restart" in getperms(message.author.id) or "full" in getperms(message.author.id): mess = await message.reply(embed=guilded.Embed(title=":sweebot-success: Command complete.",description="Restarting bot...")) print("[" + BLUE + "..." + RESET + "] Restarting script... (initiated by " + message.author.name + ")") - die() + await die() else: mess = await message.reply(embed=guilded.Embed(title=":sweebot-fail: Permission denied.")) print("[" + RED + "FAIL" + RESET + "] Not restarting script, Permission Denied for " + message.author.name) @@ -138,7 +138,7 @@ async def on_message(message): p.stdout.close() p.wait() await mess.edit(embed=guilded.Embed(title=":sweebot-success: Done, restarting bot...", description="```\n" + output + "```")) - die() + await die() else: mess = await message.reply(embed=guilded.Embed(title=":sweebot-fail: Permission denied.")) print("[" + RED + "FAIL" + RESET + "] Not restarting script, Permission Denied for " + message.author.name)