mirror of https://github.com/zulip/zulip.git
bots: Add helloworld example bot.
This commit is contained in:
parent
13649d8846
commit
d2090306ad
|
@ -0,0 +1,24 @@
|
||||||
|
# See readme.md for instructions on running this code.
|
||||||
|
|
||||||
|
|
||||||
|
class HelloWorldHandler(object):
|
||||||
|
def usage(self):
|
||||||
|
return '''
|
||||||
|
This is a boilerplate bot that responds to a user query with
|
||||||
|
"beep boop", which is robot for "Hello World".
|
||||||
|
|
||||||
|
This bot can be used as a template for other, more
|
||||||
|
sophisticated, bots.
|
||||||
|
'''
|
||||||
|
|
||||||
|
def handle_message(self, message, client, state_handler):
|
||||||
|
content = 'beep boop'
|
||||||
|
|
||||||
|
client.send_message(dict(
|
||||||
|
type='stream',
|
||||||
|
to=message['display_recipient'],
|
||||||
|
subject=message['subject'],
|
||||||
|
content=content,
|
||||||
|
))
|
||||||
|
|
||||||
|
handler_class = HelloWorldHandler
|
|
@ -0,0 +1,4 @@
|
||||||
|
Simple Zulip bot that will respond to any query with a "beep boop".
|
||||||
|
|
||||||
|
The helloworld bot is a boilerplate bot that can be used as a
|
||||||
|
template for more sophisticated/evolved Zulip bots.
|
Loading…
Reference in New Issue