Skip to content

stanislav-az/echo-bot-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Echo-bot

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.

⚙️ Functionality

❔ Help messages

A user can send a command which will print a configurable help message. The command is </help>.

🔁 Choosing a number of repeats

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.

📒 Logging

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.

🔧 Configurability

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.

💻 App using guide

Downloading and building

Clone this repository. To build an executable use <cargo build> command.

Configuration files preparation

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.

Running tests

To test project use <cargo test> command.

Launching

To launch app use <cargo run> command.

To pass specific configuration file run:

cargo run -- --config config/settings.template.yaml

About

This is a pet project for learning rust.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages