From 58d61cdf2397dcc6fcc628b0bdaca7e552a8984c Mon Sep 17 00:00:00 2001 From: Awiteb Date: Thu, 14 Nov 2024 14:20:11 +0000 Subject: [PATCH] chore: Update `README.md` Signed-off-by: Awiteb --- README.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99f7c81..ab5b0fe 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,11 @@ We use `TOML` format for configuration, the default configuration file is `/app/ ### Structure -In our configuration file, we have two main sections: +In our configuration file, we have three main sections: - `forgejo`: Forgejo instance configuration - `expressions`: Regular expressions to match against - +- `telegram`: Telegram bot configuration #### `forgejo` @@ -98,3 +98,35 @@ usernames = ['^admin.*$'] usernames = ['^mod.*$'] ``` +#### `telegram` + +Telegram bot configuration section, with the following fields: + +- `token`: Telegram bot token +- `chat`: Chat ID to send the alerts to (Can be a group or a channel or a user) +- `lang`: Language to use for the alerts (Currently only `ar-sa`, `en-us` and `ru-ru` are supported) + +```toml +[telegram] +token = "your-token" +chat = 00000000000 +lang = "en-us" +``` + +## Running the guardian + +After you have the configuration file ready, you can run the guardian with the following command: + +```sh +FORGEJO_GUARDIAN_CONFIG=/path/to/your/config.toml forgejo-guardian +``` + +You can remove the `FORGEJO_GUARDIAN_CONFIG` environment variable from the command if it's already set, or the file in the default location `/app/forgejo-guardian.toml`. + +### Adding a new language + +If you would like to contribute by adding a new language, you can do that by adding your language file in the `locales` directory, and then add it to `Lang` enum in `src/telegram.rs` file. Then you can use it in the configuration file. + +## License + +This project is licensed under the [AGPL-3.0-or-later](https://www.gnu.org/licenses/agpl-3.0.html) license.