RainEggplant/chatgpt-telegram-bot

Doesn't display "[ ]" in chat.

Closed this issue · 3 comments

I use api v4
It's on telegram:

How use operator [ ] in bash.

You can use the operator in bash for performing conditional commands, checking argument equality, and more. For example, you can use the operator to check the equality of two arguments, e.g.:
$a == $b # Checks if arguments $a and $b are equal. You can also use it to compare strings and other values, as well as to perform logical operations such as OR and AND.

This is in the terminal output:

text: 'You can use the [ ] operator in bash for performing conditional commands, checking argument equality, and more. For example, you can use the [ ] operator to check the equality of two arguments, e.g.: \n' +
'[ $a == $b ] # Checks if arguments $a and $b are equal. You can also use it to compare strings and other values, as well as to perform logical operations such as OR and AND.',

Telegram's text parsing treats [ ] as markdown syntax. We may need to escape these characters before sending the text to Telegram.

Screenshot_20230217_193912
I tried to add to the request - "code - monospace" The crutch is peculiar and does not always work, but it works)
On the screen is just an experiment with monspace.

I'm using chatgpt-telegram-bot well and I hope it helps.
Let's use it as below temporarily.

chatgpt-telegram-bot\src\handlers\chat.ts
edit near line 83
...
try {

text = text.replace(/\[/g, '\\[')

const res = await this._bot.editMessageText(text, {
...