Added command to post random /r/EarthPorn pic

dev
pocketjawa 2017-02-28 23:16:44 -05:00
parent 660c3106d5
commit 8be6b0a440
2 changed files with 8 additions and 1 deletions

View File

@ -11,4 +11,5 @@
**!setplaying**: Sets the bot's Now Playing status to whatever you say (eg !setplaying with Tohru)
**!xkcd**: Posts a random xkcd comic
**!xkcd latest**: Posts the latest xkcd comic
**!xkcd x**: Posts xkcd comic number x (if it exists)
**!xkcd x**: Posts xkcd comic number x (if it exists)
**!earth** or **!earthporn**: Posts a random submission from /r/EarthPorn's top this week

View File

@ -123,6 +123,12 @@ def on_message(message):
else:
yield from client.send_message(message.channel, '`'+args+'`' + 'is not a valid option. Please leave blank for a random comic, say "latest" for the latest comic or put the number of the comic you want.' )
#Post random submisison from /r/EarthPorn's top this week
elif (message.content.lower().startswith('!earth')) or (message.content.lower().startswith('!earthporn')):
earthporn = reddit.subreddit('earthporn').top('week')
earthpornr = list(earthporn)
yield from client.send_message(message.channel, random.choice(earthpornr).url)
client.loop.create_task(ups_check())
client.run(token)