Skip to main content

A CLI tool for bothub.studio service

Project description

This package provides command line interface to Bothub.studio service.

Installation

To install bothub-cli:

$ pip install bothub-cli

or, if you are not installing in a virtualenv:

$ sudo pip install bothub-cli

The bothub-cli package works on python2 and 3 both.

Getting Started

Before using bothub-cli, you need to tell it about your Bothub.studio credentials.

$ bothub configure
Username: myuser
Password: mysecret

Then it stores access token on ~/.bothub directory.

To start build a new bot:

$ mkdir mybot
$ cd mybot
$ bothub init
Project name: mybot

Now you have a starter echo bot:

.
|-- bothub
|   |-- bot.py
|   `-- __init__.py
|-- bothub.yml
|-- requirements.txt
`-- tests

Edit bot.py below for your purpose.

# -*- 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'])

and deploy it.

$ bothub deploy

You also need to configure channel to use.

$ bothub channel add telegram --api-key=<my-api-key>

Usage

Usage: bothub [OPTIONS] COMMAND [ARGS]...

Bothub is a command line tool that configure, init, and deploy bot codes
to BotHub.Studio service

Options:
  --help  Show this message and exit.

Commands:
  channel    Setup channels of current project
  configure  Setup credentials
  deploy     Deploy project
  init       Initialize project
  ls         List projects
  rm         Delete a project

Setup

Authorize a user and get access token.

$ bothub configure

Project management

Initialize project on current directory. Create a echo chatbot code.

$ bothub init

Deploy current project.

$ bothub deploy

List of projects.

$ bothub ls

Delete a project.

$ bothub rm <project_name>

Channel management

List of channels for current project.

$ bothub channel ls

Add a channel for current project.

$ bothub channel add <channel> --api-key=<api_key> --app-id=<app_id>

Remove a channel from current project.

$ bothub channel rm <channel>

Resources

  • Documentation (TBD)

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

bothub_cli-0.1.2-py2.py3-none-any.whl (14.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bothub_cli-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for bothub_cli-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 08c783ef848b17e92c7e93f00d28b2b8af8ed6516671bc10f60b87b9b7ca4a80
MD5 f7cf67917a6afcf6574e40152c58d7d6
BLAKE2b-256 1b7636b896a9d614373794ad1d3357ba8efc69595e72a5c445c70d7bf3aa053a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page