The following is a quick example on how to monitor r/AskReddit for new comments. If a comment
contains the string 'banana', the bot prints the comment information:

importprawimporttimefrombottr.botimportCommentBotdefparse_comment(comment):"""Define what to do with a comment"""if'banana'incomment.body:print('ID: {}'.format(comment.id))print('Author: {}'.format(comment.author))print('Body: {}'.format(comment.body))if__name__=='__main__':# Get reddit instance with login detailsreddit=praw.Reddit(client_id='id',client_secret='secret',password='botpassword',user_agent='Script by /u/...',username='botname')# Create Bot with methods to parse commentsbot=CommentBot(reddit=reddit,func_comment=parse_comment,subreddits=['AskReddit'])# Start Botbot.start()# Run bot for 10 minutestime.sleep(10*60)# Stop Botbot.stop()