Build serverless chatbot on BotHub.Studio
Project description
This package provide components to works with BotHub.Studio, which is a chatbot hosting service.
With bothub-cli, you can deploy a new chatbot with just four lines of commands.
Installation
To install bothub:
$ pip install bothub
The bothub package works on python2 and 3 both.
Getting Started
You can build a echo chatbot simply by subclassing BaseBot class and overriding handle_message method.
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function, unicode_literals)
from bothub_client.bot import BaseBot
class Bot(BaseBot):
"""Represent a Bot logic which interacts with a user.
BaseBot superclass have methods belows:
* Send message
* self.send_message(message, user_id=None, channel=None)
* Data Storage
* self.set_project_data(data)
* self.get_project_data()
* self.set_user_data(data, user_id=None, channel=None)
* self.get_user_data(user_id=None, channel=None)
When you omit user_id and channel argument, it regarded as a user
who triggered a bot.
"""
def handle_message(self, event, context):
self.send_message(event['content'])
License
This package is licensed under AGPLv3 for non-commercial personal use. If you want to use this package for commercial use, please contact to bothub@bothub.studio.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bothub-0.1.1.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for bothub-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2175eb9e855730a28d29f8b728d975e54923bdcda5dd27e38a7e2e2fad67946d |
|
MD5 | a87c10a7c7e229494697a370f1dd4c48 |
|
BLAKE2b-256 | bc30e82a30234794b9e2f44ae0bfaa4614c700c76491a98074d9d96eedc2e466 |