Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.7
- '''
- Created on 11 Nov 2014
- @author: CaptainParanoia
- @license: MIT
- '''
- import praw
- import time
- import numpy
- import datetime
- import logging
- USER_AGENT = "WhatsGoingonHere v.2014-11-14 by /u/NewAustrian"
- THING_LIMIT = 1000
- SUB_BLACKLIST = ['t5_2s3qj', 't5_32yw1', 't5_2szgd','t5_34dqu','t5_34hgi', 't5_2wwh3', 't5_2zgoa']
- REPLY_TEXT = ["This is everywhere!", "Is this for real?", "The tips must flow!",
- "Ah, Bitcoins. Nice.", "Wow. Big spender.", "Micropayments are really taking off.",
- "I love the future.", "This is gentleman", "Is it Tuesday again?", "Spread the love.",
- "That bot is very busy today.", "Let's hope the bot can deal with all the tips today. :)",
- "You're keeping the bot busy.", "A tip a day keeps the Bearwhale away.",
- "To the moon!", "Yeah, free money!", "Let it rain!", "Stay gentleman and keep on tipping.",
- "Let it go viral!", "Whoa, what just happened here?", "This is VERY gentleman",
- "The tipping bot really shows what the community can do.", "Ignore the haters and keep up the good work.",
- "Keep up the good work.", "Gentleman, indeed", "Tipping makes me smile.",
- "Nice to see more tips outside r/Bitcoin.", "Take that, /r/Bearwhale", "I really love this bot.",
- "This gives me a warm and fuzzy feeling.", "Yeah, Bitcoin here we go!", "This. Bitcoin is here to stay!",
- "Now try to do this with PayPal.", "Whoa! What just happened here?!", "ChangeTipBot for the win!",
- "And there are people who want to ban the bot...", "Classic gentleman",
- "Ah crypto currencies. I love them."]
- #REPLY_TEXT = ["Whoa, what just happened here?", "Whoa! What just happened here?!", "How can I do this?", "How does this work?",
- # "I see this everywhere but how does it work?", "Can I do this as well?"]
- RESPONSE_RATE = 0.025
- PARENT_RATE = 0.2
- if __name__ == '__main__':
- logging.basicConfig(filename='/home/maix/usr/log/whatsgoingon.log', level=logging.INFO)
- logging.info('Started: ' + str(datetime.datetime.now()))
- time.sleep(numpy.random.randint(0,600))
- r = praw.Reddit(user_agent=USER_AGENT)
- r.login('JennyCherry18', 'REDACTED')
- logging.info('Login')
- user_name = "changetip"
- user = r.get_redditor(user_name)
- already_done = []
- comments = user.get_comments(limit=THING_LIMIT)
- for comment in comments:
- if comment.subreddit_id not in SUB_BLACKLIST and comment.id not in already_done:
- if numpy.random.random() < RESPONSE_RATE:
- logging.info(comment)
- text = numpy.random.choice(REPLY_TEXT, 1)[0]
- try:
- if numpy.random.random() > PARENT_RATE:
- comment.reply(text)
- logging.info("REPLIED TO BOT: " + text)
- else:
- parent = r.get_info(thing_id=comment.parent_id)
- parent.reply(text)
- logging.info("REPLIED TO BOT: " + text)
- time.sleep(90 + numpy.random.randint(0,120))
- except praw.errors.RateLimitExceeded as err:
- logging.exception("RateLimitExceeded")
- time.sleep(err.sleep_time + 10)
- already_done.append(comment.id)
- logging.info("Completed: " + str(datetime.datetime.now()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement