Added command to pull random joke from /r/Jokes

dev
pocketjawa 2017-03-02 11:48:42 -05:00
parent efab1cd487
commit bb35612ce2
2 changed files with 9 additions and 1 deletions

View File

@ -15,3 +15,4 @@
**!earth** or **!earthporn**: Posts a random submission from /r/EarthPorn's top this week
**!porn**: Posts a random link from one of the 'porn' subreddits (not actually NSFW)
**!kill** or **!restart**: Kill the bot process so that it can automatically restart with the new version (only pocketjawa can use these)
**!joke**: Posts a random joke from /r/Jokes

View File

@ -149,6 +149,13 @@ def on_message(message):
else:
yield from client.send_message(message.channel, 'Booooo you\'re not Onii-chan. You\'re not allowed to use this command!')
#Random jokes from /r/jokes
elif message.content.lower().startswith('!joke'):
jokes = reddit.subreddit('jokes').top('week')
jokesr = random.choice(list(jokes))
jokemsg = jokesr.title + '\n\n' + jokesr.selftext
yield from client.send_message(message.channel, jokemsg)
client.loop.create_task(ups_check())
client.run(token)