Skip to content

Commit

Permalink
Adding wastebasket to del output and permise to put rs or rust …
Browse files Browse the repository at this point in the history
…where the fuck you want
  • Loading branch information
Wafelack committed Sep 20, 2020
1 parent b38c00c commit ce0eda1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
PREFIX = '!'
WAFEID = 723862906755743804

async def delout(message, user):
def check(reaction, user):
return str(reaction.emoji) == "🗑" and reaction.count > 1 and user == user and reaction.message.id == message.id

reaction, user = await client.wait_for('reaction_add', check=check)
if check(reaction, user):
await message.delete()


@client.event
async def on_ready():
Expand All @@ -29,11 +37,14 @@ async def on_message(message):
splited = message.content.split('\n')
stderr, stdout = play(splited)
if stdout == "":
await message.channel.send(f"Standard error : ```" + stderr.replace('`', '\'') + "```\n```No standard "
msg = await message.channel.send(f"Standard error : ```" + stderr.replace('`', '\'') + "```\n```No standard "
"output !```")
else:
await message.channel.send(
msg = await message.channel.send(
f"Standard error : ```" + stderr.replace('`', '\'') + f"```\nStandard output : ```{stdout}```")

await msg.add_reaction("🗑")
client.loop.create_task(delout(msg, message.author))
return
if message.content == PREFIX + "make_me_rustacean":
await message.author.add_roles(message.author.guild.get_role(743864011334090762))
Expand Down
2 changes: 1 addition & 1 deletion play.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def play(code):
file = open('code.rs', 'w')
for i in range(1, len(code)):
file.write(code[i].replace('`', ''))
file.write(code[i].replace('```rs', '').replace('```rust', '').replace('`', ''))
file.close()
bfile = open('code.rs', 'rb')

Expand Down

0 comments on commit ce0eda1

Please sign in to comment.