FIX: telegram: Not all channel posts contain text (#34)
The `text` field is marked optional, and is not guaranteed to exist: https://core.telegram.org/bots/api#message We should silently ignore these actions (while responding with a positive acknowledgement) instead of throwing a `NoMethodError`.
This commit is contained in:
parent
6fcf381751
commit
05d4338a12
|
@ -29,7 +29,7 @@ module DiscourseChat::Provider::TelegramProvider
|
|||
|
||||
DiscourseChat::Provider::TelegramProvider.sendMessage(message)
|
||||
|
||||
elsif params.key?('channel_post') && params['channel_post']['text'].include?('/getchatid')
|
||||
elsif params.dig('channel_post', 'text')&.include?('/getchatid')
|
||||
chat_id = params['channel_post']['chat']['id']
|
||||
|
||||
message_text = I18n.t(
|
||||
|
|
Loading…
Reference in New Issue