Sign inSign up

codedead/discord-translate-bot

By codedead

•Updated about 2 years ago

A simple Discord bot that translates messages using the Google Translate API.

Image
Internet of things
Developer tools
Web servers
1

316

codedead/discord-translate-bot repository overview

⁠discord-translate-bot

A simple discord bot that translates messages using the Google Cloud Translation API.

⁠Commands / Interactions

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 the translate-text command. This command is only available to users with the ADMINISTRATOR permission.
  • !unregister - Unregister the translate-text command. This command is only available to users with the ADMINISTRATOR permission.

⁠Installation

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 is 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 run

To build a release version, run the following command:

cargo build --release

You can then run the release version using the following command:

./target/release/discord_translate_bot

⁠Dependencies

⁠About

This library is maintained by CodeDead. You can find more about us using the following links:

Copyright © 2024 CodeDead

Tag summary

Content type

Image

Digest

sha256:976e2c9cd…

Size

50.4 MB

Last updated

about 2 years ago

docker pull codedead/discord-translate-bot