Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matterbridge reposts image from others back as me #1088

Closed
genotrance opened this issue Apr 12, 2020 · 2 comments
Closed

Matterbridge reposts image from others back as me #1088

genotrance opened this issue Apr 12, 2020 · 2 comments
Labels

Comments

@genotrance
Copy link

I have a two way bridge between Telegram and Slack and anytime someone posts an image on Telegram, my bot posts it back.

This is a recent issue and didn't happen before. A related issue I had opened earlier is #481.

To Reproduce
Bridge Telegram to Slack, wait for someone to post an image with caption. Your bot will post it back to the channel.

I've attached debug logs for reference.

Environment (please complete the following information):

OS: Ubuntu
Matterbridge version: v1.17.2 linux 64-bit
[0021] DEBUG slack:        == Receiving event &slack.MessageEvent{Msg:slack.Msg{ClientMsgID:"5de01a0e-e794-4411-ba35-bbcfeed4ef01", Type:"message", Channel:"CHANNEL1", User:"USER1", Text:"i've enabled debug to report an issue, can someone please post another image?", Timestamp:"1586707882.139300", ThreadTimestamp:"", IsStarred:false, PinnedTo:[]string(nil), Attachments:[]slack.Attachment(nil), Edited:(*slack.Edited)(nil), LastRead:"", Subscribed:false, UnreadCount:0, SubType:"", Hidden:false, DeletedTimestamp:"", EventTimestamp:"1586707882.139300", BotID:"", Username:"", Icons:(*slack.Icon)(nil), Inviter:"", Topic:"", Purpose:"", Name:"", OldName:"", Members:[]string(nil), ReplyCount:0, Replies:[]slack.Reply(nil), ParentUserId:"", Files:[]slack.File(nil), Upload:false, Comment:(*slack.Comment)(nil), ItemType:"", ReplyTo:0, Team:"TEAM1", Reactions:[]slack.ItemReaction(nil), ResponseType:"", ReplaceOriginal:false, DeleteOriginal:false, Blocks:slack.Blocks{BlockSet:[]slack.Block{(*slack.UnknownBlock)(0xc000275b20)}}}, SubMessage:(*slack.Msg)(nil), PreviousMessage:(*slack.Msg)(nil)}
[0021] DEBUG slack:        <= Sending message from genotrance on slack.site to gateway
[0021] DEBUG slack:        <= Message is &config.Message{Text:"i've enabled debug to report an issue, can someone please post another image?", Channel:"nim-telegram", Username:"genotrance", UserID:"USER1", Avatar:"https://avatars.slack-edge.com/2014-08-18/2554478722_48.jpg", Account:"slack.site", Event:"", Protocol:"slack", Gateway:"", ParentID:"", Timestamp:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}, ID:"1586707882.139300", Extra:map[string][]interface {}{}}
[0021] DEBUG gateway:      => Sending config.Message{Text:"i've enabled debug to report an issue, can someone please post another image?", Channel:"nim-telegram", Username:"genotrance", UserID:"USER1", Avatar:"https://avatars.slack-edge.com/2014-08-18/2554478722_48.jpg", Account:"slack.site", Event:"", Protocol:"slack", Gateway:"nim-telegram", ParentID:"", Timestamp:time.Time{wall:0xbf9ced4a89de0ba6, ext:21541633273, loc:(*time.Location)(0x3082420)}, ID:"1586707882.139300", Extra:map[string][]interface {}{}} from slack.site (nim-telegram) to telegram.nim (CID)
[0021] DEBUG telegram:     => Receiving config.Message{Text:"i've enabled debug to report an issue, can someone please post another image?", Channel:"CID", Username:"", UserID:"USER1", Avatar:"https://avatars.slack-edge.com/2014-08-18/2554478722_48.jpg", Account:"slack.site", Event:"", Protocol:"slack", Gateway:"nim-telegram", ParentID:"", Timestamp:time.Time{wall:0xbf9ced4a89de0ba6, ext:21541633273, loc:(*time.Location)(0x3082420)}, ID:"", Extra:map[string][]interface {}{}}
[0022] DEBUG gateway:      mID telegram.nim: 32323
[0055] DEBUG telegram:     == Receiving event: &tgbotapi.Message{MessageID:32324, From:(*tgbotapi.User)(0xc000438050), Date:1586707915, Chat:(*tgbotapi.Chat)(0xc000462b40), ForwardFrom:(*tgbotapi.User)(nil), ForwardFromChat:(*tgbotapi.Chat)(nil), ForwardFromMessageID:0, ForwardDate:0, ReplyToMessage:(*tgbotapi.Message)(nil), EditDate:0, Text:"", Entities:(*[]tgbotapi.MessageEntity)(nil), Audio:(*tgbotapi.Audio)(nil), Document:(*tgbotapi.Document)(nil), Animation:(*tgbotapi.ChatAnimation)(nil), Game:(*tgbotapi.Game)(nil), Photo:(*[]tgbotapi.PhotoSize)(0xc0004fb1e0), Sticker:(*tgbotapi.Sticker)(nil), Video:(*tgbotapi.Video)(nil), VideoNote:(*tgbotapi.VideoNote)(nil), Voice:(*tgbotapi.Voice)(nil), Caption:"", Contact:(*tgbotapi.Contact)(nil), Location:(*tgbotapi.Location)(nil), Venue:(*tgbotapi.Venue)(nil), NewChatMembers:(*[]tgbotapi.User)(nil), LeftChatMember:(*tgbotapi.User)(nil), NewChatTitle:"", NewChatPhoto:(*[]tgbotapi.PhotoSize)(nil), DeleteChatPhoto:false, GroupChatCreated:false, SuperGroupChatCreated:false, ChannelChatCreated:false, MigrateToChatID:0, MigrateFromChatID:0, PinnedMessage:(*tgbotapi.Message)(nil), Invoice:(*tgbotapi.Invoice)(nil), SuccessfulPayment:(*tgbotapi.SuccessfulPayment)(nil), PassportData:(*tgbotapi.PassportData)(nil)}
[0055] DEBUG telegram:     Trying to download "file_1631.jpg" with size 25532
[0056] DEBUG telegram:     Download OK "file_1631.jpg" 25532
[0056] DEBUG telegram:     <= Sending message from USER2 on telegram.nim to gateway
[0056] DEBUG telegram:     <= Message is config.Message{Text:"", Channel:"CID", Username:"USER2", UserID:"USER2ID", Avatar:"", Account:"telegram.nim", Event:"", Protocol:"", Gateway:"", ParentID:"", Timestamp:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}, ID:"32324", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"file_1631.jpg", Data:(*[]uint8)(0xc0004de020), Comment:"", URL:"", Size:0, Avatar:false, SHA:""}}}}
[0056] DEBUG gateway:      => Sending config.Message{Text:"", Channel:"CID", Username:"USER2", UserID:"USER2ID", Avatar:"", Account:"telegram.nim", Event:"", Protocol:"telegram", Gateway:"nim-telegram", ParentID:"", Timestamp:time.Time{wall:0xbf9ced532fd4fe42, ext:56178574229, loc:(*time.Location)(0x3082420)}, ID:"32324", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"file_1631.jpg", Data:(*[]uint8)(0xc0004de020), Comment:"", URL:"", Size:0, Avatar:false, SHA:""}}}} from telegram.nim (CID) to slack.site (nim-telegram)
[0056] DEBUG slack:        => Receiving config.Message{Text:"", Channel:"nim-telegram", Username:"USER2", UserID:"USER2ID", Avatar:"", Account:"telegram.nim", Event:"", Protocol:"telegram", Gateway:"nim-telegram", ParentID:"", Timestamp:time.Time{wall:0xbf9ced532fd4fe42, ext:56178574229, loc:(*time.Location)(0x3082420)}, ID:"", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"file_1631.jpg", Data:(*[]uint8)(0xc0004de020), Comment:"", URL:"", Size:0, Avatar:false, SHA:""}}}}
[0056] DEBUG slack:        Adding file file_1631.jpg to cache at 2020-04-12 16:11:56.802917774 +0000 UTC m=+56.179004129 with timestamp
[0071] DEBUG slack:        == Receiving event &slack.FileCreatedEvent{Type:"file_created", EventTimestamp:"1586707932.006300", File:slack.File{ID:"F011CMT7H8X", Created:0, Timestamp:0, Name:"", Title:"", Mimetype:"", ImageExifRotation:0, Filetype:"", PrettyType:"", User:"", Mode:"", Editable:false, IsExternal:false, ExternalType:"", Size:0, URL:"", URLDownload:"", URLPrivate:"", URLPrivateDownload:"", OriginalH:0, OriginalW:0, Thumb64:"", Thumb80:"", Thumb160:"", Thumb360:"", Thumb360Gif:"", Thumb360W:0, Thumb360H:0, Thumb480:"", Thumb480W:0, Thumb480H:0, Thumb720:"", Thumb720W:0, Thumb720H:0, Thumb960:"", Thumb960W:0, Thumb960H:0, Thumb1024:"", Thumb1024W:0, Thumb1024H:0, Permalink:"", PermalinkPublic:"", EditLink:"", Preview:"", PreviewHighlight:"", Lines:0, LinesMore:0, IsPublic:false, PublicURLShared:false, Channels:[]string(nil), Groups:[]string(nil), IMs:[]string(nil), InitialComment:slack.Comment{ID:"", Created:0, Timestamp:0, User:"", Comment:""}, CommentsCount:0, NumStars:0, IsStarred:false, Shares:slack.Share{Public:map[string][]slack.ShareFileInfo(nil), Private:map[string][]slack.ShareFileInfo(nil)}}, FileID:"F011CMT7H8X"}
[0071] DEBUG slack:        Unhandled incoming event: *slack.FileCreatedEvent
[0071] DEBUG slack:        == Receiving event &slack.MessageEvent{Msg:slack.Msg{ClientMsgID:"", Type:"message", Channel:"CHANNEL1", User:"USER3", Text:"File from USER2", Timestamp:"1586707932.139400", ThreadTimestamp:"", IsStarred:false, PinnedTo:[]string(nil), Attachments:[]slack.Attachment(nil), Edited:(*slack.Edited)(nil), LastRead:"", Subscribed:false, UnreadCount:0, SubType:"", Hidden:false, DeletedTimestamp:"", EventTimestamp:"1586707932.139400", BotID:"", Username:"", Icons:(*slack.Icon)(nil), Inviter:"", Topic:"", Purpose:"", Name:"", OldName:"", Members:[]string(nil), ReplyCount:0, Replies:[]slack.Reply(nil), ParentUserId:"", Files:[]slack.File{slack.File{ID:"F011CMT7H8X", Created:1586707916, Timestamp:1586707916, Name:"file_1631.jpg", Title:"file 1631", Mimetype:"image/jpeg", ImageExifRotation:0, Filetype:"jpg", PrettyType:"JPEG", User:"USER3", Mode:"hosted", Editable:false, IsExternal:false, ExternalType:"", Size:25532, URL:"", URLDownload:"", URLPrivate:"https://files.slack.com/files-pri/TEAM1-F011CMT7H8X/file_1631.jpg", URLPrivateDownload:"https://files.slack.com/files-pri/TEAM1-F011CMT7H8X/download/file_1631.jpg", OriginalH:0, OriginalW:0, Thumb64:"", Thumb80:"", Thumb160:"", Thumb360:"", Thumb360Gif:"", Thumb360W:0, Thumb360H:0, Thumb480:"", Thumb480W:0, Thumb480H:0, Thumb720:"", Thumb720W:0, Thumb720H:0, Thumb960:"", Thumb960W:0, Thumb960H:0, Thumb1024:"", Thumb1024W:0, Thumb1024H:0, Permalink:"https://site.slack.com/files/USER3/F011CMT7H8X/file_1631.jpg", PermalinkPublic:"https://slack-files.com/TEAM1-F011CMT7H8X-464b392f33", EditLink:"", Preview:"", PreviewHighlight:"", Lines:0, LinesMore:0, IsPublic:false, PublicURLShared:false, Channels:[]string(nil), Groups:[]string(nil), IMs:[]string(nil), InitialComment:slack.Comment{ID:"", Created:0, Timestamp:0, User:"", Comment:""}, CommentsCount:0, NumStars:0, IsStarred:false, Shares:slack.Share{Public:map[string][]slack.ShareFileInfo(nil), Private:map[string][]slack.ShareFileInfo(nil)}}}, Upload:true, Comment:(*slack.Comment)(nil), ItemType:"", ReplyTo:0, Team:"TEAM1", Reactions:[]slack.ItemReaction(nil), ResponseType:"", ReplaceOriginal:false, DeleteOriginal:false, Blocks:slack.Blocks{BlockSet:[]slack.Block(nil)}}, SubMessage:(*slack.Msg)(nil), PreviousMessage:(*slack.Msg)(nil)}
[0071] DEBUG slack:        Trying to download "file_1631.jpg" with size 25532
[0071] DEBUG slack:        Download OK "file_1631.jpg" 25532
[0071] DEBUG slack:        <= Sending message from BOT on slack.site to gateway
[0071] DEBUG slack:        <= Message is &config.Message{Text:"", Channel:"nim-telegram", Username:"BOT", UserID:"USER3", Avatar:"https://secure.gravatar.com/avatar/c3a05114ad2e3855e9d591c668eaa69a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0022-48.png", Account:"slack.site", Event:"", Protocol:"slack", Gateway:"", ParentID:"", Timestamp:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}, ID:"1586707932.139400", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"file_1631.jpg", Data:(*[]uint8)(0xc00000ce40), Comment:"File from USER2", URL:"https://files.slack.com/files-pri/TEAM1-F011CMT7H8X/download/file_1631.jpg", Size:0, Avatar:false, SHA:""}}}}
[0071] DEBUG slack:        == Receiving event &slack.FilePublicEvent{Type:"file_public", EventTimestamp:"1586707932.139500", File:slack.File{ID:"F011CMT7H8X", Created:0, Timestamp:0, Name:"", Title:"", Mimetype:"", ImageExifRotation:0, Filetype:"", PrettyType:"", User:"", Mode:"", Editable:false, IsExternal:false, ExternalType:"", Size:0, URL:"", URLDownload:"", URLPrivate:"", URLPrivateDownload:"", OriginalH:0, OriginalW:0, Thumb64:"", Thumb80:"", Thumb160:"", Thumb360:"", Thumb360Gif:"", Thumb360W:0, Thumb360H:0, Thumb480:"", Thumb480W:0, Thumb480H:0, Thumb720:"", Thumb720W:0, Thumb720H:0, Thumb960:"", Thumb960W:0, Thumb960H:0, Thumb1024:"", Thumb1024W:0, Thumb1024H:0, Permalink:"", PermalinkPublic:"", EditLink:"", Preview:"", PreviewHighlight:"", Lines:0, LinesMore:0, IsPublic:false, PublicURLShared:false, Channels:[]string(nil), Groups:[]string(nil), IMs:[]string(nil), InitialComment:slack.Comment{ID:"", Created:0, Timestamp:0, User:"", Comment:""}, CommentsCount:0, NumStars:0, IsStarred:false, Shares:slack.Share{Public:map[string][]slack.ShareFileInfo(nil), Private:map[string][]slack.ShareFileInfo(nil)}}, FileID:"F011CMT7H8X"}
[0071] DEBUG slack:        Unhandled incoming event: *slack.FilePublicEvent
[0071] DEBUG slack:        == Receiving event &slack.FileSharedEvent{Type:"file_shared", EventTimestamp:"1586707932.139600", File:slack.File{ID:"F011CMT7H8X", Created:0, Timestamp:0, Name:"", Title:"", Mimetype:"", ImageExifRotation:0, Filetype:"", PrettyType:"", User:"", Mode:"", Editable:false, IsExternal:false, ExternalType:"", Size:0, URL:"", URLDownload:"", URLPrivate:"", URLPrivateDownload:"", OriginalH:0, OriginalW:0, Thumb64:"", Thumb80:"", Thumb160:"", Thumb360:"", Thumb360Gif:"", Thumb360W:0, Thumb360H:0, Thumb480:"", Thumb480W:0, Thumb480H:0, Thumb720:"", Thumb720W:0, Thumb720H:0, Thumb960:"", Thumb960W:0, Thumb960H:0, Thumb1024:"", Thumb1024W:0, Thumb1024H:0, Permalink:"", PermalinkPublic:"", EditLink:"", Preview:"", PreviewHighlight:"", Lines:0, LinesMore:0, IsPublic:false, PublicURLShared:false, Channels:[]string(nil), Groups:[]string(nil), IMs:[]string(nil), InitialComment:slack.Comment{ID:"", Created:0, Timestamp:0, User:"", Comment:""}, CommentsCount:0, NumStars:0, IsStarred:false, Shares:slack.Share{Public:map[string][]slack.ShareFileInfo(nil), Private:map[string][]slack.ShareFileInfo(nil)}}, FileID:"F011CMT7H8X"}
[0071] DEBUG slack:        Unhandled incoming event: *slack.FileSharedEvent
[0071] DEBUG slack:        Adding file ID F011CMT7H8X to cache with timestamp 2020-04-12 16:11:56.802917774 +0000 UTC m=+56.179004129
[0071] DEBUG gateway:      => Sending config.Message{Text:"", Channel:"nim-telegram", Username:"BOT", UserID:"USER3", Avatar:"https://secure.gravatar.com/avatar/c3a05114ad2e3855e9d591c668eaa69a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0022-48.png", Account:"slack.site", Event:"", Protocol:"slack", Gateway:"nim-telegram", ParentID:"", Timestamp:time.Time{wall:0xbf9ced571c9c40d1, ext:71856088612, loc:(*time.Location)(0x3082420)}, ID:"1586707932.139400", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"file_1631.jpg", Data:(*[]uint8)(0xc00000ce40), Comment:"File from USER2", URL:"https://files.slack.com/files-pri/TEAM1-F011CMT7H8X/download/file_1631.jpg", Size:0, Avatar:false, SHA:""}}}} from slack.site (nim-telegram) to telegram.nim (CID)
[0071] DEBUG telegram:     => Receiving config.Message{Text:"", Channel:"CID", Username:"", UserID:"USER3", Avatar:"https://secure.gravatar.com/avatar/c3a05114ad2e3855e9d591c668eaa69a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0022-48.png", Account:"slack.site", Event:"", Protocol:"slack", Gateway:"nim-telegram", ParentID:"", Timestamp:time.Time{wall:0xbf9ced571c9c40d1, ext:71856088612, loc:(*time.Location)(0x3082420)}, ID:"", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"file_1631.jpg", Data:(*[]uint8)(0xc00000ce40), Comment:"File from USER2", URL:"https://files.slack.com/files-pri/TEAM1-F011CMT7H8X/download/file_1631.jpg", Size:0, Avatar:false, SHA:""}}}}
[0073] ERROR telegram:     posting file comment File from USER2 failed: Too Many Requests: retry after 10

