Advertisement
SantiagoMG

FortniteIsCancerBot for Posts

Feb 3rd, 2019 (edited)
1,116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.64 KB | None | 0 0
  1. import praw
  2. import datetime
  3. from time import sleep
  4.  
  5. def replace_with_case(string, sub, repl):
  6.   result = []
  7.   i = string.lower().find(sub.lower())
  8.   while i != -1 and string:
  9.       result.append(string[:i])
  10.       word = []
  11.       string = string[i:]
  12.       for j, letter in enumerate(repl):
  13.         if string[j].islower():
  14.           word.append(letter.lower())
  15.         elif string[j].isupper():
  16.           word.append(letter.upper())
  17.         else:
  18.           word.append(letter)
  19.       result.append("".join(word))
  20.       string = string[len(sub):]
  21.       i = string.lower().find(sub.lower())
  22.   result.append(string)
  23.   return "".join(result)
  24.  
  25. reddit = praw.Reddit(client_id = "confidential :0",
  26.             client_secret = "confidential :0",
  27.             user_agent = "fortniteiscancerbot (posts) v1.0",
  28.             username = "FortniteIsCancerBot",
  29.             password = "confidential :0")
  30. subreddit = reddit.subreddit("all")
  31.  
  32. made = []
  33.  
  34. while True:
  35.     try:
  36.         while True:
  37.             for submission in subreddit.stream.submissions():
  38.                 if submission not in made and "fortnite" in str(submission.title).lower() and "fortnite" not in str(submission.subreddit).lower():
  39.                     replaced = replace_with_case(str(submission.title), "fortnite", "cancer")
  40.                     replaced = replace_with_case(replaced, "battle royale", "autism royale")
  41.                     replaced = replace_with_case(replaced, "save the world", "save the whore")
  42.                     replaced = replace_with_case(replaced, "br", "ar")
  43.                     replaced = replace_with_case(replaced, "cancer creative", "cancer uncreative")
  44.                                                  
  45.                     ftfy = """>""" + replaced + """
  46.  
  47. FTFY
  48. ^(Bleep bloop. I am a carcinogenic bot | ) ^[info](http://redd.it/amo7ot/)"""
  49.                     print("""
  50.  
  51. Submission: """ + str(datetime.datetime.now()))
  52.                     print(replaced)
  53.                     submission.reply(ftfy)
  54.                     made.append(submission)
  55.                     sleep(10)
  56.     except:
  57.         continue
  58.  
  59. """
  60. while True:
  61.    try:
  62.        for comment in subreddit.stream.comments():
  63.            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():
  64.                ftfy = """>""" + replace_with_case(comment.body, "fortnite", "cancer") + ""
  65.  
  66. FTFY
  67. ^(Bleep bloop. I am a carcinogenic bot)""
  68.                print("Comment:" + str(datetime.datetime.now()))
  69.                print(ftfy)
  70.                comment.reply(ftfy)
  71.    except:
  72.        continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement