mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-14 03:50:26 +00:00
Handle channel posts correctly (telegram)
This commit is contained in:
parent
cd1fd1bb7c
commit
b24a47ad7f
@ -121,7 +121,7 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
|||||||
for update := range updates {
|
for update := range updates {
|
||||||
b.Log.Debugf("== Receiving event: %#v", update.Message)
|
b.Log.Debugf("== Receiving event: %#v", update.Message)
|
||||||
|
|
||||||
if update.Message == nil && update.ChannelPost == nil {
|
if update.Message == nil && update.ChannelPost == nil && update.EditedMessage == nil && update.EditedChannelPost == nil {
|
||||||
b.Log.Error("Getting nil messages, this shouldn't happen.")
|
b.Log.Error("Getting nil messages, this shouldn't happen.")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -133,6 +133,7 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
|||||||
// handle channels
|
// handle channels
|
||||||
if update.ChannelPost != nil {
|
if update.ChannelPost != nil {
|
||||||
message = update.ChannelPost
|
message = update.ChannelPost
|
||||||
|
rmsg.Text = message.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
// edited channel message
|
// edited channel message
|
||||||
@ -144,6 +145,7 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
|||||||
// handle groups
|
// handle groups
|
||||||
if update.Message != nil {
|
if update.Message != nil {
|
||||||
message = update.Message
|
message = update.Message
|
||||||
|
rmsg.Text = message.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
// edited group message
|
// edited group message
|
||||||
@ -168,7 +170,6 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
|||||||
rmsg.Username = message.From.FirstName
|
rmsg.Username = message.From.FirstName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rmsg.Text += message.Text
|
|
||||||
// only download avatars if we have a place to upload them (configured mediaserver)
|
// only download avatars if we have a place to upload them (configured mediaserver)
|
||||||
if b.General.MediaServerUpload != "" {
|
if b.General.MediaServerUpload != "" {
|
||||||
b.handleDownloadAvatar(message.From.ID, rmsg.Channel)
|
b.handleDownloadAvatar(message.From.ID, rmsg.Channel)
|
||||||
|
Loading…
Reference in New Issue
Block a user