Skip to content

Instantly share code, notes, and snippets.

@Echocage
Last active August 29, 2015 14:04
Show Gist options
  • Save Echocage/cb7ab542514d9c9fe13a to your computer and use it in GitHub Desktop.
Save Echocage/cb7ab542514d9c9fe13a to your computer and use it in GitHub Desktop.
Reddit response bot for m_eq_errmg
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