Translate any text to Ukrainian voice speech with telegram bot

I present to you a bot for Telegram, which translate your any language text into Ukrainian voice speech🇺🇦!

Try it now >> @inukrainian <<

The following libraries have been used:

  • aiogram – Async telegram bot framework
  • googletrans – google translator ajax api
  • gtts – voice synthesizer from google translator

There is main function code:

async def command_start(message : types.Message):
    userid =
    user_first_name = str(
    user_last_name = str(
    user_username = str(
    typed = message.text
    translated = translator.translate(typed, dest='uk')
    strippedtext = translated.text[:200]
    myobj = gTTS(text=strippedtext, lang=language, slow=False)"{userid}welcome.mp3")
    os.system(f'cmd /c ffmpeg -i {userid}welcome.mp3 -c:a libopus -b:a 32k -vbr on -compression_level 10 -frame_duration 60 -application voip -y {userid}message.ogg""')
    await bot.send_voice(, open(f"{userid}message.ogg", "rb"))
    timenow =
    with open(logfilename, 'a', encoding="utf-8") as file_object:
         file_object.write(f'"{timenow}","{userid}","{user_username}","{user_first_name} {user_last_name}","request","{message.text}"\n')


See also  iLo server power on Python script for Telegram Bot
Author: admin

1 thought on “Translate any text to Ukrainian voice speech with telegram bot

Leave a Reply

Your email address will not be published. Required fields are marked *