Explorar el Código

Add notice to messages that contain components

Tulir Asokan hace 2 años
padre
commit
0f32f966b3
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      portal.go

+ 6 - 0
portal.go

@@ -917,6 +917,8 @@ const msgInteractionTemplateHTML = `<blockquote>
 <a href="https://matrix.to/#/%s">%s</a> used <font color="#3771bb">/%s</font>
 </blockquote>`
 
+const msgComponentTemplateHTML = `<p>This message contains interactive elements. Use the Discord app to interact with the message.</p>`
+
 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
 	}