diff --git a/helpcommand.txt b/helpcommand.txt index b21c299..93569d8 100644 --- a/helpcommand.txt +++ b/helpcommand.txt @@ -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) \ No newline at end of file +**!xkcd x**: Posts xkcd comic number x (if it exists) +**!earth** or **!earthporn**: Posts a random submission from /r/EarthPorn's top this week \ No newline at end of file diff --git a/pocketbot.py b/pocketbot.py index e8a3166..1a025b2 100644 --- a/pocketbot.py +++ b/pocketbot.py @@ -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) \ No newline at end of file