bots: Move all bots and the bots API to separate package.

This commit is contained in:
Eeshan Garg 2017-07-18 01:47:16 -02:30
parent 928d5ca16d
commit 879f44ab3a
130 changed files with 183 additions and 144 deletions

View file

@ -0,0 +1,18 @@
# See readme.md for instructions on running this code.
class HelpHandler(object):
def usage(self):
return '''
This plugin will give info about Zulip to
any user that types a message saying "help".
This is example code; ideally, you would flesh
this out for more useful help pertaining to
your Zulip instance.
'''
def handle_message(self, message, bot_handler, state_handler):
help_content = "Info on Zulip can be found here:\nhttps://github.com/zulip/zulip"
bot_handler.send_reply(message, help_content)
handler_class = HelpHandler

View file

@ -0,0 +1,16 @@
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from six.moves import zip
from zulip_bots.test_lib import BotTestCase
class TestHelpBot(BotTestCase):
bot_name = "help"
def test_bot(self):
txt = "Info on Zulip can be found here:\nhttps://github.com/zulip/zulip"
messages = ["", "help", "Hi, my name is abc"]
self.check_expected_responses(dict(list(zip(messages, len(messages)*[txt]))))