aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBerlin <39058370+somerandomcloud@users.noreply.github.com>2022-10-10 22:45:54 +0200
committerGitHub <noreply@github.com>2022-10-10 22:45:54 +0200
commit54198b1a4a57c50ca5902293abbd1ddea226bffa (patch)
tree4f3fd3da2f32b43116e159316b3a47ad3921f53f /src
parent124d1ad9c7138bce4c65325e2db47f615e463de6 (diff)
downloadVencord-54198b1a4a57c50ca5902293abbd1ddea226bffa.tar.gz
Vencord-54198b1a4a57c50ca5902293abbd1ddea226bffa.tar.bz2
Vencord-54198b1a4a57c50ca5902293abbd1ddea226bffa.zip
fxTwitter (plugin) (#80)
Co-authored-by: splatterxl <splatterxl@outlook.ie> Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/fxTwitter.ts22
-rw-r--r--src/plugins/noCanaryMessageLinks.ts3
-rw-r--r--src/utils/constants.ts4
3 files changed, 28 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) {
diff --git a/src/utils/constants.ts b/src/utils/constants.ts
index e263cc0..5d8ac60 100644
--- a/src/utils/constants.ts
+++ b/src/utils/constants.ts
@@ -34,5 +34,9 @@ export const Devs = Object.freeze({
Glitch: {
name: "Glitchy",
id: 269567451199569920n
+ },
+ Samu: {
+ name: "Samu",
+ id: 702973430449832038n
}
});