lorcalhost / BTB-manager-telegram

A feature packed but easy-to-use Telegram bot for remotely managing Binance Trade Bot instances
MIT License
389 stars 156 forks source link

Can't parse entities: character '-' is reserved and must be escaped with the preceding '\' #67

Closed SH-Stark closed 3 years ago

SH-Stark commented 3 years ago

Hello, I tried to run the bot for the first time and got these errors

2021-04-27 14:36:17,369 - btb_manager_telegram_logger - INFO - Retrieving Telegram token and chat_id from apprise.yml file.
2021-04-27 14:36:17,370 - btb_manager_telegram_logger - INFO - Successfully retrieved Telegram configuration. The bot will only respond to user in the chat with chat_id XXXXXXX
2021-04-27 14:36:18,372 - btb_manager_telegram_logger - INFO - Checking for updates.
2021-04-27 14:36:20,754 - apscheduler.scheduler - INFO - Scheduler started
2021-04-27 14:36:28,630 - btb_manager_telegram_logger - INFO - Started conversation.
2021-04-27 14:36:28,818 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/ext/dispatcher.py", line 442, in process_update
    handler.handle_update(update, self, check, context)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/ext/conversationhandler.py", line 549, in handle_update
    new_state = handler.handle_update(update, dispatcher, check_result, context)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/ext/handler.py", line 160, in handle_update
    return self.callback(update, context)
  File "/Users/XXXXXX/BTB-manager-telegram/btb_manager_telegram/handlers.py", line 251, in start
    update.message.reply_text(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/message.py", line 689, in reply_text
    return self.bot.send_message(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 127, in decorator
    result = func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 475, in send_message
    return self._message(  # type: ignore[return-value]
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 296, in _message
    result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 259, in _post
    return self.request.post(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/utils/request.py", line 349, in post
    result = self._request_wrapper(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/utils/request.py", line 272, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Can't parse entities: character '-' is reserved and must be escaped with the preceding '\'

Have you ever seen this error ? Cheers

lorcalhost commented 3 years ago

Potentially related to #65

When are you getting this error?

SH-Stark commented 3 years ago

Thanks for answering, I have it when I run: ➜ BTB-manager-telegram git:(main) python3 -m btb_manager_telegram

then on my bot I type /start

error then shows up

DmytroLitvinov commented 3 years ago

At that line of code is issue. Some problem with text.

lorcalhost commented 3 years ago

@DmytroLitvinov are you having this problem? I can't replicate on my installation.

lorcalhost commented 3 years ago

@SH-Stark Could you please provide your telegram username? Does it contain any - or other special characters?

DmytroLitvinov commented 3 years ago

No, I don't have such issue.

SH-Stark commented 3 years ago

My telegram username is @shstark :)

SH-Stark commented 3 years ago

Problem fixed, my First Name had a "-", removing it seems to solve the issue.

lorcalhost commented 3 years ago

@SH-Stark perfect, thanks for helping us pinpoint the issue.
I will push a fix shortly.