From 0f32f966b3d7c9ed04016b098ec43b0061c4ab76 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 29 Jan 2023 15:36:53 +0200 Subject: [PATCH] Add notice to messages that contain components --- portal.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/portal.go b/portal.go index 3379666..e4af6fd 100644 --- a/portal.go +++ b/portal.go @@ -917,6 +917,8 @@ const msgInteractionTemplateHTML = `
%s used /%s
` +const msgComponentTemplateHTML = `

This message contains interactive elements. Use the Discord app to interact with the message.

` + func (portal *Portal) convertDiscordTextMessage(intent *appservice.IntentAPI, msg *discordgo.Message, relation *event.RelatesTo, isEdit bool) *ConvertedMessage { var htmlParts []string if msg.Interaction != nil { @@ -941,6 +943,10 @@ func (portal *Portal) convertDiscordTextMessage(intent *appservice.IntentAPI, ms } } + if len(msg.Components) > 0 { + htmlParts = append(htmlParts, msgComponentTemplateHTML) + } + if len(htmlParts) == 0 { return nil }