mirror of
https://git.wownero.com/lza_menace/suchwow.git
synced 2024-08-15 01:03:19 +00:00
32 lines
885 B
Python
32 lines
885 B
Python
|
from praw import Reddit
|
||
|
from suchwow import config
|
||
|
|
||
|
|
||
|
class Reddit(object):
|
||
|
def __init__(self):
|
||
|
self.reddit = Reddit(
|
||
|
client_id=config.get("PRAW_CLIENT_ID"),
|
||
|
client_secret=config.get("PRAW_CLIENT_SECRET"),
|
||
|
user_agent=config.get("PRAW_USER_AGENT"),
|
||
|
username=config.get("PRAW_USERNAME"),
|
||
|
password=config.get("PRAW_PASSWORD")
|
||
|
)
|
||
|
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
|