Add support for edited messages (telegram)

This commit is contained in:
Wim 2017-04-15 19:07:35 +02:00
parent d1dd6c3440
commit 7469732bbc
2 changed files with 12 additions and 2 deletions

View File

@ -85,15 +85,17 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
if update.ChannelPost != nil { if update.ChannelPost != nil {
message = update.ChannelPost message = update.ChannelPost
} }
if update.EditedChannelPost != nil { if update.EditedChannelPost != nil && !b.Config.EditDisable {
message = update.EditedChannelPost message = update.EditedChannelPost
message.Text = message.Text + b.Config.EditSuffix
} }
// handle groups // handle groups
if update.Message != nil { if update.Message != nil {
message = update.Message message = update.Message
} }
if update.EditedMessage != nil { if update.EditedMessage != nil && !b.Config.EditDisable {
message = update.EditedMessage message = update.EditedMessage
message.Text = message.Text + b.Config.EditSuffix
} }
if message.From != nil { if message.From != nil {
username = message.From.FirstName username = message.From.FirstName

View File

@ -435,6 +435,14 @@ Token="Yourtokenhere"
#See https://core.telegram.org/bots/api#html-style #See https://core.telegram.org/bots/api#html-style
MessageFormat="" MessageFormat=""
#Disable sending of edits to other bridges
#OPTIONAL (default false)
EditDisable=false
#Message to be appended to every edited message
#OPTIONAL (default empty)
EditSuffix=" (edited)"
#Nicks you want to ignore. #Nicks you want to ignore.
#Messages from those users will not be sent to other bridges. #Messages from those users will not be sent to other bridges.
#OPTIONAL #OPTIONAL