diff --git a/data_expunged.py b/data_expunged.py index e31f6f1..92f06e9 100644 --- a/data_expunged.py +++ b/data_expunged.py @@ -4,6 +4,9 @@ import sys client = discord.Client() +def mentions_me(message): + return client.user in message.mentions or [client.user] in [role.members for role in message.role_mentions] + @client.event async def on_ready(): print('logged in as {0.user}'.format(client), file=sys.stderr) @@ -13,7 +16,7 @@ async def on_message(message): if message.author == client.user: return - if ('spoil' in message.content.lower() + if (('spoil' in message.content.lower() or mentions_me(message)) and message.attachments and not any(a.is_spoiler() for a in message.attachments)): @@ -38,6 +41,8 @@ async def on_message(message): except (discord.HTTPException, discord.Forbidden, discord.NotFound) as e: print('error deleting message: {0}'.format(e)) return + elif mentions_me(message): + await message.channel.send("upload an image and put 'spoil' anywhere in the description, and I'll spoiler it for you") with open('token') as f: token = f.read().strip()