Coder Social home page Coder Social logo

autobot's Introduction

Pyrogram
AUTOBOT

โš ๏ธ Project is in active development and not intended for any serious application

Framework for making bot from config files (we all love YAML, does't we?)

  1. Features
  2. Usage

Features

  • Automatic back button configuration - not need to plainly think about branching
  • Beautiful inline buttons experience - previous message gets updated on button pressed (much cleaner message history)
  • RegEx message filters

Installation

$ pip install autobot-tg # or: pipx install autobot-tg
$ autobot-tg --help

Usage

Before starting the bot, you have to specify bot token with env variable BOT_TOKEN

autobot examples/configs/simple.yaml

Config

Config examples

Config schema

Core elements of schema is:

  • states - describes possible bot states (nodes in network graph)
  • transitions - describes transitions between states (edges)

States schema

States can be represented as array of named elements:

  • <state name>
    • text (required) - text message that the bot will send when entering the state
    • command (optional) - specifies the command that will trigger state (for example /start)
    • add_back_button (optional) - whether state should have back button (yes or no)
    • inline_buttons (optional) - describes inline buttons of this state
      • row (required) - buttons in one row (array)
        • text - inline button text
        • callback_data - data that will be sent on button pressed

Transitions

Transitions is an array of elements with these fields:

  • from (required) - source state. Transition will be triggered only if bot is in this state. Must be present in states schema
  • to (required) - target state. Must be present in states schema
  • conditions (required) - under what conditions the transition will be triggered. Possible conditions:
    • message (array of regex) - transition will be triggered on message sent. Applies regex filter to user's message. If filter passes - transition is triggered (for example .+ will always trigger transition)
    • data (array of strings) - transition will be triggered if specified callback data will be sent (when user presses the inline button)
    • else (string - name of state) - trigger transition if no other conditions are satisfied. Must be valid state name
    • always (no parameters) - always triggers transition. When bot enters from state, it will instantly enter to state

autobot's People

Contributors

andrewsapw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

litton900

autobot's Issues

Save user input for later use

Example: bot asks for user name and then wants to greet user using his name ("Hello, Andrew!")

Also, this could be useful for future features, like sending stored data for users server/database.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.