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
24 lines
631 B
import praw
|
|
|
|
|
|
def get_reddit_instance():
|
|
reddit_config = {}
|
|
with open("reddit_config") as tmp_file:
|
|
for line in tmp_file:
|
|
(key, val) = line.split(';')
|
|
reddit_config[key] = val.replace('\n', '')
|
|
|
|
return praw.Reddit(
|
|
user_agent=reddit_config['user_agent'],
|
|
client_id=reddit_config['client_id'],
|
|
client_secret=reddit_config['client_secret']
|
|
)
|
|
|
|
|
|
def wrong_dog(bot, update):
|
|
reddit = get_reddit_instance()
|
|
|
|
sub = reddit.subreddit('whatswrongwithyourdog')
|
|
post = sub.random()
|
|
update.message.reply_text("This dog has serious issues: %s" % post.url)
|
|
|