From 9e24b1b13d65b373be6b37b80f622471aa9338f9 Mon Sep 17 00:00:00 2001 From: Aaron Johnon Date: Tue, 3 Dec 2024 23:27:44 -0600 Subject: [PATCH] Progress on complete README --- README.md | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 996b59b..7f02c80 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,104 @@ -# Telegram Bot Send -## tbotsend -This bot will say things. +# tbotsend (Telegram Bot Send) -(This is just a starting point for the readme) +`tbotsend` is a command-line tool written in Go 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](#features) +- [Installation](#installation) +- [Usage](#usage) + - [Command-Line Options](#command-line-options) + - [Configuration Files](#configuration-files) + - [Examples](#examples) +- [Building from Source](#building-from-source) +- [License](#license) + +## 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 download the pre-built binary from the [releases page](https://github.com/yourusername/tbotsend/releases) or build from source by following the [Building from Source](#building-from-source) section. + +## Usage + +### Command-Line Options + +| Option | Short | Description | +|---------------------------|-------|----------------------------------------------------| +| `--config ` | `-f` | Configuration file path. | +| `--chatid ` | `-c` | Chat ID value. | +| `--token ` | `-t` | Bot token value. | +| `--timeout ` | | 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.yaml` +2. `${HOME}/.tbotsend.yaml` + +#### Configuration File Format + +Create a YAML file with the following structure: + +```yaml +CHATID: "your_chat_id" +TOKEN: "your_bot_token" +TIMEOUT: 10 +``` + +- CHATID (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](https://core.telegram.org/bots#6-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: +```sh +tbotsend --config /path/to/your/config.yaml "This is a message!" +``` + +### Examples + +#### Sending a Message Using the Default Configuration File +```sh +tbotsend "Здравствуйте, Telegram!" +``` + +#### Sending a Message with Silent Mode Enabled +```sh +tbotsend --silent "This message will not send a notification." +``` +```sh +tbotsend -s "Neither will this one." +``` +```sh +tbotsend "Or even this one!" -s +``` + +#### Sending a Message Using Flags Instead of Conf File +```sh +tbotsend -c "123456789" -t "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" "Message sent using flags." +``` + +#### Display Version Information +```sh +tbotsend -v +``` +```sh +tbotsend --version +``` + + +----TO BE CONTINUED