You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When money is transferred from one to another user account, for whatever reason, the transaction is first announced in the log file, then performed in the database, then again accepted in the log file. Lastly, the bot sends confirmation messages to the chats defined in the config file. The last step may break the bot if the username or user's name contains special characters like underscore, since that transaction confirmation message is parsed as Markdown. Note that it only breaks when the number of tokens that can be interpreted as Markdown is odd, see below.
The above problem is not critical for single transactions, since logging of those is done after everything else. However, this is a critical problem for communisms where lots of transactions might be performed at once.
Sample traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/telegram/ext/dispatcher.py", line 340, in process_update
handler.handle_update(update, self, check, context)
File "/usr/local/lib/python3.7/dist-packages/telegram/ext/handler.py", line 119, in handle_update
return self.callback(update, context)
File "/home/matebot/MateBot/mate_bot/commands/base.py", line 216, in __call__
self.run(args, update)
File "/home/matebot/MateBot/mate_bot/commands/consume.py", line 77, in run
update.effective_message.bot
File "/home/matebot/MateBot/mate_bot/state/transactions.py", line 214, in commit
File "/home/matebot/MateBot/mate_bot/state/transactions.py", line 290, in log_message
transaction_logging = [config["chats"]["transactions"]]
File "<decorator-gen-2>", line 2, in send_message
File "/usr/local/lib/python3.7/dist-packages/telegram/bot.py", line 67, in decorator
result = func(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/telegram/bot.py", line 348, in send_message
timeout=timeout, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/telegram/bot.py", line 175, in _message
result = self._request.post(url, data, timeout=timeout)
File "/usr/local/lib/python3.7/dist-packages/telegram/utils/request.py", line 333, in post
**urlopen_kwargs)
File "/usr/local/lib/python3.7/dist-packages/telegram/utils/request.py", line 244, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Can't parse entities: can't find end of the entity starting at byte offset 52
The text was updated successfully, but these errors were encountered:
The exact same problem occurs when using any other command which replies with Markdown content and contains stuff like underscores. It could, for example, also happen for /balance @some_user if @some_user doesn't exist. To make it worse, the caller of that command wouldn't even get a response.
After the rewrite using the core API, this issue may be fixed. This has to be evaluated. For example, closing a communism triggers the transaction processing in the backend; therefore the critical bug of broken log messages doesn't exist anymore. Other bugs of this kind may still exist, though they only affect the representation.
When money is transferred from one to another user account, for whatever reason, the transaction is first announced in the log file, then performed in the database, then again accepted in the log file. Lastly, the bot sends confirmation messages to the chats defined in the config file. The last step may break the bot if the username or user's name contains special characters like underscore, since that transaction confirmation message is parsed as Markdown. Note that it only breaks when the number of tokens that can be interpreted as Markdown is odd, see below.
The above problem is not critical for single transactions, since logging of those is done after everything else. However, this is a critical problem for communisms where lots of transactions might be performed at once.
Sample traceback:
The text was updated successfully, but these errors were encountered: