Telegram version of schneiderbot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
631 B

  1. import praw
  2. def get_reddit_instance():
  3. reddit_config = {}
  4. with open("reddit_config") as tmp_file:
  5. for line in tmp_file:
  6. (key, val) = line.split(';')
  7. reddit_config[key] = val.replace('\n', '')
  8. return praw.Reddit(
  9. user_agent=reddit_config['user_agent'],
  10. client_id=reddit_config['client_id'],
  11. client_secret=reddit_config['client_secret']
  12. )
  13. def wrong_dog(bot, update):
  14. reddit = get_reddit_instance()
  15. sub = reddit.subreddit('whatswrongwithyourdog')
  16. post = sub.random()
  17. update.message.reply_text("This dog has serious issues: %s" % post.url)