|
|
@ -33,13 +33,7 @@ def wrong_dog(bot, update): |
|
|
|
|
|
|
|
|
|
|
|
def hamster(bot, update): |
|
|
|
reddit_instance = get_reddit_instance() |
|
|
|
|
|
|
|
sub = reddit_instance.subreddit('hamsters') |
|
|
|
post = sub.random() |
|
|
|
while "image" not in get_post_type(post.url): |
|
|
|
post = sub.random() |
|
|
|
bot.send_photo(chat_id=update.message.chat_id, photo=post.url) |
|
|
|
reddit_img(bot, update, ['hamsters']) |
|
|
|
|
|
|
|
|
|
|
|
def reddit(bot, update, args): |
|
|
@ -51,3 +45,19 @@ def reddit(bot, update, args): |
|
|
|
|
|
|
|
post = reddit_instance.subreddit(sub).random() |
|
|
|
update.message.reply_text(post.url) |
|
|
|
|
|
|
|
|
|
|
|
def reddit_img(bot, update, args): |
|
|
|
print(args) |
|
|
|
|
|
|
|
if not args: |
|
|
|
update.message.reply_text("Geile, sag sub") |
|
|
|
return |
|
|
|
desired_sub = args[0] |
|
|
|
reddit_instance = get_reddit_instance() |
|
|
|
|
|
|
|
sub = reddit_instance.subreddit(desired_sub) |
|
|
|
post = sub.random() |
|
|
|
while "image" not in get_post_type(post.url): |
|
|
|
post = sub.random() |
|
|
|
bot.send_photo(chat_id=update.message.chat_id, photo=post.url) |