Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import time
- import os
- import datetime
- def bot_login():
- r = praw.Reddit(username = "Ridiculous_Bot",
- password = "",
- client_id = "",
- client_secret = "",
- user_agent = "Ridiculous Responder")
- return r
- def run_bot(r, comments_replied_to):
- for comment in r.subreddit('funny+politicalhumor+gaming+videos+quityourbullshit+dankmemes+meirl+me_irl+2meirl4meirl').comments(limit=1):
- if "ridiculous" in comment.body and comment.id not in comments_replied_to and comment.author != r.user.me():
- comments_replied_to.append(comment.id)
- print ("found a ridiculous at " + st)
- comment.reply("[Ridiculous](https://www.youtube.com/watch?v=NeMIadSI4As)")
- with open ("comments_replied_to.txt", "a") as f:
- f.write(comment.id + "\n")
- def get_saved_comments():
- if not os.path.isfile("comments_replied_to.txt"):
- comments_replied_to = []
- else:
- with open("comments_replied_to.txt", "r") as f:
- comments_replied_to = f.read()
- comments_replied_to = comments_replied_to.split("\n")
- return comments_replied_to
- st = datetime.datetime.now().strftime("%A, %B %d. %I:%M%p %Y")
- r = bot_login()
- comments_replied_to = get_saved_comments()
- print (comments_replied_to)
- while True:
- run_bot(r, comments_replied_to)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement