Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- from time import sleep
- import random
- user = "bootcut_bandit"
- pword = "moneys"
- clientid = "KPSi-reky-ONLA"
- clientsecret = "R8NWp3gpeA17cP51U0EOUGIf3u0"
- subreddit_monitor = "sneakers"
- def bot_login():
- logit = praw.Reddit(username = user,
- password = pword,
- client_id = clientid,
- client_secret = clientsecret,
- user_agent = "bot test v0.1")
- return logit
- def run_bot(r,sm):
- mlist=[]
- qi = random.randrange(1,5)
- quotes = {1:"#*The bootcut bandit strikes again!*",
- 2:"#*BOOOOOOTTCUUUUUUUTTT BAAAAAAAAANNDDIIIIT!!!*",
- 3:"#*B O O T C U T B A N D I T*",
- 4:"***B O O T C U T B A N D I T***\n\n***O***\n\n***O***\n\n***T***\n\n***C***\n\n***U***\n\n***T***\n\n***B***\n\n***A***\n\n***N***\n\n***D***\n\n***I***\n\n***T***"}
- for i in r.subreddit(sm).comments(limit=500):
- with open("already_replied.txt","r") as z:
- mlist=z.read().splitlines()
- if "!BOOTCUTBANDIT" in i.body.upper() and i.id not in mlist:
- i.reply(quotes[qi]) # this is the reply
- with open("already_replied.txt","a") as f:
- f.write(i.id + "\n")
- # mlist.append(i.id)
- print("found string")
- #else:
- #print("string not found")
- print("sleeping")
- sleep(15)
- def send_msg(r, username, subject, body):
- r.redditor(username).message(subject, body)
- def main():
- r = bot_login()
- while True:
- run_bot(r, subreddit_monitor)
- main()
- # this will send message to someone in PM
- # r=bot_login()
- # send_msg(r, "pissymon","test", "***B O O T C U T B A N D I T***\n\n***O***\n\n***O***\n\n***T***\n\n***C***\n\n***U***\n\n***T***\n\n***B***\n\n***A***\n\n***N***\n\n***D***\n\n***I***\n\n***T***")
- # this will show the newest posts in the test subreddit sorted by hot
- # for i in r.subreddit('test').hot(limit=10):
- # print(i.title)
- #for i in r.subreddit('sneakers').hot(limit=10):
- # print(i.title)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement