Uses old Rust 2015
|0.3.3||Aug 20, 2017|
|0.3.2||Aug 13, 2017|
|0.3.1||Jul 31, 2017|
|0.2.0||Jun 24, 2017|
|0.1.2||Jun 14, 2017|
#1413 in Web programming
27 downloads per month
Overbot - A telegram bot helper
The goal of Overbot is to remove all the boilerplate necessary to write a telegram bot, leaving to you only the business logic to care about.
Overbot achieve this by handling the network communication, while you specify the bot behavior in a configuration file.
Supported formats are
toml. The following is a simple example using the toml format:
#mybot.toml token = "mytoken" [[command]] regex='hello ([A-z]+)' executable = '/bin/echo' args = ['$1'] input = 'text' output = 'text'
The following parameters are avalable:
The token required to impersonate the bot
Any number of command blocks are supported, with the following supported parameters:
The regex used to match this particular command.
The commands are tested for matching in order, and the first one to match is executed.
The supported syntax is the one supported by the rust regex crate.
It is possible to specify capture groups, and reference them later (by number and/or name) in the
The absolute path of a program to execute in response to the received message.
The program will receive the message via
stdin, and its
stdout will be the body of the response message.
An array of arguments to pass to the executable.
$ symbol can be used as a prefix to a capture group number or name, that will be expanded accordingly to the provided query.
The capture group
$0 is the entire match.
The input mode that will be used. Supported modes are:
- json: the raw json message will be sent to stdin
- text: the
textfield of the message will be sent to stdin
The output mode that will be used. Supported modes are:
- json: the program stdout is expected to contain a raw json message response
- text: the program stdout is expected to contain the text field of the message response
- textmono: the program stdout is expected to contain the text field of the message response, that will be enclosed in a
- markdown: the program stdout is expected to contain the text field of the message response, and the subset of Markdown accepted by telegram is recognized
- html: the program stdout is expected to contain the text field of the message response, and the subset of HTML accepted by telegram is recognized
Optionally, it is possible to specify a
allowed parameter, as a list of telegram ids that are accepted for the bot, or for the single command if the field is present in a
The ids may be both group ids or user ids.
Run the program
The program accept as a parameter a folder containing any number of
.json configuration files (one per bot):
The program is currently a work in progress, and lacks many desirable features, in particular:
- Decent and human readable error handling for configuration errors
- Inline mode support
- Decent and configurable logging
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)