A simple chat bot connecting Instant Messaging and Translation APIs
You can either use the precompiled packages, compile BabelBot yourself or use the provided Dockerfile.
You can also deploy BabelBot on a Kubernetes cluster using Helm.
- Grab the latest precompiled release for your platform
- Configure
- Run
BabelBot.Worker
/BabelBot.Worker.exe
- Make sure you have all prerequisites installed.
- Download and extract an archive of your desired version (or development branch), or
git clone
the repository into a path of your choice. - Run
dotnet publish -c Release
to build a release version for your currently used .NET runtime. See the .NET Core documentation for more details on how to use thedotnet
CLI utility. - Configure
- Run
A (possibly incomplete, please report if you had to install more) list of prerequisites:
- .NET Core 6.0 SDK
- Make sure you have all prerequisites installed.
- Download and extract an archive of your desired version (or development branch), or
git clone
the repository into a path of your choice. - Build an image:
docker build -t babelbot:local .
- You can freely choose the image name and tag.
- Run BabelBot in Docker:
docker run -e Telegram__ApiKey='<api key>' -e Telegram__AllowedUsers__1='<id>' -e DeepL__AuthKey='<auth key>' babelbot:local
- Docker v20+
- Make sure you have all prerequisites installed.
- Download and extract an archive of your desired version (or development branch), or
git clone
the repository into a path of your choice. - Create a
babelbot-values.yaml
(details about which values to provide) - Run the following command:
helm upgrade --install -n babelbot --create-namespace babelbot ./helm -f ./babelbot-values.yaml
- Helm v3
BabelBot uses the configuration facilities provided by .NET Core.
This means configuration can be applied in different ways:
- Changing the values inside
appsettings.json
- Setting environment variables (useful for cloud deployments)
- Using user secrets (only during development)
The required configuration values are documented in the table below.
Key (appsettings.json ) |
Key (Environment) | Type | Description | Default | Required |
---|---|---|---|---|---|
DeepL:AuthKey | DeepL__AuthKey | string | Your DeepL API auth key | empty | true if DeepL is used |
DeepL:DefaultTargetLanguageCode | DeepL__DefaultTargetLanguageCode | string | The target language for DeepL translations (see here for a list of supported values) | en-GB |
false |
Telegram:ApiKey | Telegram__ApiKey | string | Your Telegram bot's API key | empty | true if Telegram is used |
Telegram:AllowedUsers | Telegram__AllowedUsers | array of long | List of Telegram user IDs allowed to use the bot | empty | true if Telegram is used |
Telegram:OnlyReactToAllowedUsers | Telegram__OnlyReactToAllowedUsers | boolean | When true , the bot ignores all unknown users |
true |
false |
Worker:Receivers | Worker__Receivers | array of string | List active receivers (instant messengers) | ["Telegram"] |
true |
Worker:Translator | Worker__Translator | string | Translation API to be used | "DeepL" |
true |
Some of the configuration parameters are arrays. You can set those with environment variables using the following syntax:
Example
Telegram__AllowedUsers__1=4711
Telegram__AllowedUsers__2=420420
As long as the program is running in the Development environment, you can use the Secret Manager built into dotnet.
Set your API tokens (and other options) with the dotnet
command, like this:
dotnet user-secrets set "DeepL:AuthKey" "1234-5678"
They will persist through checkouts and are applied after appsettings.json
and environment variables.
- DeepL API Signup - Sign up for DeepL API access here
- DeepL API Docs - Here you can find a list of target language codes supported by DeepL
- Telegram Botfather - Register your Telegram bot here
Contributions are always welcome!
See CONTRIBUTING.md for ways to get started.
Please adhere to this project's code of conduct.
Massive thanks to (amongst many more) the following projects for making this possible:
- Telegram.Bot for providing a really nice MIT-licensed API library for .NET
- DeepL for creating a fantastic translation service and providing a .NET library for it
This software is provided without warranty or implicit or explicit support.
If you believe you have found an issue (very likely), please issue a bug report as detailed in the contribution guidelines.
In very serious cases, you can send a mail to babelbot@kaputty.de and I'll try to get back to you.
Please note that I do not provide support for misconfigurations or missing installed dependencies.