add more documentation/discoverability

This commit is contained in:
xenofem 2020-10-05 15:14:49 -04:00
parent 6db9cf7e7e
commit 9fbd6173b3

View file

@ -4,6 +4,9 @@ import sys
client = discord.Client() 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 @client.event
async def on_ready(): async def on_ready():
print('logged in as {0.user}'.format(client), file=sys.stderr) 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: if message.author == client.user:
return return
if ('spoil' in message.content.lower() if (('spoil' in message.content.lower() or mentions_me(message))
and message.attachments and message.attachments
and not any(a.is_spoiler() for a in 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: except (discord.HTTPException, discord.Forbidden, discord.NotFound) as e:
print('error deleting message: {0}'.format(e)) print('error deleting message: {0}'.format(e))
return 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: with open('token') as f:
token = f.read().strip() token = f.read().strip()