Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit c6a927d4e3b7ced31aef7d6c3f1a4d86dc39283d Author: rani <clagv.randomgames@gmail.com> Date: Tue Jun 09 13:22:11 2026 +0000 Change: strip redundant embeds in discord messages diff --git a/scripts/inmessage.tengo b/scripts/inmessage.tengo index e9aec6c..f06bc6d 100644 --- a/scripts/inmessage.tengo +++ b/scripts/inmessage.tengo @@ -369 +3624 @@ doQuote := func(...reStrs) { }  }   +stripEmbed := func() { + if !text.contains(msgText, " embed: ") { return } + + re := text.re_compile(`^([^ ]+) embed: ([^ ]+)$`) + if !re.match(msgText) { return } + + a := re.replace(msgText, "$1") + b := re.replace(msgText, "$2") + + if a == b { + msgText = a + } +} +  if msgText != "" { if msgProtocol == "discord" { doQuote(`(?s)(.*?) \(in reply to (.*?): (.*?)\)$`) + stripEmbed() } else if msgProtocol == "xmpp" { doQuote( `(?s)(.*?) \(in reply to (.*?) \[b]: (.*?)\)$`,