July 5, 2023
Перевод текста с помощью Telegram бота!
from aiogram import Bot, Dispatcher, executor, types from aiogram.types import ContentTypes import translators as ts bot = Bot(token="TOKEN") dp = Dispatcher(bot=bot) @dp.message_handler(content_types=ContentTypes.TEXT) async def handle_translate_message(message: types.Message): translate_text = ts.translate_text(message.text, to_language='ru') await message.answer(translate_text) executor.start_polling(dp)
pip install aiogram==2.25.1 translators==5.7.9
https://t.me/PyDevPro