discord-translate-cmd-poc/README.md

2.0 KiB

Discord Bot Template

Translate command for Another Child Spring server

Command Usage

Name

translate - Translate a message into the selected language

Syntax

translate [lang] [message]

Description

The translate command will call the Deepl API to translate the message into the chosen lang. The lang parameter can simply be the destination language (source language is automatically detected) but if the user wants to specify the source language it can be formatted like so: src->dst

Limitation

  • Deepl API limit to 500.000 characters/month for the free version

Requirement

How to install

DeeplAPI

  1. Create an account on Deepl API
  2. Generate a token

Project

  1. Clone the repo
  2. Copy the config.exemple.toml and rename it config.toml
  3. Launch the docker container with make start or docker-compose up -d
  4. Go into the docker container with make shell or docker-compose exec discord-bot bash
  5. Install the dependencies: yarn install
  6. Compile typescript and run the bot with yarn dev

Notes

  • Configuration file format is TOML. It is a minimal configuration file format that's easy to read due to obvious semantics. TOML is designed to map unambiguously to a hash table. TOML should be easy to parse into data structures in a wide variety of languages. Read src/config.ts to see all possibilities.
  • Project use Inhibitor from Sheweny. Inhibitor is a kind of middleware for command. Inhibitors allow you to limit the use of a command, an event, or an interaction.

Contributions/License

This project has an AGPLv3 license. This project use the Sheweny framework with discord.js underlying and BinaryMuse/toml-node for configuration parsing. To communicate with DeeplAPI, project use the offical javascript wrapper.