lntechnical2 / google-translater- Goto Github PK
View Code? Open in Web Editor NEWGoogle Translater Telegram bot
License: MIT License
Google Translater Telegram bot
License: MIT License
Could an Inline mode be implemented?
The bot would be perfect there.
if it works, I collaborate this code that could be implemented.
""" Google Translate
Commands:
.tr LanguageCode as reply to a message
.tr LangaugeCode | text to translate"""
import emoji
from googletrans import Translator
from userbot import bot
from userbot.system import dev_cmd
@bot.on(dev_cmd("tr ?(.*)"))
async def _(event):
if event.fwd_from:
return
if "trim" in event.raw_text:
# https://t.me/c/1220993104/192075
return
input_str = event.pattern_match.group(1)
if event.reply_to_msg_id:
previous_message = await event.get_reply_message()
text = previous_message.message
lan = input_str or "it"
elif "|" in input_str:
lan, text = input_str.split("|")
else:
await event.edit("`.tr LanguageCode` **in risposta a messaggi**")
return
text = emoji.demojize(text.strip())
lan = lan.strip()
translator = Translator()
try:
translated = translator.translate(text, dest=lan)
after_tr_text = translated.text
# TODO: emojify the :
# either here, or before translation
output_str = """**TRADUZIONE** da {} a {}
{}""".format(
translated.src,
lan,
after_tr_text
)
await event.edit(output_str)
except Exception as exc:
await event.edit(str(exc))
I have created this bot but bot not support 100 + language only support 5 language
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.