Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsubscribe from inbox replies #20

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Baseball GDT Bot by Matt Bullock
Baseball GDT Bot by Matt Bullock
=====================================

####Current Version: 3.0.1
Expand Down Expand Up @@ -51,6 +51,8 @@ STICKY - do you want the thread stickied? (mod only)

MESSAGE - send submission shortlink to /u/baseballbot

INBOXREPLIES - do you want to receive thread replies in the bot's inbox?

PRE_THREAD_SETTINGS - what to include in the pregame threads

THREAD_SETTINGS - what to include in game threads
Expand Down
1 change: 1 addition & 0 deletions sample_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"STICKY": true,
"SUGGESTED_SORT": "new",
"MESSAGE": false,
"INBOXREPLIES": false,
"PRE_THREAD_SETTINGS": {
"PRE_THREAD_TAG": "PREGAME THREAD:",
"PRE_THREAD_TIME": "9AM",
Expand Down
12 changes: 8 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self):
self.STICKY = None
self.SUGGESTED_SORT = None
self.MESSAGE = None
self.INBOXREPLIES = None
self.PRE_THREAD_SETTINGS = None
self.THREAD_SETTINGS = None
self.POST_THREAD_SETTINGS = None
Expand Down Expand Up @@ -83,6 +84,9 @@ def read_settings(self):
self.MESSAGE = settings.get('MESSAGE')
if self.MESSAGE == None: return "Missing MESSAGE"

self.INBOXREPLIES = settings.get('INBOXREPLIES')
if self.INBOXREPLIES == None: return "Missing INBOXREPLIES"

temp_settings = settings.get('PRE_THREAD_SETTINGS')
content_settings = temp_settings.get('CONTENT')
self.PRE_THREAD_SETTINGS = (temp_settings.get('PRE_THREAD_TAG'),temp_settings.get('PRE_THREAD_TIME'),
Expand Down Expand Up @@ -118,7 +122,7 @@ def run(self):
print error_msg
return

r = praw.Reddit('OAuth Baseball-GDT-Bot V. 3.0.1'
r = praw.Reddit('OAuth Baseball-GDT-Bot V. 3.0.1 '
'https://github.com/mattabullock/Baseball-GDT-Bot')
r.set_oauth_app_info(client_id=self.CLIENT_ID,
client_secret=self.CLIENT_SECRET,
Expand Down Expand Up @@ -191,7 +195,7 @@ def run(self):
break
if not posted:
print "Submitting pregame thread..."
sub = r.submit(self.SUBREDDIT, title, edit.generate_pre_code(directories))
sub = r.submit(self.SUBREDDIT, title, edit.generate_pre_code(directories), send_replies=self.INBOXREPLIES)
print "Pregame thread submitted..."
if self.STICKY:
print "Stickying submission..."
Expand Down Expand Up @@ -222,7 +226,7 @@ def run(self):
break
if not posted:
print "Submitting game thread..."
sub = r.submit(self.SUBREDDIT, title, edit.generate_code(d,"game"))
sub = r.submit(self.SUBREDDIT, title, edit.generate_code(d,"game"), send_replies=self.INBOXREPLIES)
print "Game thread submitted..."
if self.STICKY:
print "Stickying submission..."
Expand Down Expand Up @@ -293,7 +297,7 @@ def run(self):
if self.POST_GAME_THREAD:
print "Submitting postgame thread..."
posttitle = edit.generate_title(d,"post")
sub = r.submit(self.SUBREDDIT, posttitle, edit.generate_code(d,"post"))
sub = r.submit(self.SUBREDDIT, posttitle, edit.generate_code(d,"post"), send_replies=self.INBOXREPLIES)
print "Postgame thread submitted..."
if self.STICKY:
print "Stickying submission..."
Expand Down