Add StateHandler to contrib_bots/run.py.

This allows bots to be stateful.  It doesn't handle persistence
after the bot shuts down, but it does store state between
invocations of handle_message.
This commit is contained in:
Steve Howell 2016-10-10 09:42:14 -07:00 committed by Tim Abbott
parent 2ed9f15ff7
commit 0dab69b76f
3 changed files with 17 additions and 3 deletions

View file

@ -37,7 +37,7 @@ class FollowupHandler(object):
return is_follow_up
def handle_message(self, message, client):
def handle_message(self, message, client, state_handler):
original_content = message['content']
original_sender = message['sender_email']
new_content = original_content.replace('@followup',

View file

@ -23,7 +23,7 @@ class HelpHandler(object):
return True
def handle_message(self, message, client):
def handle_message(self, message, client, state_handler):
help_content = '''
Info on Zulip can be found here:
https://github.com/zulip/zulip