Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import datetime
- from time import sleep
- def replace_with_case(string, sub, repl):
- result = []
- i = string.lower().find(sub.lower())
- while i != -1 and string:
- result.append(string[:i])
- word = []
- string = string[i:]
- for j, letter in enumerate(repl):
- if string[j].islower():
- word.append(letter.lower())
- elif string[j].isupper():
- word.append(letter.upper())
- else:
- word.append(letter)
- result.append("".join(word))
- string = string[len(sub):]
- i = string.lower().find(sub.lower())
- result.append(string)
- return "".join(result)
- reddit = praw.Reddit(client_id = "confidential :0",
- client_secret = "confidential :0",
- user_agent = "fortniteiscancerbot (posts) v1.0",
- username = "FortniteIsCancerBot",
- password = "confidential :0")
- subreddit = reddit.subreddit("all")
- made = []
- while True:
- try:
- while True:
- for submission in subreddit.stream.submissions():
- if submission not in made and "fortnite" in str(submission.title).lower() and "fortnite" not in str(submission.subreddit).lower():
- replaced = replace_with_case(str(submission.title), "fortnite", "cancer")
- replaced = replace_with_case(replaced, "battle royale", "autism royale")
- replaced = replace_with_case(replaced, "save the world", "save the whore")
- replaced = replace_with_case(replaced, "br", "ar")
- replaced = replace_with_case(replaced, "cancer creative", "cancer uncreative")
- ftfy = """>""" + replaced + """
- FTFY
- ^(Bleep bloop. I am a carcinogenic bot | ) ^[info](http://redd.it/amo7ot/)"""
- print("""
- Submission: """ + str(datetime.datetime.now()))
- print(replaced)
- submission.reply(ftfy)
- made.append(submission)
- sleep(10)
- except:
- continue
- """
- while True:
- try:
- for comment in subreddit.stream.comments():
- if "fortnite" in str(comment.body).lower() and len(comment.body.splitlines()) == 1 and len(str(comment.body)) < 75 and "fortnite" not in str(comment.subreddit).lower():
- ftfy = """>""" + replace_with_case(comment.body, "fortnite", "cancer") + ""
- FTFY
- ^(Bleep bloop. I am a carcinogenic bot)""
- print("Comment:" + str(datetime.datetime.now()))
- print(ftfy)
- comment.reply(ftfy)
- except:
- continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement