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

Sending messages with some GIFs or static pictures from the Discord fails to be delivered to the Telegram #2169

Open
Wohlstand opened this issue Jul 26, 2024 · 0 comments
Labels

Comments

@Wohlstand
Copy link

Describe the bug
Attempt to send some GIF files via Discord results an error on attempt to delivery this thing to the Telegram.

Two sample files (that was sent on my side, at least by two different people who tried to send these, and both failed to be delivered to Telergam when sent from Discord) included here: sample-files.zip

To Reproduce
On Discord, put one of sample files to send, and then, send the message. This message might not be arrived at Telegram, however, it gets arrived to Matrix successfully.

Expected behavior
The message with a picture sent at the Discord, should appear at the Telegram too.

Screenshots/debug logs
The output log when ran the daemon with the -debug argument:

[0010]  INFO main:         [main:go/pkg/mod/github.com/42wim/[email protected]/matterbridge.go:68] Gateway(s) started successfully. Now relaying messages
[0024] DEBUG discord:      [messageCreate:go/pkg/mod/github.com/42wim/[email protected]/bridge/discord/handlers.go:110] == Receiving event &discordgo.Message{ID:"1266271201785810956", ChannelID:"692079635600506921", GuildID:"692079249594515607", Content:"Тест\nhttps://cdn.discordapp.com/attachments/692079635600506921/1266271201559576626/rebellion_idle.gif?ex=66a48a74&is=66a338f4&hm=e5ad4e377081d09ab385d150d0c60ecb3d628406b284e36e50a42fb3c99f285e&", Timestamp:time.Date(2024, time.July, 26, 5, 49, 40, 687000000, time.Location("")), EditedTimestamp:<nil>, MentionRoles:[]string{}, TTS:false, MentionEveryone:false, Author:(*discordgo.User)(0xc000675040), Attachments:[]*discordgo.MessageAttachment{(*discordgo.MessageAttachment)(0xc000120070)}, Components:[]discordgo.MessageComponent{}, Embeds:[]*discordgo.MessageEmbed{}, Mentions:[]*discordgo.User{}, Reactions:[]*discordgo.MessageReactions(nil), Pinned:false, Type:0, WebhookID:"", Member:(*discordgo.Member)(0xc0004c4780), 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.StickerItem(nil)}
[0024] DEBUG discord:      [messageCreate:go/pkg/mod/github.com/42wim/[email protected]/bridge/discord/handlers.go:161] <= Sending message from wohlstand on discord.moondustzone to gateway
[0024] DEBUG discord:      [messageCreate:go/pkg/mod/github.com/42wim/[email protected]/bridge/discord/handlers.go:162] <= Message is config.Message{Text:"Тест\nhttps://cdn.discordapp.com/attachments/692079635600506921/1266271201559576626/rebellion_idle.gif?ex=66a48a74&is=66a338f4&hm=e5ad4e377081d09ab385d150d0c60ecb3d628406b284e36e50a42fb3c99f285e&", Channel:"general-russian", Username:"wohlstand", UserID:"182039820879659008", Avatar:"https://cdn.discordapp.com/avatars/182039820879659008/daa59f567778bafa2078cc8872c9d5e2.jpg", Account:"discord.moondustzone", Event:"", Protocol:"", Gateway:"", ParentID:"", Timestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), ID:"1266271201785810956", Extra:map[string][]interface {}(nil)}
[0024] DEBUG gateway:      [SendMessage:go/pkg/mod/github.com/42wim/[email protected]/gateway/gateway.go:499] => Sending config.Message{Text:"Тест\nhttps://cdn.discordapp.com/attachments/692079635600506921/1266271201559576626/rebellion_idle.gif?ex=66a48a74&is=66a338f4&hm=e5ad4e377081d09ab385d150d0c60ecb3d628406b284e36e50a42fb3c99f285e&", Channel:"general-russian", Username:"wohlstand", UserID:"182039820879659008", Avatar:"https://cdn.discordapp.com/avatars/182039820879659008/daa59f567778bafa2078cc8872c9d5e2.jpg", Account:"discord.moondustzone", Event:"", Protocol:"discord", Gateway:"MoondustZoneRus", ParentID:"", Timestamp:time.Date(2024, time.July, 26, 8, 49, 41, 10861404, time.Local), ID:"1266271201785810956", Extra:map[string][]interface {}(nil)} from discord.moondustzone (general-russian) to matrix.moondustfoxybot (!uCydpXwWPPbHmuWVNP:matrix.org)
[0024] DEBUG matrix:       [Send:go/pkg/mod/github.com/42wim/[email protected]/bridge/matrix/matrix.go:144] => Receiving config.Message{Text:"Тест\nhttps://cdn.discordapp.com/attachments/692079635600506921/1266271201559576626/rebellion_idle.gif?ex=66a48a74&is=66a338f4&hm=e5ad4e377081d09ab385d150d0c60ecb3d628406b284e36e50a42fb3c99f285e&", Channel:"!uCydpXwWPPbHmuWVNP:matrix.org", Username:"**[discord] <wohlstand>:**\n", UserID:"182039820879659008", Avatar:"https://cdn.discordapp.com/avatars/182039820879659008/daa59f567778bafa2078cc8872c9d5e2.jpg", Account:"discord.moondustzone", Event:"", Protocol:"discord", Gateway:"MoondustZoneRus", ParentID:"", Timestamp:time.Date(2024, time.July, 26, 8, 49, 41, 10861404, time.Local), ID:"", Extra:map[string][]interface {}(nil)}
[0024] DEBUG matrix:       [Send:go/pkg/mod/github.com/42wim/[email protected]/bridge/matrix/matrix.go:147] Channel !uCydpXwWPPbHmuWVNP:matrix.org maps to channel id !uCydpXwWPPbHmuWVNP:matrix.org
[0024] DEBUG gateway:      [SendMessage:go/pkg/mod/github.com/42wim/[email protected]/gateway/gateway.go:518] mID matrix.moondustfoxybot: $bbR5-GBYk8iOqLATaIjw32pxzcbx7Cmu_nvF_YJKWSc
[0024] DEBUG gateway:      [func1:go/pkg/mod/github.com/42wim/[email protected]/gateway/gateway.go:508] => Send from discord.moondustzone (general-russian) to matrix.moondustfoxybot (!uCydpXwWPPbHmuWVNP:matrix.org) took 194.369703ms
[0024] DEBUG gateway:      [SendMessage:go/pkg/mod/github.com/42wim/[email protected]/gateway/gateway.go:499] => Sending config.Message{Text:"Тест\nhttps://cdn.discordapp.com/attachments/692079635600506921/1266271201559576626/rebellion_idle.gif?ex=66a48a74&is=66a338f4&hm=e5ad4e377081d09ab385d150d0c60ecb3d628406b284e36e50a42fb3c99f285e&", Channel:"general-russian", Username:"wohlstand", UserID:"182039820879659008", Avatar:"https://cdn.discordapp.com/avatars/182039820879659008/daa59f567778bafa2078cc8872c9d5e2.jpg", Account:"discord.moondustzone", Event:"", Protocol:"discord", Gateway:"MoondustZoneRus", ParentID:"", Timestamp:time.Date(2024, time.July, 26, 8, 49, 41, 10861404, time.Local), ID:"1266271201785810956", Extra:map[string][]interface {}(nil)} from discord.moondustzone (general-russian) to telegram.foxybotbridge (-1001620426071/52616)
[0024] DEBUG telegram:     [Send:go/pkg/mod/github.com/42wim/[email protected]/bridge/telegram/telegram.go:121] => Receiving config.Message{Text:"Тест\nhttps://cdn.discordapp.com/attachments/692079635600506921/1266271201559576626/rebellion_idle.gif?ex=66a48a74&is=66a338f4&hm=e5ad4e377081d09ab385d150d0c60ecb3d628406b284e36e50a42fb3c99f285e&", Channel:"-1001620426071/52616", Username:"*(discord) wohlstand:*\n", UserID:"182039820879659008", Avatar:"https://cdn.discordapp.com/avatars/182039820879659008/daa59f567778bafa2078cc8872c9d5e2.jpg", Account:"discord.moondustzone", Event:"", Protocol:"discord", Gateway:"MoondustZoneRus", ParentID:"", Timestamp:time.Date(2024, time.July, 26, 8, 49, 41, 10861404, time.Local), ID:"", Extra:map[string][]interface {}(nil)}
[0024] DEBUG telegram:     [TGGetParseMode:go/pkg/mod/github.com/42wim/[email protected]/bridge/telegram/telegram.go:74] Using mode markdown
[0024] DEBUG gateway:      [func1:go/pkg/mod/github.com/42wim/[email protected]/gateway/gateway.go:508] => Send from discord.moondustzone (general-russian) to telegram.foxybotbridge (-1001620426071/52616) took 41.076012ms
[0024] ERROR gateway:      [handleMessage:go/pkg/mod/github.com/42wim/[email protected]/gateway/handlers.go:228] SendMessage failed: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 119
[0024] DEBUG matrix:       [handleEvent:go/pkg/mod/github.com/42wim/[email protected]/bridge/matrix/matrix.go:484] == Receiving event: &gomatrix.Event{StateKey:(*string)(nil), Sender:"@moondust-foxy-bot:matrix.org", Type:"m.room.message", Timestamp:1721972981079, ID:"$bbR5-GBYk8iOqLATaIjw32pxzcbx7Cmu_nvF_YJKWSc", RoomID:"!uCydpXwWPPbHmuWVNP:matrix.org", Redacts:"", Unsigned:map[string]interface {}{"age":209, "membership":"join", "transaction_id":"go1721972981011667397"}, Content:map[string]interface {}{"body":"**[discord] <wohlstand>:**\nТест\nhttps://cdn.discordapp.com/attachments/692079635600506921/1266271201559576626/rebellion_idle.gif?ex=66a48a74&is=66a338f4&hm=e5ad4e377081d09ab385d150d0c60ecb3d628406b284e36e50a42fb3c99f285e&", "format":"org.matrix.custom.html", "formatted_body":"**[discord] &lt;wohlstand&gt;:**\nТест<br>\nhttps://cdn.discordapp.com/attachments/692079635600506921/1266271201559576626/rebellion_idle.gif?ex=66a48a74&amp;is=66a338f4&amp;hm=e5ad4e377081d09ab385d150d0c60ecb3d628406b284e36e50a42fb3c99f285e&amp;", "msgtype":"m.text"}, PrevContent:map[string]interface {}(nil)}