@genotrance genotrance added the bug label Apr 12, 2020
@qaisjp
Copy link
Collaborator

qaisjp commented Apr 12, 2020

Related to #1046 and #1048

42wim added a commit that referenced this issue Apr 18, 2020
Also check for our matterbridge ID in Blocks set in SubMessages.
@42wim 42wim closed this as completed in 57794b3 Apr 18, 2020
@42wim
Copy link
Owner

42wim commented Apr 18, 2020

Thanks for reporting, fixed now in master.
You can try dev build binaries or build yourself for the fix.

@42wim 42wim mentioned this issue Apr 19, 2020
jwflory added a commit to FOSSRIT/infrastructure that referenced this issue Apr 20, 2020
Periodic version bump. A few upstream changes highlighted that may be
relevant for us:

    https://github.com/42wim/matterbridge/releases/tag/v1.17.3

v1.17.3
=======

* irc: Add JoinDelay option (irc). Fixes 42wim/matterbridge#1084
  (42wim/matterbridge#1098)
* slack: Clip too long messages on 3000 length (slack). Fixes
    * This one will definitely affect RIT FOSS for IRC/Matrix/Riot users
      with really long messages to Slack.
  42wim/matterbridge#1081 (42wim/matterbridge#1102)
* slack: Prevent image/message looping (slack). Fixes
  42wim/matterbridge#1088 (42wim/matterbridge#1096)
* irc: Add extra space before colon in attachments (irc). Fixes
  42wim/matterbridge#1089 (42wim/matterbridge#1101)

v1.17.2
=======

* slack: Update vendor slack-go/slack (42wim/matterbridge#1068)

Signed-off-by: Justin W. Flory <git@jwf.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants