024-08-02 16:53:26,709 (init.py:1083 MainThread) ERROR - TeleBot: “Threaded polling…
- User
024-08-02 16:53:26,709 (init.py:1083 MainThread) ERROR - TeleBot: “Threaded polling exception: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message” 2024-08-02 16:53:26,711 (init.py:1085 MainThread) ERROR - TeleBot: “Exception traceback: Traceback (most recent call last): File “C:\Users\Zeto\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot_init_.py”, line 1074, in _threaded_polling self.worker_pool.raise_exceptions() File “C:\Users\Zeto\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\util.py”, line 147, in raise_exceptions raise self.exception_info File “C:\Users\Zeto\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\util.py”, line 90, in run task(*args, **kwargs) File "C:\Users\Zeto\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot_init.py”, line 6770, in run_middlewares_and_handler result = handler’function’ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “E:\N_project\trans.py”, line 62, in callback_inline bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, File "C:\Users\Zeto\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot_init.py", line 3826, in edit_message_text result = apihelper.edit_message_text(self.token, text, chat_id, message_id, inline_message_id, parse_mode, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “C:\Users\Zeto\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\apihelper.py”, line 1320, in edit_message_text return make_request(token, method_url, params=payload, method=‘post’) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “C:\Users\Zeto\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\apihelper.py”, line 162, in make_request json_result = check_result(method_name, result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “C:\Users\Zeto\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\apihelper.py”, line 189, in check_result raise ApiTelegramException(method_name, result, result_json) telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message "
import telebot from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton from deep_translator import GoogleTranslator import emoji
API_TOKEN = ‘YOUR_API_TOKEN’ bot = telebot.TeleBot(API_TOKEN)
Константы для языков и их эмодзи
LANGUAGES = { ‘en’: ‘Английский 🇬🇧’, ‘ru’: ‘Русский 🇷🇺’, ‘es’: ‘Испанский 🇪🇸’, ‘fr’: ‘Французский 🇫🇷’, ‘de’: ‘Немецкий 🇩🇪’ }
source_lang = ‘ru’ target_lang = ‘en’
def translate_text(text, source_language, target_language): translator = GoogleTranslator(source=source_language, target=target_language) return translator.translate(text)
- Assistant