2020-10-15 06:51:53 +00:00
|
|
|
from praw import Reddit
|
|
|
|
from suchwow import config
|
|
|
|
|
|
|
|
|
|
|
|
class Reddit(object):
|
|
|
|
def __init__(self):
|
|
|
|
self.reddit = Reddit(
|
2020-10-15 07:00:51 +00:00
|
|
|
client_id=config.PRAW_CLIENT_ID,
|
|
|
|
client_secret=config.PRAW_CLIENT_SECRET,
|
|
|
|
user_agent=config.PRAW_USER_AGENT,
|
|
|
|
username=config.PRAW_USERNAME,
|
|
|
|
password=config.PRAW_PASSWORD
|
2020-10-15 06:51:53 +00:00
|
|
|
)
|
|
|
|
self.subreddit = "wownero"
|
|
|
|
|
|
|
|
def post(title, url):
|
|
|
|
try:
|
|
|
|
submission = reddit.subreddit(self.subreddit).submit(
|
|
|
|
title=title,
|
|
|
|
url=url,
|
|
|
|
resubmit=False,
|
|
|
|
)
|
|
|
|
return submission
|
|
|
|
except:
|
|
|
|
return False
|
|
|
|
|
|
|
|
def comment(submission, post):
|
|
|
|
try:
|
|
|
|
submission.reply(f"Show this post love by sending WOW: {post.id}")
|
|
|
|
except:
|
|
|
|
return False
|