{"id":18479558,"url":"https://github.com/austins/discordtranslationbot","last_synced_at":"2025-04-08T16:30:28.331Z","repository":{"id":38463202,"uuid":"486945512","full_name":"austins/DiscordTranslationBot","owner":"austins","description":"A Discord bot that allows translations of messages in a Discord server (guild) using country flags and /translate command.","archived":false,"fork":false,"pushed_at":"2025-04-01T03:41:00.000Z","size":1070,"stargazers_count":12,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T16:20:33.568Z","etag":null,"topics":["aspnetcore","azure","azure-cognitive-services","azuretranslator","bot","cqrs","csharp","discord","discord-net","docker","libretranslate","mediatr","netcore","nsubstitute","shouldly","translate","translation","translator","tunit"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/austins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-29T11:24:34.000Z","updated_at":"2025-04-01T03:41:03.000Z","dependencies_parsed_at":"2023-10-17T07:02:36.681Z","dependency_job_id":"470e4166-564a-408e-bd06-800c9e3ef737","html_url":"https://github.com/austins/DiscordTranslationBot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austins%2FDiscordTranslationBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austins%2FDiscordTranslationBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austins%2FDiscordTranslationBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austins%2FDiscordTranslationBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austins","download_url":"https://codeload.github.com/austins/DiscordTranslationBot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247881731,"owners_count":21011919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","azure","azure-cognitive-services","azuretranslator","bot","cqrs","csharp","discord","discord-net","docker","libretranslate","mediatr","netcore","nsubstitute","shouldly","translate","translation","translator","tunit"],"created_at":"2024-11-06T12:15:22.838Z","updated_at":"2025-04-08T16:30:28.319Z","avatar_url":"https://github.com/austins.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord Translation Bot\n\n\u003cimg src=\"https://github.com/austins/DiscordTranslationBot/assets/1623983/96f1b58b-94f4-4df6-a81c-34e4f0342dc0\" align=\"right\" alt=\"Globe with flags\" /\u003e\n\nA Discord bot that allows translations of messages in a Discord server (guild) using country flags and `/translate`\ncommand, powered by .NET\nand [Discord.Net](https://github.com/discord-net/Discord.Net).\n\nIt supports the following translation providers, all of which are disabled by default, that run in the following order:\n\n1. [Azure Translator](https://azure.microsoft.com/en-us/services/cognitive-services/translator/) (has a free tier)\n2. [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) (free and open-source)\n\nIf any provider fails to provide a translation, the bot will use the next provider if any as a fallback. At least one\nprovider is required or else the app will exit with an error.\n\nWhich providers are enabled can be configured per the instructions below.\n\n## Requirements\n\n### Create a Discord Bot\n\n1. Go to the [Discord Developer Portal](https://discord.com/developers/applications) and create a new application with\n   the name you want the bot to have.\n2. Go to the \"Bot\" tab in the sidebar and create a bot. Take note of the bot token to use for development or production.\n   Check the setting for whether you want it to be a Public Bot or not.\n3. Enable \"Message Content Intent\" under _Privileged Gateway Intents_.\n4. Go to the \"OAuth2\" -\u003e \"URL Generator\" tab in the sidebar. Check the following scopes: `bot` and\n   permissions: `Send Messages`, `Manage Messages`, and `Read Message History`.\n5. Copy the Generated URL and open it in your browser to add the bot to your Discord server.\n\n### Optional: Run LibreTranslate\n\n1. Follow the steps\n   to [create and run a LibreTranslate Docker container](https://github.com/LibreTranslate/LibreTranslate#run-with-docker=).\n2. Optionally, you can mount the volumes `/root/.local/share/LibreTranslate` and `/root/.local/share/argos-translate` to\n   persist the language models. This is good for production.\n\n## Development\n\n1. Configure the user secrets file with the required environment variables. Example below:\n\n```json\n{\n  \"Discord\": {\n    \"BotToken\": \"\"\n  },\n  \"TranslationProviders\": {\n    \"AzureTranslator\": {\n      \"Enabled\": true,\n      \"ApiUrl\": \"https://api.cognitive.microsofttranslator.com\",\n      \"SecretKey\": \"\",\n      \"Region\": \"\"\n    },\n    \"LibreTranslate\": {\n      \"Enabled\": true,\n      \"ApiUrl\": \"http://localhost:5000\"\n    }\n  }\n}\n```\n\n2. Make sure that you've created a Discord bot and have configured at least one translation provider using the steps\n   above.\n\n## Deployment\n\n1. Build a Docker image with `docker build -t discordtranslationbot -f ./src/DiscordTranslationBot/Dockerfile .` in the directory that contains the `Dockerfile`.\n2. Create and run a container with `docker run discordtranslationbot` and the following environment variables\n   configured. Make sure that you've created a Discord bot and have configured at least one translation provider using\n   the steps above. Example below:\n\n```\nDiscord__BotToken=\nTranslationProviders__AzureTranslator__Enabled=true\nTranslationProviders__AzureTranslator__ApiUrl=https://api.cognitive.microsofttranslator.com\nTranslationProviders__AzureTranslator__SecretKey=\nTranslationProviders__AzureTranslator__Region=\nTranslationProviders__LibreTranslate__Enabled=true\nTranslationProviders__LibreTranslate__ApiUrl=http://localhost:5000\n```\n\n_All translation providers are disabled by default. Set the `TranslationProviders__ProviderName__Enabled` config setting\nto `true` for those you which to\nenable. When a provider is enabled, you must provide the related config settings for the provider or the app will exit\nwith an error._\n\n## Telemetry\n\nThis app logs general information, warnings, and errors that may occur during runtime, along with metrics and traces for\nperformance and detection of any issues from code or external calls; the bot does not log contents of messages.\n\nYou can configure the app to persist logging, metric, and trace output using the OpenTelemetry protocol by enabling the\nfollowing option via an environment variable:\n\n```\nTelemetry__Enabled=true\n```\n\nThen you'll need to configure the OpenTelemetry Exporter. Here are some example environment variables for a global\nendpoint:\n\n```\nOTEL_EXPORTER_OTLP_ENDPOINT=\nOTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf\nOTEL_EXPORTER_OTLP_HEADERS=\n```\n\nRefer to the [OpenTelemetry documentation](https://opentelemetry.io/docs/zero-code/net/configuration/#otlp) for other\nenvironment variables.\n\n## License\n\nSee LICENSE file in this repo.\n\nThis app has been developed by Austin S.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustins%2Fdiscordtranslationbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustins%2Fdiscordtranslationbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustins%2Fdiscordtranslationbot/lists"}