Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Python by wosnd ( 9 years ago )
import praw
import time
 
r = praw.Reddit(client_id='----', client_secret='----', password='-----', user_agent='bntvglbot 1.0 by /u/wosnd', username='wosnd')
 
words_to_match = ['SayMyNameBNT']
cache = []
 
def run_bot():
    import inspect; print(inspect.getfile(reddit.__class__))
    subreddit = r.get_subreddit("test")
    comments = subreddit.get_comments(limit=25)
    for comment in comments:
        comment_text = comment.body.lower()
        isMatch = any(string in comment_text for string in words_to_match)
        if comment.id not in cache and isMatch:
            comment.reply('No thanks.')
            cache.append(comment.id)
 
while True:
    run_bot()
    time.sleep(10)

 

Revise this Paste

Children: 108021
Your Name: Code Language: