bots: Move contrib_bots to api/bots*.
This will make it convenient to include these bots in Zulip API releases on pypi. Fix #5009.
This commit is contained in:
parent
7531c4fb26
commit
894adb1e43
110 changed files with 36 additions and 27 deletions
0
bots/help/__init__.py
Normal file
0
bots/help/__init__.py
Normal file
18
bots/help/help.py
Normal file
18
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, client, state_handler):
|
||||
help_content = "Info on Zulip can be found here:\nhttps://github.com/zulip/zulip"
|
||||
client.send_reply(message, help_content)
|
||||
|
||||
handler_class = HelpHandler
|
23
bots/help/test_help.py
Normal file
23
bots/help/test_help.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
from six.moves import zip
|
||||
|
||||
our_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
|
||||
# For dev setups, we can find the API in the repo itself.
|
||||
if os.path.exists(os.path.join(our_dir, '..')):
|
||||
sys.path.insert(0, '..')
|
||||
from 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