Open
Description
Describe the bug
When responding to a partial message quote, matterbridge sends garbage to discord, and it fails. Excerpt from my logs:
time="2024-12-12T22:01:13+01:00" level=debug msg="=> Receiving config.Message{Text:"<mycensoredtext>", Channel:"mycensoredchannel", Username:"mycensoredname", UserID:"123456789", Avatar:"https://mycensored.example.com/mb/abcd1234/123456789.png", Account:"telegram.mytelegram", Event:"", Protocol:"telegram", Gateway:"mycensoredgw", ParentID:"telegram 6185", Timestamp:time.Date(2024, time.December, 12, 22, 1, 13, 115482686, time.Local), ID:"", Extra:map[string][]interface {}{}}" func=Send file="/home/user/
workspace/go-matterbridge-myfork/bridge/discord/discord.go:254" prefix=discord
time="2024-12-12T22:01:13+01:00" level=debug msg="Broadcasting using token (API)" func=handleEventBotUser file="/home/user/workspace/go-matterbridge-myfork/bridge/discord/discord.go:290"
prefix=discord
time="2024-12-12T22:01:13+01:00" level=debug msg="=> Send from telegram.mytelegram (-1001234567890) to discord.mydiscord (mycensoredchannel) took 186.837392ms" func=func1 file="/home/user/workspace/go-matterbridge-myfork/gateway/gateway.go:508" prefix=gateway time="2024-12-12T22:01:13+01:00" level=error msg="SendMessage failed: HTTP 400 Bad Request, {"message": "Invalid Form Body", "code": 50035, "errors": {"message_reference": {"message_id": {"_errors": [{"code": "NUMBER_TYPE_COERCE", "message": "Value \"telegram 6185\" is not snowflake."}]}}}}" func=handleMessage file="/home/user/workspace/go-matterbridge-myfork/gateway/handlers.go:228" prefix=gateway
To Reproduce
Steps to reproduce the behavior:
- Write a message on Telegram, let it be bridged by matterbridge to discord, for example "Hello humans how are you today"
- On Telegram (e.g. using the "Web A" client at https://web.telegram.org/a/) respond only to a part of the message. (For example selecting the word "humans", right-clicking it, and selecting "Quote & Reply", then typing a message like "But I'm a robot-cat-ninja, not a human! 🤪", and sending it)
- I think that
PreserveThreading
is involved in this issue.
Expected behavior
The second message should arrive just fine, either as a reply, or as a regular message (in the worst case).
Actual behavior: See above; an error message is logged, but the message is lost.
Screenshots/debug logs
The screenshots are specific to the "Web A"-client, and some clients don't support sending such messages. However, most clients support displaying these messages perfectly correctly; all clients display the main reply text, at least.
Environment (please complete the following information):
- OS: Debian / Centos (tried both)
- Matterbridge version:
version: 1.26.1-dev
(I'm using Explicitly announce the sender of each file in Telegram, simplifying moderation #2165) - If self compiled: output of e03fb75 (technically I'm missing c4157a4, but I don't think that changes anything here.)
Additional context
[telegram.mytelegram]
Token="lolnope"
RemoteNickFormat="{NICK}@<U+200D>{PROTOCOL}: "
MediaConvertWebPToPNG=true
MediaConvertTgs="png"
UseFirstName=true
PreserveThreading=true
# Disable qoute-by-copy, because of PreserveThreading=true in Discord:
QuoteFormat="{MESSAGE}"
[discord.mydiscord]
Token="lolnope"
Server="Unfaßbare Menschen"
# No trailing colon-space!
RemoteNickFormat="{NICK}@<U+200D>{PROTOCOL}"
AutoWebhooks=true
PreserveThreading=true
Activity