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:
parent
2cb6c23347
commit
d73a6e2c89
|
@ -2,6 +2,8 @@ import definePlugin from "../utils/types";
|
||||||
import { addPreSendListener, MessageObject, removePreSendListener } from "../api/MessageEvents";
|
import { addPreSendListener, MessageObject, removePreSendListener } from "../api/MessageEvents";
|
||||||
import { Devs } from "../utils/constants";
|
import { Devs } from "../utils/constants";
|
||||||
|
|
||||||
|
const re = /https?:\/\/twitter\.com(?=\/\w+?\/status\/)/g;
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "FxTwitter",
|
name: "FxTwitter",
|
||||||
description: "Uses FxTwitter to improve embeds from twitter on send",
|
description: "Uses FxTwitter to improve embeds from twitter on send",
|
||||||
|
@ -9,7 +11,7 @@ export default definePlugin({
|
||||||
dependencies: ["MessageEventsAPI"],
|
dependencies: ["MessageEventsAPI"],
|
||||||
|
|
||||||
addPrefix(msg: MessageObject) {
|
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() {
|
start() {
|
||||||
|
|
Loading…
Reference in a new issue