Skip to content

A Discord bot that allows people from all over the world to communicate!

Notifications You must be signed in to change notification settings

Micha-ohne-el/transl

Repository files navigation

TransL

A Discord bot that allows people from all over the world to communicate!
It uses the excellent DeepL Translator for maximum translation accuracy.

TransL.Demo.webm

Features

TransL is designed so that all the text in your server is in the same language. You can set your preferred server language through a command, and all messages will – by default – be translated into it.

If a message happens to be written in a wrong language, you can right-click it and translate it for yourself after the fact.

All commands, parameters, options, etc. are available in all Discord-supported languages, so users can always read them. They all are shown in different languages depending on what language a user has selected in their Discord settings.

Supported languages

TransL supports all languages DeepL supports. Currently, that's these:

  • Bulgarian
  • Chinese
  • Czech
  • Danish
  • Dutch
  • English (translating to English, you can choose between American and Βritish English)
  • Estonian
  • Finnish
  • French
  • German
  • Greek
  • Hungarian
  • Indonesian
  • Italian
  • Japanese
  • Korean
  • Latvian
  • Lithuanian
  • Norwegian
  • Polish
  • Portuguese (translating to Portuguese, you can choose between Portuguese for Portugal or Brazil)
  • Romanian
  • Russian
  • Slovak
  • Slovenian
  • Spanish
  • Swedish
  • Turkish
  • Ukrainian

Of course, it can also auto-detect the input language.

For any questions regarding TransL, feel free to join the support server.

Please read the Terms of Service before adding the bot to your server.

Development setup

Prerequisites

  • A PostgreSQL database (running locally or on a server)
  • IntelliJ IDEA (recommended, but other IDEs/editors will work too)

Steps

  1. Create a Discord Application and add a bot user to it. Make sure to save the bot token somewhere secure.
  2. Create a DeepL Developer Account. The free tier will be more than enough. Save the authentication key, just like the Discord bot token.
  3. Clone this repository to your local computer.
  4. Create a new file in the project root directory called .env, with the following configs:
    # The bot token for your application, which you get from the Discord Developer Portal after creating a bot account.
    TRANSL_DISCORD_BOT_TOKEN="..."
    
    # The authentication key for accessing DeepL, which you get after creating a DeepL Developer Account.
    TRANSL_DEEPL_AUTH_KEY="..."
    
    # The host (name, port, and path if needed) to the PostgreSQL database cluster.
    TRANSL_DB_HOST="localhost:5432" # this is the default after installing PostgreSQL locally
    
    # The name of the database.
    TRANSL_DB_NAME="transl"
    POSTGRES_DB="transl"
    
    # The username of the database user.
    TRANSL_DB_USERNAME="transl"
    POSTGRES_USER="transl"
    
    # The password of the database user.
    TRANSL_DB_PASSWORD="..."
    POSTGRES_PASSWORD="..."
    
    # The Guild ID used for testing. If set, the bot will register all commands only to this guild, instead of globally.
    # This is important for testing, because guild commands update instantly, as opposed to global commands, which take up to 1 hour.
    # You can get this by enabling Developer Mode in your Discord settings (under Advanced) and then right-clicking a guild.
    TRANSL_TEST_GUILD="..."
    
  5. You can now start developing TransL!

Important note

When you first start TransL, it will try to translate all commands, parameters, choices, etc. to all languages. This can take a few minutes and will use up about 17500 characters off of your DeepL budget. All translations are cached persistently, so all later startups won't take nearly as long, and will not call DeepL anymore.

Deployment

Prerequisites

  1. Docker & Docker Compose

Steps

  1. Change TRANSL_DB_HOST="localhost:5432" to TRANSL_DB_HOST="db:5432" in .env
  2. docker compose build
  3. docker compose up
  4. All hail Docker 🙏