discordid: remove all ID-related casts

In the same vein as mautrix-whatsapp, -slack and others, do not make
assumptions about how the ID is represented in the connector code. Let
the discordid package be entirely responsible.
This commit is contained in:
Skip R
2026-02-01 21:03:17 -08:00
parent e7554b212f
commit 92352ce603
12 changed files with 134 additions and 76 deletions

View File

@@ -107,14 +107,14 @@ func (mc *MessageConverter) ToDiscord(
if msg.ReplyTo != nil {
req.Reference = &discordgo.MessageReference{
ChannelID: string(msg.ReplyTo.Room.ID),
MessageID: string(msg.ReplyTo.ID),
ChannelID: discordid.ParsePortalID(msg.ReplyTo.Room.ID),
MessageID: discordid.ParseMessageID(msg.ReplyTo.ID),
}
}
portal := msg.Portal
guildID := msg.Portal.Metadata.(*discordid.PortalMetadata).GuildID
channelID := string(portal.ID)
channelID := discordid.ParsePortalID(portal.ID)
content := msg.Content
convertMatrix := func() {