RainEggplant / chatgpt-telegram-bot

A ChatGPT bot for Telegram based on Node.js. Support both browserless and browser-base APIs.
MIT License
323 stars 97 forks source link

Doesn't display "[ ]" in chat. #8

Closed imba-pericia closed 1 year ago

imba-pericia commented 1 year ago

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.',
RainEggplant commented 1 year ago

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

imba-pericia commented 1 year ago

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.

almightyguy commented 1 year ago

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, { ...