Update guild2.py
This commit is contained in:
parent
34d6b79357
commit
b3266a7a47
1 changed files with 6 additions and 2 deletions
|
@ -57,6 +57,10 @@ class SweeBotTestException(Exception):
|
||||||
pass
|
pass
|
||||||
class SweeBotSystemException(Exception):
|
class SweeBotSystemException(Exception):
|
||||||
pass
|
pass
|
||||||
|
def die():
|
||||||
|
client.close()
|
||||||
|
os.system("python " + " ".join(sys.argv))
|
||||||
|
sys.exit()
|
||||||
# Client itself
|
# Client itself
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
@ -101,8 +105,7 @@ async def on_message(message):
|
||||||
if "restart" in getperms(message.author.id) or "full" in getperms(message.author.id):
|
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..."))
|
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 + ")")
|
print("[" + BLUE + "..." + RESET + "] Restarting script... (initiated by " + message.author.name + ")")
|
||||||
subprocess.Popen(["python"] + sys.argv)
|
die()
|
||||||
exit()
|
|
||||||
else:
|
else:
|
||||||
mess = await message.reply(embed=guilded.Embed(title=":sweebot-fail: Permission denied."))
|
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)
|
print("[" + RED + "FAIL" + RESET + "] Not restarting script, Permission Denied for " + message.author.name)
|
||||||
|
@ -135,6 +138,7 @@ async def on_message(message):
|
||||||
p.stdout.close()
|
p.stdout.close()
|
||||||
p.wait()
|
p.wait()
|
||||||
await mess.edit(embed=guilded.Embed(title=":sweebot-success: Done, restarting bot...", description="```\n" + output + "```"))
|
await mess.edit(embed=guilded.Embed(title=":sweebot-success: Done, restarting bot...", description="```\n" + output + "```"))
|
||||||
|
die()
|
||||||
else:
|
else:
|
||||||
mess = await message.reply(embed=guilded.Embed(title=":sweebot-fail: Permission denied."))
|
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)
|
print("[" + RED + "FAIL" + RESET + "] Not restarting script, Permission Denied for " + message.author.name)
|
||||||
|
|
Loading…
Reference in a new issue