This application is an echo bot, which simply sends back user messages a chosen number of times. Echo bot is implemented for two clients: Telegram and Console. Note that for Telegram you should first create a bot through BotFather, for more information see telegram.org.
A user can send a command which will print a configurable help message. The command is </help>
.
A user can send a command which will print a configurable repeat message. In Telegram on </repeat>
command he will see a buttonpad with numbers from 1 to 5. In Console on </repeat>
command he needs to enter an integer, which is greater than zero.
Logger is single threaded. Supported levels of logging: DEBUG, INFO, WARN, ERROR, the default log file is <./log/bot.log>
. All sent messages and repeat number changes are logged on debug level.
Almost all functionality is configurable through file <./config/settings.local.yaml>
. The supported items are: bot token, help message, repeat message, a default number of user message repeats, logging configuration. For convenience there is <./config/settings.template.yaml>
file in the repository, that could be used for reference.
Clone this repository. To build an executable use <cargo build>
command.
Copy over the template file:
cp config/settings.template.yaml config/settings.local.yaml
Change config/settings.local.yaml
file.
The token parameter is required to change. The tokens can be obtained in the process of creating bots (see links in header paragraph).
Note that you also have to choose which bot to run in the configuration file.
To test project use <cargo test>
command.
To launch app use <cargo run>
command.
To pass specific configuration file run:
cargo run -- --config config/settings.template.yaml