Advertisement
Guest User

Untitled

a guest
Sep 9th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. import praw
  2. import config
  3. import time
  4. import os
  5. import requests
  6. import random
  7. print("not deporting the flares")
  8.  
  9.  
  10. def login():
  11. print("haxing the webs")
  12. r = praw.Reddit(username = config.username,
  13. password = config.password,
  14. client_id = config.client_id,
  15. client_secret = config.client_secret,
  16. user_agent = 'Upvote and fighter bot for r/kickdownthedoor.',
  17. )
  18. print("logged on")
  19. return r
  20.  
  21. def run(r, saved_list, some_list):
  22. for comment in r.subreddit(easy).comments(limit=20):
  23. if "gimme class" in comment.body and comment.id not in replied_list and comment.author != r.user.me():
  24. print("making sure this isn't deja vu...")
  25. print("giving flairs")
  26. r.subreddit(easy).flair.set(comment.author, some_list[random.randint(0,3)])
  27. print("flairs gimmied")
  28. comment.reply("class gimmied")
  29. print("replied, id is" + comment.id)
  30.  
  31. replied_list.append(comment.id)
  32.  
  33.  
  34. with open ("list.txt", "a") as f:
  35. f.write(comment.id + "\n")
  36. print("do not call list updated")
  37.  
  38.  
  39. print("not getting ratelimited...")
  40. time.sleep(3)
  41.  
  42.  
  43. def post_recog(easy):
  44. for submission in r.subreddit(easy).new(limit=20):
  45. if "30" in submission.title and submission.id not in post_list:
  46. post_list.append(submission.id)
  47.  
  48. if submission.score >= 30:
  49. print("locking the post")
  50. submission.mod.flair('Complete!')
  51. submission.mod.lock()
  52. else:
  53. submission.mod.flair('You\'re nearly there! Keep upvoting!')
  54.  
  55. with open ("list2.txt", "a") as f:
  56. f.write(submission.id + "\n")
  57. print("submission filter updated")
  58.  
  59. if "20" in submission.title and submission.id not in post_list:
  60. post_list.append(submission.id)
  61.  
  62. if submission.score >= 20:
  63. print("locking the post")
  64. submission.mod.lock()
  65. else:
  66. submission.mod.flair('You\'re nearly there! Keep upvoting!')
  67.  
  68. with open ("list2.txt", "a") as f:
  69. f.write(submission.id + "\n")
  70. print("submission filter updated")
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. def saved_list():
  79. with open("list.txt", "r") as f:
  80. replied_list = f.read()
  81. replied_list = replied_list.split()
  82. return replied_list
  83.  
  84.  
  85. def list2():
  86. with open("list2.txt", "r") as f:
  87. post_list = f.read()
  88. post_list = post_list.split()
  89. return post_list
  90.  
  91.  
  92. some_list = ['Halfling', 'Dwarf', 'Elf', 'Orc']
  93.  
  94.  
  95. easy = 'kickopenthedoor'
  96.  
  97. r = login()
  98. replied_list = saved_list()
  99. post_list = list2()
  100. while True:
  101. run(r, saved_list, some_list)
  102. post_recog(easy)
  103.  
  104. subreddit = r.subreddit(easy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement