mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-17 10:27:03 -04:00
fxTwitter (plugin) (#80)
Co-authored-by: splatterxl <splatterxl@outlook.ie> Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
parent
124d1ad9c7
commit
54198b1a4a
3 changed files with 28 additions and 1 deletions
22
src/plugins/fxTwitter.ts
Normal file
22
src/plugins/fxTwitter.ts
Normal file
|
@ -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);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue