bots: Move all bots and the bots API to separate package.
This commit is contained in:
parent
928d5ca16d
commit
879f44ab3a
130 changed files with 183 additions and 144 deletions
0
zulip_bots/zulip_bots/bots/help/__init__.py
Normal file
0
zulip_bots/zulip_bots/bots/help/__init__.py
Normal file
18
zulip_bots/zulip_bots/bots/help/help.py
Normal file
18
zulip_bots/zulip_bots/bots/help/help.py
Normal 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
|
16
zulip_bots/zulip_bots/bots/help/test_help.py
Executable file
16
zulip_bots/zulip_bots/bots/help/test_help.py
Executable 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]))))
|
Loading…
Add table
Add a link
Reference in a new issue