A simple discord bot that translates messages using the Google Cloud Translation API.
The bot has the following commands:
!translate [target-language]- Reply to any message to translate it to the target language. If the target language is not specified, the bot will translate the message to English./translate-text [message] [target-language]- Translate the provided message to the target language. If the target language is not specified, the bot will translate the message to English.!help- Display a list of available commands and useful information.!register- Register thetranslate-textcommand. This command is only available to users with theADMINISTRATORpermission.!unregister- Unregister thetranslate-textcommand. This command is only available to users with theADMINISTRATORpermission.
In order to run this bot, you need to have a Google Cloud account and a project with the Cloud Translation API enabled. You also need to have a Discord bot token. You can get one by creating a new bot in the Discord Developer Portal.
A .env file or environment variables are required to run the bot. The file should contain the following variables:
DISCORD_TOKEN=your_discord_bot_token
GOOGLE_TRANSLATE_TOKEN=your_google_cloud_translation_api_token
# Optionally, you can change the log level
RUST_LOG=info # or debug, trace, etc.You can install and run the bot by cloning the repository and running the following command:
cargo runTo build a release version, run the following command:
cargo build --releaseYou can then run the release version using the following command:
./target/release/discord_translate_botThis library is maintained by CodeDead. You can find more about us using the following links:
Copyright © 2024 CodeDead