diff --git a/guild2.py b/guild2.py index 2a30954..d919f85 100644 --- a/guild2.py +++ b/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)```")