From 1711886c1b94c5778a5e6779b2001bc17908529f Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Mon, 26 Mar 2018 22:15:04 -0700 Subject: [PATCH] Link to subreddits upon mention --- app/dragon-bot.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/dragon-bot.py b/app/dragon-bot.py index 17567ef9..8a359160 100644 --- a/app/dragon-bot.py +++ b/app/dragon-bot.py @@ -103,6 +103,18 @@ async def on_message(message): ) ) + # Read messages and look for mentions of subreddits + for word in message.content.split(): + if message.author != client.user: + if '/r/' in word or 'r/' in word: + try: + subreddit = word.split('/')[-1] + # Try and request the page to check that it actually exists + get_from_reddit.get_image(boards=subreddit) + await client.send_message(message.channel, "https://reddit.com/r/{}".format(subreddit)) + except: + pass + if message.content.startswith('!8ball'): await client.send_message( message.channel, @@ -142,6 +154,7 @@ async def on_message(message): return m.author == client.user await client.purge_from(message.channel, limit=10, check=is_bot) + if message.content.startswith('!decide'): await client.send_message( message.channel,