42wim / matterbridge

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)
Apache License 2.0
6.46k stars 607 forks source link

Sending an image from Discord to other bridges results in a link to be sent #2137

Open christianlupus opened 2 months ago

christianlupus commented 2 months ago

Describe the bug When a users sends an image using a discord room, users in other chat systems (tested with Matrix and Whatsapp) are getting just a URL where they can download the image.

To Reproduce Steps to reproduce the behavior:

  1. Setup a bridge between Discord and either Matrix or Whatsapp
  2. Send an image in Discord
  3. See no image in Whatsapp

Expected behavior The image is sent as image and visible on the chat in the other systems as well.

Screenshots/debug logs If applicable, add screenshots to help explain your problem. Use logs from running matterbridge -debug if possible.

app-1  | time="2024-04-27T06:40:19Z" level=debug msg="== Receiving event &discordgo.Message{ID:"1234", ChannelID:"123123", GuildID:"23545", Content:"Drag n Drop\nhttps://cdn.discordapp.com/attachments/123123/673546/test_img.jpg?ex=662def53&is=662c9dd3&hm=d9b4c&", Timestamp:time.Date(2024, time.April, 27, 6, 40, 19, 9000000, time.Local), EditedTimestamp:<nil>, MentionRoles:[]string{}, TTS:false, MentionEveryone:false, Author:(*discordgo.User)(0xc00080c540), Attachments:[]*discordgo.MessageAttachment{(*discordgo.MessageAttachment)(0xc00034fa40)}, Components:[]discordgo.MessageComponent{}, Embeds:[]*discordgo.MessageEmbed{}, Mentions:[]*discordgo.User{}, Reactions:[]*discordgo.MessageReactions(nil), Pinned:false, Type:0, WebhookID:"", Member:(*discordgo.Member)(0xc0007f94d0), MentionChannels:[]*discordgo.Channel(nil), Activity:(*discordgo.MessageActivity)(nil), Application:(*discordgo.MessageApplication)(nil), MessageReference:(*discordgo.MessageReference)(nil), ReferencedMessage:(*discordgo.Message)(nil), Interaction:(*discordgo.MessageInteraction)(nil), Flags:0, Thread:(*discordgo.Channel)(nil), StickerItems:[]*discordgo.Sticker(nil)}" func=messageCreate file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/bridge/discord/handlers.go:110" prefix=discord
app-1  | time="2024-04-27T06:40:19Z" level=debug msg="<= Sending message from christianlupus on discord.rur to gateway" func=messageCreate file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/bridge/discord/handlers.go:161" prefix=discord
app-1  | time="2024-04-27T06:40:19Z" level=debug msg="<= Message is config.Message{Text:"Drag n Drop\nhttps://cdn.discordapp.com/attachments/123123/673546/test_img.jpg?ex=662def53&is=662c9dd3&hm=d9b4c&", Channel:"ID:123123", Username:"christianlupus", UserID:"345786", Avatar:"https://cdn.discordapp.com/avatars/345786/.jpg", Account:"discord.rur", Event:"", Protocol:"", Gateway:"", ParentID:"", Timestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), ID:"1234", Extra:map[string][]interface {}(nil)}" func=messageCreate file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/bridge/discord/handlers.go:162" prefix=discord
app-1  | time="2024-04-27T06:40:19Z" level=debug msg="=> Sending config.Message{Text:"Drag n Drop\nhttps://cdn.discordapp.com/attachments/123123/673546/test_img.jpg?ex=662def53&is=662c9dd3&hm=d9b4c&", Channel:"ID:123123", Username:"christianlupus", UserID:"345786", Avatar:"https://cdn.discordapp.com/avatars/345786/.jpg", Account:"discord.rur", Event:"", Protocol:"discord", Gateway:"Test Bridge", ParentID:"", Timestamp:time.Date(2024, time.April, 27, 6, 40, 19, 167027525, time.Local), ID:"1234", Extra:map[string][]interface {}(nil)} from discord.rur (ID:123123) to whatsapp.privat (120363281608671177@g.us)" func=SendMessage file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/gateway/gateway.go:499" prefix=gateway
app-1  | time="2024-04-27T06:40:19Z" level=debug msg="=> Receiving config.Message{Text:"Drag n Drop\nhttps://cdn.discordapp.com/attachments/123123/673546/test_img.jpg?ex=662def53&is=662c9dd3&hm=d9b4c&", Channel:"120363281608671177@g.us", Username:"[christianlupus@discord] ", UserID:"345786", Avatar:"https://cdn.discordapp.com/avatars/345786/.jpg", Account:"discord.rur", Event:"", Protocol:"discord", Gateway:"Test Bridge", ParentID:"", Timestamp:time.Date(2024, time.April, 27, 6, 40, 19, 167027525, time.Local), ID:"", Extra:map[string][]interface {}(nil)}" func=Send file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/bridge/whatsappmulti/whatsapp.go:376" prefix=whatsapp
app-1  | time="2024-04-27T06:40:20Z" level=debug msg="mID whatsapp.privat: 49123456@s.whatsapp.net/456789DEF" func=SendMessage file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/gateway/gateway.go:518" prefix=gateway
app-1  | time="2024-04-27T06:40:20Z" level=debug msg="=> Send from discord.rur (ID:123123) to whatsapp.privat (120363281608671177@g.us) took 1.161278056s" func=func1 file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/gateway/gateway.go:508" prefix=gateway
app-1  | time="2024-04-27T06:40:20Z" level=debug msg="=> Sending config.Message{Text:"Drag n Drop\nhttps://cdn.discordapp.com/attachments/123123/673546/test_img.jpg?ex=662def53&is=662c9dd3&hm=d9b4c&", Channel:"ID:123123", Username:"christianlupus", UserID:"345786", Avatar:"https://cdn.discordapp.com/avatars/345786/.jpg", Account:"discord.rur", Event:"", Protocol:"discord", Gateway:"Test Bridge", ParentID:"", Timestamp:time.Date(2024, time.April, 27, 6, 40, 19, 167027525, time.Local), ID:"1234", Extra:map[string][]interface {}(nil)} from discord.rur (ID:123123) to matrix.bot_matrixorg (#test-room:matrix.org)" func=SendMessage file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/gateway/gateway.go:499" prefix=gateway
app-1  | time="2024-04-27T06:40:20Z" level=debug msg="=> Receiving config.Message{Text:"Drag n Drop\nhttps://cdn.discordapp.com/attachments/123123/673546/test_img.jpg?ex=662def53&is=662c9dd3&hm=d9b4c&", Channel:"#test-room:matrix.org", Username:"[christianlupus:discord] ", UserID:"345786", Avatar:"https://cdn.discordapp.com/avatars/345786/.jpg", Account:"discord.rur", Event:"", Protocol:"discord", Gateway:"Test Bridge", ParentID:"", Timestamp:time.Date(2024, time.April, 27, 6, 40, 19, 167027525, time.Local), ID:"", Extra:map[string][]interface {}(nil)}" func=Send file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/bridge/matrix/matrix.go:144" prefix=matrix
app-1  | time="2024-04-27T06:40:20Z" level=debug msg="Channel #test-room:matrix.org maps to channel id !XXX:matrix.org" func=Send file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/bridge/matrix/matrix.go:147" prefix=matrix
app-1  | time="2024-04-27T06:40:20Z" level=debug msg="mID matrix.bot_matrixorg: $AFSKLJ" func=SendMessage file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/gateway/gateway.go:518" prefix=gateway
app-1  | time="2024-04-27T06:40:20Z" level=debug msg="=> Send from discord.rur (ID:123123) to matrix.bot_matrixorg (#test-room:matrix.org) took 177.079477ms" func=func1 file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/gateway/gateway.go:508" prefix=gateway
app-1  | time="2024-04-27T06:40:20Z" level=debug msg="== Receiving event: &gomatrix.Event{StateKey:(*string)(nil), Sender:"@rur-bot:matrix.org", Type:"m.room.message", Timestamp:1714200020396, ID:"$AFSKLJ", RoomID:"!XXX:matrix.org", Redacts:"", Unsigned:map[string]interface {}{"age":153, "transaction_id":"go1714200020329642170"}, Content:map[string]interface {}{"body":"[christianlupus:discord] Drag n Drop\nhttps://cdn.discordapp.com/attachments/123123/673546/test_img.jpg?ex=662def53&is=662c9dd3&hm=d9b4c&", "format":"org.matrix.custom.html", "formatted_body":"[christianlupus:discord] Drag n Drop<br>\nhttps://cdn.discordapp.com/attachments/123123/673546/test_img.jpg?ex=662def53&amp;is=662c9dd3&amp;hm=d9b4c&amp;", "msgtype":"m.text"}, PrevContent:map[string]interface {}(nil)}" func=handleEvent file="/home/build/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20230805184319-56e7bd01ca09/bridge/matrix/matrix.go:484" prefix=matrix

(Sorry, the logs have both Matrix and Whatsapp included)

Environment (please complete the following information):

Additional context Please add your configuration file (be sure to exclude or anonymize private data (tokens/passwords))

The setup is the same as in #2136.

mpietruschka commented 2 months ago

same here #2140