Fix fxTwitter regex (#100)

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

Co-authored-by: Ven <vendicated@riseup.net>
main
Berlin 2 years ago committed by GitHub
parent 2cb6c23347
commit d73a6e2c89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save