lbb00 / hubot-telegram-better

A better hubot telegram adapter.
MIT License
10 stars 3 forks source link

Bad Entities... #12

Open surfer190 opened 5 years ago

surfer190 commented 5 years ago

Once again the bad entities issue that the telegram API responds with prevents the message from being sent.

Reproduce this error

Speak to your bot

/echo _hello_world_

Nothing will happen, if you check the logs you will see:

[Fri Jun 21 2019 13:16:45 GMT+0200 (South Africa Standard Time)] ERROR Error: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 12
  at Function.TelegramBot.error (/home/ubuntu/hubot/node_modules/telegrambot/lib/telegrambot.js:26:15)
  at Request._callback (/home/ubuntu/hubot/node_modules/telegrambot/lib/telegrambot.js:47:66)
  at Request.self.callback (/home/ubuntu/hubot/node_modules/request/request.js:185:22)
  at Request.emit (events.js:189:13)
  at Request.<anonymous> (/home/ubuntu/hubot/node_modules/request/request.js:1161:10)
  at Request.emit (events.js:189:13)
  at IncomingMessage.<anonymous> (/home/ubuntu/hubot/node_modules/request/request.js:1083:12)
  at Object.onceWrapper (events.js:277:13)
  at IncomingMessage.emit (events.js:194:15)
  at endReadableNT (_stream_readable.js:1125:12)
  at process._tickCallback (internal/process/next_tick.js:63:19)

My opinion is that a message should always be sent, no matter what. So the bad entities error should be caught and then an attempt to clean the input of just send the message without markdown - as straight text.

lbb00 commented 5 years ago

Ok, I will fix. A bad message is I can't connect telegram server by the script because of Chinese network use GFW. This fix will be delayed.

surfer190 commented 5 years ago

Also, @loveonelong I noticed the docs may be wrong

I had to use this package with:

bin/hubot -a telegram-better

I noticed it was not responding to the help command. The issue above is actually a problem with hubot-telegram but is probably also in this package.