A Discord bot that allows users to translate messages using DeepL translation service via a right-click context menu.
- Right-click on any message and select "Translate with DeepL"
- Automatic source language detection
- Translates to the language based on the user's Discord locale
- Simple, intuitive interface through Discord's context menu
- Node.js (version 16.9.0 or higher) - Not needed if using Docker
- A Discord Bot Token
- A DeepL API Key
- Docker and Docker Compose (if running with Docker)
-
Clone this repository:
git clone <your-repository-url> cd deepl
-
Install dependencies:
npm install
-
Create a
.envfile in the root directory:cp .env.example .env
-
Edit the
.envfile with your actual Discord token and DeepL API key.
-
Clone this repository:
git clone <your-repository-url> cd deepl
-
Create a
.envfile in the root directory:cp .env.example .env
-
Edit the
.envfile with your actual Discord token and DeepL API key.
-
Build the TypeScript code:
npm run build
-
Start the bot:
npm start
-
For development with auto-reload:
npm run dev
-
Build and start the Docker container:
docker compose up -d
This will build the Docker image and start the container in detached mode.
-
View logs:
docker compose logs -f
-
Stop the container:
docker compose down
-
Rebuild the container (after code changes):
docker compose up -d --build
- Go to the Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" tab and click "Add Bot"
- Under the "Privileged Gateway Intents" section, enable:
- Server Members Intent
- Message Content Intent
- Copy the bot token and add it to your
.envfile - Go to the "OAuth2" tab, then "URL Generator"
- Select the following scopes:
botapplications.commands
- For bot permissions, select:
- Read Messages/View Channels
- Send Messages
- Read Message History
- Use Application Commands
- Use the generated URL to invite the bot to your server
- Create an account at DeepL API
- Subscribe to a plan (they have a free tier with up to 500,000 characters per month)
- Get your API key from the account dashboard
- Add the API key to your
.envfile
Once the bot is in your server and running:
- Right-click on any message
- In the Apps submenu, select "Translate with DeepL"
- The bot will respond with the original text and its translation
The bot automatically detects the source language and translates to the language matching the user's Discord locale. Supported target languages include:
- English (American and British)
- Spanish
- French
- German
- Italian
- Japanese
- Korean
- Portuguese (Brazilian)
- Russian
- Chinese