Делаю бота который запрашивает информацию с игрового сервера и выводит ее пользователю. Но при написании любого никнейма (Например: NeModerator, айди которого 3395940) выдает ошибку:
2019-09-11 19:41:03,759 (util.py:65 WorkerThread1) ERROR - TeleBot:
"ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:\n[b\'{"ok":false,"error_code":400,"description":"Bad Request: can\\\'t parse entities: Can\\\'t find end of the entity starting at byte offset 203"}\']',)
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\telebot\util.py", line 59, in run
task(*args, **kwargs)
File "VimeInfo.py", line 361, in playerInfo
parse_mode="Markdown")
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\telebot\__init__.py", line 598, in send_message
reply_markup, parse_mode, disable_notification))
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\telebot\apihelper.py", line 140, in send_message
return _make_request(token, method_url, params=payload, method='post')
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\telebot\apihelper.py", line 56, in _make_request
return _check_result(method_name, result)['result']
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\telebot\apihelper.py", line 75, in _check_result
raise ApiException(msg, method_name, result)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: can\'t parse entities: Can\'t find end of the entity starting at byte offset 203"}']
"
2019-09-11 19:41:03,767 (__init__.py:417 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: can\'t parse entities: Can\'t find end of the entity starting at byte offset 203"}']"
Часть кода:
if message.text == "О игроке":
def playerInfo(message):
nickname = message.text
searchId = requests.get("https://api.vime.world/user/name/" +str(nickname))
forCheck = [x.get("username") for x in searchId.json()]
idPlayer = [x.get("id") for x in searchId.json()]
statsGet = requests.get("https://api.vime.world/user/" +str(idPlayer[0])+ "/stats")
username = statsGet.json()["user"].get("username")
level = statsGet.json()["user"].get("level")
rank = statsGet.json()["user"].get("rank")
guild = statsGet.json()["user"].get("guild").get("name")
guildLevel = statsGet.json()["user"].get("guild").get("level")
guildTag = statsGet.json()["user"].get("guild").get("tag")
guildAva = statsGet.json()["user"].get("guild").get("avatar_url")
bot.send_message(message.chat.id,
" 🗄️ О игроке *" +str(username)+ "*: \n 📄 Привилегия: *" +str(rank)+ "* \n 📄 Уровень: *" +str(level)+ "* \n 📁 Гильдия: *" +str(guild)+ "* \n 📄 Уровень: *" +str(guildLevel)+ "* \n 📄 Тег: *" +str(guildTag)+ "() [ ]() \n \n 🗄️ Статистика на режимах: ",
parse_mode="Markdown")
searchIf = bot.send_message(message.chat.id,
" ⚠️ Какой ник у игрока?")
bot.register_next_step_handler(searchIf, playerInfo)
Подскажите, пожалуйста, как решить проблему
*
. Telegram использует Markdown. Так как*
не закрыта, произошла ошибка парсинга.