Guest User

Untitled

a guest
Jul 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. @client.command(aliases={'reddit', 'hot', 'r'})
  2. async def reddit_hot(sub):
  3.  
  4. try:
  5. reddit.subreddits.search_by_name(sub, exact=True)
  6. if reddit.subreddit(sub).over18:
  7. await client.say("NSFW subreddit, please try again.")
  8. else:
  9. post = next(x for x in reddit.subreddit(sub).hot() if not x.stickied)
  10. await client.say(post.url)
  11. except prawcore.exceptions.NotFound:
  12. await client.say("Sorry, that subreddit does not exist!")
Add Comment
Please, Sign In to add comment