From d2090306adf7dc88e365a46ace19a971790c510b Mon Sep 17 00:00:00 2001 From: Theodore Chen Date: Tue, 23 May 2017 19:05:27 +0000 Subject: [PATCH] bots: Add helloworld example bot. --- contrib_bots/bots/helloworld/helloworld.py | 24 ++++++++++++++++++++++ contrib_bots/bots/helloworld/readme.md | 4 ++++ 2 files changed, 28 insertions(+) create mode 100644 contrib_bots/bots/helloworld/helloworld.py create mode 100644 contrib_bots/bots/helloworld/readme.md diff --git a/contrib_bots/bots/helloworld/helloworld.py b/contrib_bots/bots/helloworld/helloworld.py new file mode 100644 index 0000000000..c6904a95b5 --- /dev/null +++ b/contrib_bots/bots/helloworld/helloworld.py @@ -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 diff --git a/contrib_bots/bots/helloworld/readme.md b/contrib_bots/bots/helloworld/readme.md new file mode 100644 index 0000000000..5b200b176a --- /dev/null +++ b/contrib_bots/bots/helloworld/readme.md @@ -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.