|
@ -1,6 +1,7 @@ |
|
|
import praw |
|
|
import praw |
|
|
from prawcore import exceptions |
|
|
from prawcore import exceptions |
|
|
import requests |
|
|
import requests |
|
|
|
|
|
import random |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_post_type(url): |
|
|
def get_post_type(url): |
|
@ -53,8 +54,17 @@ def get_reddit_post(sub, is_image_post=False): |
|
|
return post |
|
|
return post |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def fourtwenty(bot, update): |
|
|
|
|
|
def fourtwenty(): |
|
|
|
|
|
stoner_subs = ["StonerThoughts"] |
|
|
|
|
|
# post = get_reddit_post(random.randint(0, len(stoner_subs) - 1)) |
|
|
|
|
|
post = get_reddit_post("StonerThoughts") |
|
|
|
|
|
print(post.title) |
|
|
|
|
|
print(post.text) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def wrong_dog(bot, update): |
|
|
def wrong_dog(bot, update): |
|
|
reddit(bot, update, ['whatswrongwithyourdog']) |
|
|
|
|
|
|
|
|
reddit_img(bot, update, ['whatswrongwithyourdog']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def hamster(bot, update): |
|
|
def hamster(bot, update): |
|
@ -67,7 +77,7 @@ def reddit(bot, update, args): |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
sub = args[0] |
|
|
sub = args[0] |
|
|
update.message.reply_text(get_reddit_post(sub)) |
|
|
|
|
|
|
|
|
update.message.reply_text(get_reddit_post(sub).url) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reddit_img(bot, update, args): |
|
|
def reddit_img(bot, update, args): |
|
@ -83,3 +93,5 @@ def reddit_img(bot, update, args): |
|
|
except AttributeError: |
|
|
except AttributeError: |
|
|
update.message.reply_text(post) |
|
|
update.message.reply_text(post) |
|
|
print("ERROR") |
|
|
print("ERROR") |
|
|
|
|
|
|
|
|
|
|
|
# fourtwenty()y |