GNUWeeb / GNUWeebBot

High-performance bot Telegram, running on Linux environment, written in C.
GNU General Public License v2.0
13 stars 8 forks source link

[module] Translate API #16

Closed ammarfaizi2 closed 3 years ago

ammarfaizi2 commented 3 years ago

Deploy a translator API and implement translate module for the bot. We will utilize a scraper to gather the data from Google Translate.

Translate feature specification

  1. Translate command is any message that matches the following pattern:

    /^(?:\/|\!|\~|\.)?(?:t[rl])\s(\S+)\s(\S+)\s(.+)$/Usi
    • $1 is the code of source language.
    • $2 is the code of target language.
    • $3 is the text written in source language to be translated to target language.
  2. Available languages can be seen here: https://github.com/ammarfaizi2/GoogleTranslate/blob/master/README.md

  3. Source language ($1) may contain auto. Which means it uses auto detect mechanism in the Google Translate API.

Extra (translate replied message)

  1. Translate replied message command is any message that replies another message and matches the following pattern:
    /^(?:\/|\!|\~|\.)?(?:t[rl])(?:\s(\S+)\s(\S+))?$/Usi
    • $1 is the code of source language.
    • $2 is the code of target language.
    • Replied message is the text written in source language to be translated to target language.
    • $1 and $2 may be omitted, when they're omitted, the default value for $1 is auto and $2 is en.

Examples

  1. User A sends a message tr en id good morning, the bot must reply it with selamat pagi.
  2. User A sends a message Good morning, then User B replies to the message with tr en ja, the bot must reply user A message's with おはようございます.

TODO List

ammarfaizi2 commented 3 years ago

The translate replied message cannot be performed without finishing this issue https://github.com/GNUWeeb/GNUWeebBot/issues/17