Josin22 / TgTranslator

Telegram bot that removes language barrier between people in groups

Home Page:https://t.me/grouptranslator_bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ“™ TgTranslator

TgTranslator is a telegram bot that translates messages in groups. Try it for yourself: @grouptranslator_bot

Use it in your project support group, to study language with a tutor, and in many other ways!

alt text

3️⃣ Translation modes

This bot has 3 translation modes:

  1. Auto. This mode automatically translates all messages that do not match the language of the main group. In addition, the message should be less than the character limit (specified in appsettins.json -> TgTranslator -> CharLimit), should not be a command (for example: /help or .help for Userbots), and the group should not be in timeout.

  2. Forwards. Works like Auto, but translates only forwarded messages.

  3. Manual. Translates only after replying on message with !translate or bot username.

πŸ“™ Langauges

Bot has 65 languages supported by Google Translate.

alt text

βš™οΈ Bot settings

In many group bots you can call menu in group chat. This one works different: the /settings command works only in private messages. It returns the main menu with Inline buttons which are the list of available settings.

alt text

When you select an option, it offers you to choose chat where you send ready command, like @grouptranslator_bot set:mode=auto.

alt text

This may seem a bit complicated, but it creates a lot more flexibility for larger groups. Users won't be interrupted by large message with buttons, and also, you can create prepared configurations for multiple groups.

Menu is higly customizable, so it's not hard to add new options, or even implement it in your own project.

πŸ›  Tools that project uses

.NET Core β€” Cross-platform general-purpose development platform.

ASP.NET Core - A framework for

Telegram.Bot β€” .NET Client for Telegram Bot API.

PostgreSQL β€” Open Source relational database.

Yandex.Translate β€” Universal text translation tool that uses machine translation technology developed at Yandex.

Prometheus β€” Used for event monitoring and alerting.

▢️ Build

You need .NET Core SDK 3.1+. Download it here

You also need PostgreSQL to store groups settings. Learn more

  1. Clone repository and open directory:
    git clone https://github.com/Dubzer/TgTranslator.git && cd TgTranslator
  2. Build the project. You can also use portable mode, which doesn't require .NET runtime. Learn more
    dotnet publish -c Release

πŸ”§ Configuration

Bot configuration is located in appsettings.json

  • TgTranslator

    CharLimit β€” translation characters limit.

    BanTIme β€” timeout time when admin mutes bot. Bot will not check the messages language during the timeout. (in minutes)

  • Telegram

    Polling β€” defines, is bot getting updates by using polling, or webhooks.

    BotToken β€” token for Bot API (get in @BotFather)

  • Yandex

    TranslatorToken β€” token for Yandex.Translate API (get at https://translate.yandex.com/developers)

  • ConnectionStrings

    TgTranslatorContext β€” connection string for bot's Postgres database.

  • HelpMenu

    VideoUrl β€” public URL for video that sends on /help command. Has to be accessible from the web.

  • Kestrel

    Endpoints β€” endpoints for using webhooks and metrics.

  • Prometheus

    Login β€” Basic Auth login for Prometheus metrics.

    Password β€” Basic Auth password for Prometheus metrics.

  • Serilog

    Here you can set various serilog settings.

πŸ“ License

The project is licensed under the MIT license.

About

Telegram bot that removes language barrier between people in groups

https://t.me/grouptranslator_bot

License:MIT License


Languages

Language:C# 98.9%Language:JavaScript 1.1%