When the bot sends a message that has unclosed/invalid markdown and parse_mode is set to Markdown. An error is raised from the telegram api and the message is never sent.
This is a problem, as the message delivery should be our number 1 concern.
My proposal is that a check be made in the send function:
###*
# Send a message to a specific room via the Telegram API
###
send: (envelope, strings...) ->
self = @
text = strings.join()
data = @applyExtraOptions({chat_id: envelope.room, text: text}, envelope.telegram);
@apiSend data, (err, message) =>
if (err)
@robot.logger.debug "Error received: " + err
found = err.search /entities/
if (found > 0)
# send the message again without markdown set
...
self.emit 'error', err
else
self.robot.logger.info "Sending message to room: " + envelope.room
Please look over and add to this code if you think it is an acceptable way, if not let me know ways to improve it.
Also, @gburgett if you have a minute please let me know your thoughts.
When the bot sends a message that has unclosed/invalid markdown and
parse_mode
is set toMarkdown
. An error is raised from the telegram api and the message is never sent.This is a problem, as the message delivery should be our number 1 concern.
My proposal is that a check be made in the
send
function:Please look over and add to this code if you think it is an acceptable way, if not let me know ways to improve it. Also, @gburgett if you have a minute please let me know your thoughts.