Thumbnail

rani/matterbridge.git

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

commit e17c6fd89de5c3fd61eb3b6ae5359600d5a954d5 Author: rani <clagv.randomgames@gmail.com> Date: Tue May 12 15:46:52 2026 +0000 Remove link embeds from quotes on discord diff --git a/scripts/outmessage.tengo b/scripts/outmessage.tengo index 8efeecd..7a0897e 100644 --- a/scripts/outmessage.tengo +++ b/scripts/outmessage.tengo @@ -136 +1316 @@ text := import("text")  fmt := import("fmt")    doQuote_ := func(reply, nick, ctx) { + // on discord, wrap links inside ctx with <...> to prevent embeds + if outProtocol == "discord" { + re := text.re_compile( + `(https?://(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[-a-zA-Z0-9]{1,16}\b[-a-zA-Z0-9@:%_+.~#?&/=]*)` + ) + if re.match(ctx) { + ctx = re.replace(ctx, "<$1>") + } + } + if outProtocol == "xmpp" || outProtocol == "discord" { // split multiline context and prepend lines with a ">" ctx = text.join(text.split(ctx, "\n"), "\n> ")