summaryrefslogtreecommitdiffstats
path: root/contrib/outmessage-discordemoji.tengo
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/outmessage-discordemoji.tengo')
-rw-r--r--contrib/outmessage-discordemoji.tengo10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/outmessage-discordemoji.tengo b/contrib/outmessage-discordemoji.tengo
new file mode 100644
index 00000000..3dd61ad9
--- /dev/null
+++ b/contrib/outmessage-discordemoji.tengo
@@ -0,0 +1,10 @@
+text := import("text")
+
+// if we're not sending to a discord bridge,
+// then convert custom emoji tags into url's
+if (inProtocol == "discord" && outProtocol != "discord") {
+ rePNG := text.re_compile(`<:.*?:([0-9]+)>`)
+ msgText=rePNG.replace(msgText,"https://cdn.discordapp.com/emojis/$1.png")
+ reGIF := text.re_compile(`<a:.*?:([0-9]+)>`)
+ msgText=reGIF.replace(msgText,"https://cdn.discordapp.com/emojis/$1.gif")
+}