Fix fxTwitter regex (#100)

* Fixes so that wont affect other things like likes
* Fixes #97 

Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
Berlin 2022-10-14 18:13:13 +02:00 committed by GitHub
parent 2cb6c23347
commit d73a6e2c89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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() {