1
0
Fork 0

Update guild2.py

This commit is contained in:
Swee 2024-10-11 13:04:22 -07:00
parent 664fab9d0f
commit 361b2fd4bb

View file

@ -139,26 +139,26 @@ async def on_message(message):
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)
elif command[0] == "spammy-shell": #elif command[0] == "spammy-shell":
if "full" in getperms(message.author.id): # if "full" in getperms(message.author.id):
mess = await message.reply("```No output (yet)```") # mess = await message.reply("```No output (yet)```")
print("[" + BLUE + "..." + RESET + "] Running shell... (initiated by " + message.author.name + ")") # print("[" + BLUE + "..." + RESET + "] Running shell... (initiated by " + message.author.name + ")")
sleep(1) # sleep(1)
p = subprocess.Popen(command[1:], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # p = subprocess.Popen(command[1:], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = "" # output = ""
first = True # first = True
for line in iter(p.stdout.readline, b''): # for line in iter(p.stdout.readline, b''):
if first: # if first:
await mess.edit("```" + line.decode().rstrip() +"```") # await mess.edit("```" + line.decode().rstrip() +"```")
first = False # first = False
else: # else:
await message.channel.send("```" + line.decode().rstrip() +"```") # await message.channel.send("```" + line.decode().rstrip() +"```")
p.stdout.close() # p.stdout.close()
p.wait() # p.wait()
await message.channel.send("**Finished.**") # await message.channel.send("**Finished.**")
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)
elif command[0] == "whoami": elif command[0] == "whoami":
if getperms(message.author.id) != []: if getperms(message.author.id) != []: