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.
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
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: