Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import os
- import re
- import random
- if not os.path.isfile("posts_replied_to.txt"):
- posts_replied_to = []
- else:
- with open("posts_replied_to.txt", "r") as f:
- posts_replied_to = f.read()
- posts_replied_to = posts_replied_to.split("\n")
- #load stats file into usable variables.
- #you will have to manually create this file first, it's buggy otherwise
- with open('WallStats.txt', 'r') as inFile:
- stats = inFile.read().split('\n')
- height = float(stats.pop())
- length = float(stats.pop())
- percentage = float(stats.pop())
- numBricks = int(stats.pop())
- #init bot
- reddit = praw.Reddit(user_agent='foobar',
- client_id='yourclientid', client_secret='yoursecretkey',
- username='YourBot', password='expunged')
- print(reddit.user.me())
- print("... IS ACTIVE!!!")
- #subreddits that your bot will interact with
- subreddit = reddit.subreddit("the_donald+DrainTheSwamp+100_Legs_Over_Texas+tretki")
- for comment in subreddit.stream.comments():
- if(re.search("ludicrous speed", comment.body, re.IGNORECASE) or re.search("ludicrous brick", comment.body, re.IGNORECASE) or re.search("ludacris speed", comment.body, re.IGNORECASE) or re.search("ludacris brick", comment.body, re.IGNORECASE)) and not comment.author==reddit.user.me() and comment.fullname not in posts_replied_to:
- #increase stats!
- ludicrousBricks = random.randrange(5,20)
- numBricks += ludicrousBricks
- percentage += random.uniform(0,0.001)
- length += random.uniform(0,0.09)
- height += random.uniform(0,0.005)
- print("Readying LUDICROUS shitpost " + str(numBricks) + "!") #message to console
- #build the comment!
- reply_string = "#[LUDICROUS SPEED?!](https://youtu.be/oApAdwuqtn8)\n\n#*THAT'S LUDICROUS!*\n\n**SOMEONE GET THIS BATSHIT INSANE PATRIOT " + str(ludicrousBricks) +" BRICKS!!!**\n\n*why,* you ask? BECAUSE THIS **PATRIOT** WILL USE THEM TO **SOFTEN THEIR FASTER-THAN-LIGHT CRASH LANDING** at the **U.S./MEXICO BORDER!!!!!**\n\n**THAT'S " + str(numBricks) + " BRICKS HANDED OUT!**\n\n" + "We are at **" + str(percentage) + "%** of our goal to **BUILD THE WALL** starting from Imperial Beach, CA to Brownsville, Texas! Lets make sure everyone gets a brick in the United States! For every Centipede a brick, for every brick a Centipede!\n\n" + "At this rate, the wall will be **" + str(length) + " MILES WIDE** and **" + str(height) + " FEET HIGH** by tomorrow! **DO YOUR PART!**"
- comment.reply(reply_string)#post it!
- print("POSTED!") #notify console!
- posts_replied_to.append(comment.fullname)
- #save stats to file
- with open('WallStats.txt', 'r+') as outFile:
- outFile.write(str(numBricks) + "\n" + str(percentage) + "\n" + str(length) + "\n" + str(height))
- with open("posts_replied_to.txt", "w") as f:
- for post_id in posts_replied_to:
- f.write(post_id + "\n")
- elif(re.search("quadruple brick", comment.body, re.IGNORECASE) or re.search("quad brick", comment.body, re.IGNORECASE) or re.search("four brick", comment.body, re.IGNORECASE) or re.search("four more brick", comment.body, re.IGNORECASE) or re.search("4 more brick", comment.body, re.IGNORECASE) or re.search("4 brick", comment.body, re.IGNORECASE)) and not comment.author==reddit.user.me() and comment.fullname not in posts_replied_to:
- #increase stats!
- numBricks += 4
- percentage += random.uniform(0,0.001)
- length += random.uniform(0,0.09)
- height += random.uniform(0,0.004)
- print("Readying QUADRUPLE shitpost " + str(numBricks) + "!") #message to console
- #build the comment!
- reply_string = "#[QUAD DAMAGE!](https://www.youtube.com/watch?v=uG6oBC0Ym5c)\n\n#**FOUR BRICKS! FOOOOOOOOUUUUUUR! LADIES AND GENTLEMEN, THIS CENTIPEDE IS ABOUT TO DOMINATE!!!**\n\n**THAT'S " + str(numBricks) + " BRICKS HANDED OUT!**\n\n" + "We are at **" + str(percentage) + "%** of our goal to **BUILD THE WALL** starting from Imperial Beach, CA to Brownsville, Texas! Lets make sure everyone gets a brick in the United States! For every Centipede a brick, for every brick a Centipede!\n\n" + "At this rate, the wall will be **" + str(length) + " MILES WIDE** and **" + str(height) + " FEET HIGH** by tomorrow! **DO YOUR PART!**"
- comment.reply(reply_string)#post it!
- print("POSTED!") #notify console!
- posts_replied_to.append(comment.fullname)
- #save stats to file
- with open('WallStats.txt', 'r+') as outFile:
- outFile.write(str(numBricks) + "\n" + str(percentage) + "\n" + str(length) + "\n" + str(height))
- with open("posts_replied_to.txt", "w") as f:
- for post_id in posts_replied_to:
- f.write(post_id + "\n")
- #... and so on.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement