lnp2pBot / bot

Peer-to-peer lightning network telegram bot
MIT License
206 stars 105 forks source link

Issue 543 error displaying username with underscore #586

Closed danfercf1 closed 1 month ago

danfercf1 commented 2 months ago

Added a method to escape underscores when an user of Telegram has underscore in its username, this is necessary due the configuration for the message when it's set to "{ parse_mode: 'MarkdownV2' }". Additionally I added the necessary tests to verify the fix. I added the telegram id to the translation message for Spanish and English, I can update the other languages after I receive the ok for the current message for these first ones that I updated.

Fixes #543

danfercf1 commented 1 month ago

After the admin takes the dispute I got this error and the message with order details is not sent:

[2024-09-05T14:49:35.397-03:00] error: 400: Bad Request: can't parse entities: Can't find end of Italic entity at byte offset 1203 Error: 400: Bad Request: can't parse entities: Can't find end of Italic entity at byte offset 1203
    at Telegram.callApi (/home/grunch/dev/bot-danfer/node_modules/telegraf/lib/core/network/client.js:315:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async exports.disputeData (/home/grunch/dev/bot-danfer/bot/modules/dispute/messages.js:102:5)
    at async exports.takeDispute (/home/grunch/dev/bot-danfer/bot/modules/dispute/actions.js:39:3)
    at async execute (/home/grunch/dev/bot-danfer/node_modules/telegraf/lib/composer.js:518:17)
    at async /home/grunch/dev/bot-danfer/node_modules/telegraf/lib/composer.js:519:21

@grunch, I will take a look, could you provide me the usernames that you are testing?

grunch commented 1 month ago

After the admin takes the dispute I got this error and the message with order details is not sent:

[2024-09-05T14:49:35.397-03:00] error: 400: Bad Request: can't parse entities: Can't find end of Italic entity at byte offset 1203 Error: 400: Bad Request: can't parse entities: Can't find end of Italic entity at byte offset 1203
    at Telegram.callApi (/home/grunch/dev/bot-danfer/node_modules/telegraf/lib/core/network/client.js:315:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async exports.disputeData (/home/grunch/dev/bot-danfer/bot/modules/dispute/messages.js:102:5)
    at async exports.takeDispute (/home/grunch/dev/bot-danfer/bot/modules/dispute/actions.js:39:3)
    at async execute (/home/grunch/dev/bot-danfer/node_modules/telegraf/lib/composer.js:518:17)
    at async /home/grunch/dev/bot-danfer/node_modules/telegraf/lib/composer.js:519:21

@grunch, I will take a look, could you provide me the usernames that you are testing?

users: @negrunch and @xxx_yyy

danfercf1 commented 1 month ago

After the admin takes the dispute I got this error and the message with order details is not sent:

[2024-09-05T14:49:35.397-03:00] error: 400: Bad Request: can't parse entities: Can't find end of Italic entity at byte offset 1203 Error: 400: Bad Request: can't parse entities: Can't find end of Italic entity at byte offset 1203
    at Telegram.callApi (/home/grunch/dev/bot-danfer/node_modules/telegraf/lib/core/network/client.js:315:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async exports.disputeData (/home/grunch/dev/bot-danfer/bot/modules/dispute/messages.js:102:5)
    at async exports.takeDispute (/home/grunch/dev/bot-danfer/bot/modules/dispute/actions.js:39:3)
    at async execute (/home/grunch/dev/bot-danfer/node_modules/telegraf/lib/composer.js:518:17)
    at async /home/grunch/dev/bot-danfer/node_modules/telegraf/lib/composer.js:519:21

@grunch, I will take a look, could you provide me the usernames that you are testing?

users: @negrunch and @xxx_yyy

I will take a look, thanks

danfercf1 commented 1 month ago

After the admin takes the dispute I got this error and the message with order details is not sent:

[2024-09-05T14:49:35.397-03:00] error: 400: Bad Request: can't parse entities: Can't find end of Italic entity at byte offset 1203 Error: 400: Bad Request: can't parse entities: Can't find end of Italic entity at byte offset 1203
    at Telegram.callApi (/home/grunch/dev/bot-danfer/node_modules/telegraf/lib/core/network/client.js:315:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async exports.disputeData (/home/grunch/dev/bot-danfer/bot/modules/dispute/messages.js:102:5)
    at async exports.takeDispute (/home/grunch/dev/bot-danfer/bot/modules/dispute/actions.js:39:3)
    at async execute (/home/grunch/dev/bot-danfer/node_modules/telegraf/lib/composer.js:518:17)
    at async /home/grunch/dev/bot-danfer/node_modules/telegraf/lib/composer.js:519:21

@grunch, I will take a look, could you provide me the usernames that you are testing?

users: @negrunch and @xxx_yyy

I will take a look, thanks

The issue was fixed

grunch commented 1 month ago

I can update the other languages after I receive the ok for the current message for these first ones that I updated.

After you push this commit it will be merged