aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/fxTwitter.ts22
-rw-r--r--src/plugins/noCanaryMessageLinks.ts3
2 files changed, 24 insertions, 1 deletions
diff --git a/src/plugins/fxTwitter.ts b/src/plugins/fxTwitter.ts
new file mode 100644
index 0000000..0cf19be
--- /dev/null
+++ b/src/plugins/fxTwitter.ts
@@ -0,0 +1,22 @@
+import definePlugin from "../utils/types";
+import { addPreSendListener, MessageObject, removePreSendListener } from "../api/MessageEvents";
+import { Devs } from "../utils/constants";
+
+export default definePlugin({
+ name: "FxTwitter",
+ description: "Uses FxTwitter to improve embeds from twitter on send",
+ authors: [Devs.Samu],
+ dependencies: ["MessageEventsAPI"],
+
+ addPrefix(msg: MessageObject) {
+ msg.content = msg.content.replace(/https?:\/\/twitter\.com(?=\/.*?\/)/g, "https://fxtwitter.com");
+ },
+
+ start() {
+ this.preSend = addPreSendListener((_, msg) => this.addPrefix(msg));
+ },
+
+ stop() {
+ removePreSendListener(this.preSend);
+ }
+});
diff --git a/src/plugins/noCanaryMessageLinks.ts b/src/plugins/noCanaryMessageLinks.ts
index c566c5e..a521127 100644
--- a/src/plugins/noCanaryMessageLinks.ts
+++ b/src/plugins/noCanaryMessageLinks.ts
@@ -1,10 +1,11 @@
import definePlugin from "../utils/types";
import { addPreSendListener, MessageObject, removePreSendListener } from "../api/MessageEvents";
+import { Devs } from "../utils/constants";
export default definePlugin({
name: "NoCanaryMessageLinks",
description: "Removes the canary and ptb prefix from message links",
- authors: [{ name: "ICodeInAssembly", id: 702973430449832038n }],
+ authors: [Devs.Samu],
dependencies: ["MessageEventsAPI"],
removeBetas(msg: MessageObject) {