From d73a6e2c8979ba0536452bfb19586556fe032aca Mon Sep 17 00:00:00 2001 From: Berlin <39058370+somerandomcloud@users.noreply.github.com> Date: Fri, 14 Oct 2022 18:13:13 +0200 Subject: Fix fxTwitter regex (#100) * Fixes so that wont affect other things like likes * Fixes #97 Co-authored-by: Ven --- src/plugins/fxTwitter.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/fxTwitter.ts b/src/plugins/fxTwitter.ts index 0cf19be..53477d2 100644 --- a/src/plugins/fxTwitter.ts +++ b/src/plugins/fxTwitter.ts @@ -2,6 +2,8 @@ import definePlugin from "../utils/types"; import { addPreSendListener, MessageObject, removePreSendListener } from "../api/MessageEvents"; import { Devs } from "../utils/constants"; +const re = /https?:\/\/twitter\.com(?=\/\w+?\/status\/)/g; + export default definePlugin({ name: "FxTwitter", description: "Uses FxTwitter to improve embeds from twitter on send", @@ -9,7 +11,7 @@ export default definePlugin({ dependencies: ["MessageEventsAPI"], addPrefix(msg: MessageObject) { - msg.content = msg.content.replace(/https?:\/\/twitter\.com(?=\/.*?\/)/g, "https://fxtwitter.com"); + msg.content = msg.content.replace(re, "https://fxtwitter.com"); }, start() { -- cgit