Add Pull command
This commit is contained in:
parent
401b9487b0
commit
9dea7fbabe
1 changed files with 16 additions and 0 deletions
16
guild2.py
16
guild2.py
|
@ -126,6 +126,22 @@ async def on_message(message):
|
|||
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)
|
||||
elif command[0] == "pull":
|
||||
if "full" in getperms(message.author.id):
|
||||
mess = await message.reply(embed=guilded.Embed(title=":sweebot-loading: Pulling from Git...", description="```[Starting, please stand by...]```"))
|
||||
print("[" + BLUE + "..." + RESET + "] Pulling from git... (initiated by " + message.author.name + ")")
|
||||
sleep(1)
|
||||
p = subprocess.Popen("/home/swee/update-sb4g.sh", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
output = ""
|
||||
for line in iter(p.stdout.readline, b''):
|
||||
output+=line.decode()
|
||||
await mess.edit(embed=guilded.Embed(title=":sweebot-loading: Pulling from Git...", description="```\n" + output + "\n```"))
|
||||
p.stdout.close()
|
||||
p.wait()
|
||||
await mess.edit(embed=guilded.Embed(title=":sweebot-success: Done, restarting bot...", description="```\n" + output + "\n```"))
|
||||
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)
|
||||
elif command[0] == "spammy-shell":
|
||||
if "full" in getperms(message.author.id):
|
||||
mess = await message.reply("```No output (yet)```")
|
||||
|
|
Loading…
Reference in a new issue