Environment (please complete the following information):

  • OS: Linux (RockyLinux 8)
  • Matterbridge version: 1.26.1-dev
  • Hash state d16645c (compiled with go install -tags nomsteams,nozulip,noslack github.com/42wim/matterbridge@master)

Additional context
In my case, there are bridges that connected between three networks: Telegram, Matrix and Discord. However, the problem gets reproduces even without Matrix.

How the stuff configured on my end:

[discord]
    [discord.someserver]
    Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    Server="77777777777777"
    AutoWebhooks=true
    RemoteNickFormat="**[{PROTOCOL}] <{NICK}>:**\n"
    PreserveThreading=true
    UseLocalAvatar=["telegram.somebridge"]
    ShowEmbeds=true
    UseUserName=true
    EditDisable=false

[telegram]
    [telegram.somebridge]
    #See https://core.telegram.org/bots#6-botfather
    #and https://www.linkedin.com/pulse/telegram-bots-beginners-marco-frau
    Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    RemoteNickFormat="*({PROTOCOL}) {NICK}:*\n"
    MessageFormat="Markdown"
    QuoteFormat="{MESSAGE}\n> __Reply to @{QUOTENICK}__:\n> {QUOTEMESSAGE}"

[matrix]
    [matrix.someanotherbot]
    Server="https://matrix.org"
    Login="xxxxxxxxxxxxxxxxx"
    Password="xxxxxxxxxxxxxxxxx"
    RemoteNickFormat="**[{PROTOCOL}] <{NICK}>:**\n"
    NoHomeServerSuffix=false
    
# ...

[[gateway]]
name="BridgeNameOfSome"
enable=true
    [[gateway.inout]]
    account="discord.someserver"
    channel="the-channel-name"

    [[gateway.inout]]
    account="telegram.somebridge"
    channel="-77777777777/66666"

    [[gateway.inout]]
    account="matrix.someanotherbot"
    channel="!xxXXXxxXXXXXxxXxXXx:matrix.org"
@Wohlstand Wohlstand added the bug label Jul 26, 2024
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

1 participant