Last active
August 29, 2015 14:04
-
-
Save Echocage/cb7ab542514d9c9fe13a to your computer and use it in GitHub Desktop.
Reddit response bot for m_eq_errmg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import time | |
import sys | |
import praw | |
# ========================================== | |
# ===============Configuration============== | |
user_to_reply_to = 'echocage' | |
messages = ['examplecomment1', "Example Comment 2"] | |
username = "" | |
password = "" | |
# ========================================== | |
# ========================================== | |
r = praw.Reddit('explain what your bot does' | |
'by [Your Username Here]') | |
r.login(username, password) | |
while True: | |
try: | |
reddit_user = r.get_redditor(user_to_reply_to) | |
for previous_reply in reddit_user.get_comments(): | |
if not any(filter(lambda x: x.author.name == username, previous_reply.replies)): | |
print 'Commenting on', previous_reply | |
previous_reply.reply(random.choice(messages)) | |
time.sleep(5) | |
except praw.errors.RateLimitExceeded as err: | |
print "Rate Limit Exceeded:\n" + str(err), sys.stderr | |
time.sleep(err.sleep_time + .05) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment