Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import config
- import time
- import os
- import random
- answers = random.sample([
- "Thanks for the support dude, really appreciate it!" + "\n\n ^\(I ^am ^a ^bot.) ^[*Website*](http://www.NocoinProject.org) ^/ ^[*Reddit*](https://reddit.com/r/NocoinProject)",
- "Free Nocoin giveaway!" + "\n\n Send 1M Nocoin and I will send you nothing back." + "\n\n ^\(I ^am ^a ^bot.) ^[*Website*](http://www.NocoinProject.org) ^/ ^[*Reddit*](https://reddit.com/r/NocoinProject)",
- "Hey, I heard you mentioned Nocoin? That is awesome thank you for the support! You have been awarded 1M Nocoin, don't forget to claim them on our website." + "\n\n ^\(I ^am ^a ^bot.) ^[*Website*](http://www.NocoinProject.org) ^/ ^[*Reddit*](https://reddit.com/r/NocoinProject)",
- "Wow, another person shilling Nocoin. Now we're two." + "\n\n ^\(I ^am ^a ^bot.) ^[*Website*](http://www.NocoinProject.org) ^/ ^[*Reddit*](https://reddit.com/r/NocoinProject)"], 1)
- def bot_login():
- print ("Logging in...")
- r = praw.Reddit(username = config.username,
- password = config.password,
- client_id = config.client_id,
- client_secret = config.client_secret,
- user_agent = "NocoinShillBot")
- print ("Logged in!")
- return r
- def run_bot(r, comments_replied_to):
- print ("Searching last 1,000 comments")
- for comment in r.subreddit('Buttcoin').comments(limit=1000):
- if "Nocoiner" or "nocoiner" or "No coiner" or "no coiner" or "Nocoin" or "NoCoin" in comment.body and comment.id not in comments_replied_to and comment.author != r.user.me():
- print ("String with \"Nocoiner\" found in comment " + comment.id)
- comment.reply(answers)
- print ("Replied to comment " + comment.id)
- comments_replied_to = [];
- comments_replied_to.append(comment.id)
- with open ("comments_replied_to.txt", "a") as f:
- f.write(comment.id + "\n")
- print ("Search Completed.")
- print (comments_replied_to)
- print ("Sleeping for 10 seconds...")
- time.sleep(10)
- 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")
- comments_replied_to = filter(None, comments_replied_to)
- return comments_replied_to
- r = bot_login()
- comments_replied_to = get_saved_comments()
- print (comments_replied_to)
- while True:
- run_bot(r, comments_replied_to)
Add Comment
Please, Sign In to add comment