Rust rewrite of tbotsend Go application
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Aaron Johnon d5e0b32109
Commented out 'help' option for now to use the built-in help
5 months ago
src Commented out 'help' option for now to use the built-in help 5 months ago
.gitignore First port from Go using GPT after fixing some errors 5 months ago
Cargo.toml Commented out 'help' option for now to use the built-in help 5 months ago
LICENSE Added license 5 months ago
README.md Added incomplete README 5 months ago

README.md

tbotsend (Telegram Bot Send)

tbotsend-rs is a command-line tool written in Rust for sending messages via a Telegram bot. It allows you to send messages to a specified chat ID using a bot token, with support for configuration via files or command-line flags. The tool is designed to be simple, efficient, and easily integrated into scripts or automated workflows.

Table of Contents

Features

  • Send Messages via Telegram Bot: Easily send messages to any chat ID using your Telegram bot token.
  • Configuration Flexibility: Configure the tool using command-line flags or YAML configuration files.
  • Silent Mode: Option to disable notifications for messages sent.
  • Customizable Timeout: Set custom timeout values for network requests.
  • Version Information: Quickly check the tool's version with the --version flag.

Installation

You can eventually download the pre-built binary from the releases page, but as of this writing this is not yet an option. You may also build from source by following the Building from Source section.

Usage

Command-Line Options

Option Short Description
--config <path> -f Configuration file path.
--chatid <id> -c Chat ID value.
--token <token> -t Bot token value.
--timeout <seconds> Timeout value in seconds (default is 10).
--silent -s Disable notification sounds (for message receipt).
--version -v Print version information and exit.
--help -h Display help information.
  • Note: You cannot use both configuration flags (--chatid, --token) and a configuration file (--config) at the same time. Choose one method to provide your configuration.

Configuration Files

tbotsend supports configuration via YAML files. By default, it looks for configuration files in the following order:

  1. ${HOME}/.config/tbotsend.toml
  2. ${HOME}/.tbotsend.toml

Configuration File Format

Create a TOML file with the following structure:

chat_id = "your_chat_id"
token = "your_bot_token"
timeout = 10
  • chat_id (string): The chat ID where the message will be sent. This can be obtained from Telegram.
  • token (string): The bot token provided by the BotFather.
  • timeout (integer, optional): Timeout value in seconds for the HTTP POST request. Default: 10

Specifying a Custom Configuration File

Use the --config of -f flag to specify a custom configuration file:

tbotsend-rs --config /path/to/your/config.toml "This is a message!"

Examples

Sending a Message Using the Default Configuration File

tbotsend-rs "Здравствуйте, Telegram!"

Sending a Message with Silent Mode Enabled

tbotsend-rs --silent "This message will not send a notification."
tbotsend-rs -s "Neither will this one."
tbotsend-rs "Or even this one!" -s

Sending a Message Using Flags Instead of Conf File

tbotsend-rs -c "123456789" -t "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" "Message sent using flags."

Display Version Information

tbotsend-rs -v
tbotsend-rs --version

----TO BE CONTINUED