Skip to main content

Dead simple bot framework.

Project description

https://travis-ci.org/heavenshell/py-robo.png?branch=master

Dead simple bot framework which is inspired by Ruby’s ruboty.

Why reinvent the wheel

I Love Python and I’m not good at Node.js(hubot), Ruby(Ruboty).

Err is pluggable but it’s too complex for me.

brutal is also pluggable but I don’t wont to write config file.

So I reinvent the wheel.

Architecture

Message flow.

                            +--[handler a]--+
                            |               |
[chat service]-->[adapter]--+--[handler b]--+--[adapter]-->[chat service]
                            |               |
                            +--[handler c]--+

Adapter

Adapter is interface of chat services receive message and send message to chat service.

Robo includes two adapters.

Handler

Handler provides various behaviors to your robot.

from robo.decorators import cmd

class Ping(object):
    @cmd(regex=r'^ping', description='')
    def pong(self, message, **kwargs):
        return 'pong'

This handler matches message ping and return pong to chat service.

Bootstrap

example/main.py is a example of bootstraping robo.

def main(args=None):
    #: `name` is bot's name.
    #: This arg is trigger of handler.
    robot = Robot(name=args.name, logger=logger)
    #: `register_default_handlers()` register default handlers.
    #: Default handlers are `help`, `ping`, `echo`.
    robot.register_default_handlers()
    #: Load given adapter name.
    robot.load_adapter(args.adapter)
    #: Run robot
    robot.run(args.adapter)

Project details


Download files

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

Source Distribution

robo-0.5.0.tar.gz (10.3 kB view details)

Uploaded Source

File details

Details for the file robo-0.5.0.tar.gz.

File metadata

  • Download URL: robo-0.5.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for robo-0.5.0.tar.gz
Algorithm Hash digest
SHA256 41696442da535f2f80a494278969c4a4a6e8489d5254758f6fefdc7acddba2e2
MD5 fb11ee950fc4c348ba50637625f8568d
BLAKE2b-256 16c9f5a9db9ff7eedaabf26b4b2254ce93093bc491a6c457a6807bd8b3b1869f

See more details on using hashes here.

Supported by

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