Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import time
- path = 'commented.txt'
- header = '\n\n *2bot2t Version 0.1, PM /u/HouseCasterly with suggestions/issues. 6783.*'
- links = '\n\n [Join us](http://discord.gg/pzGpnhQ)'
- def authenticate():
- print('Authenticating...\n')
- reddit = praw.Reddit('2bot2t', user_agent = 'A 2b2t Bot')
- print('Authenticated as {}\n'.format(reddit.user.me()))
- return reddit
- def run_2bot2t(reddit):
- with open(path, 'r') as f:
- prev_comments = f.read().splitlines()
- print("Getting 250 comments...\n")
- for comment in reddit.subreddit('2b2t').comments(limit=250):
- match = re.findall("kek",comment.body)
- if match:
- print("Name found in comment with comment ID: " + comment.id)
- if comment.id not in prev_comments and comment.author.name != "2bot2t":
- print('Commenter is a filthy infidel... fixing their ways...\n')
- prev_comments.append(comment.id)
- with open(path, 'a+') as f:
- f.write(comment.id + '\n')
- comment.reply("Halt in the name of Zozzle, filthy infidel! I'm going to hope you meant to say Zoz(zle) instead of K*k." + header)
- time.sleep(600)
- else:
- print('The keker has been assimilated.')
- else:
- print('Comment Searched, no incorrect kekage\n')
- def main():
- reddit = authenticate()
- while True:
- run_2bot2t(reddit)
- if __name__ == '__main__':
- main()
- dmis8as
- dmitguc
- dmitmcw
- dmitz1i
- [2bot2t]
- username: 2bot2t
- password:
- client_id: Mq-McO-3HIaD1Q
- client_secret: D35NTkwpsi2aoqtyaGI5LDquNs8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement