diff options
author | Vendicated <vendicated@riseup.net> | 2022-08-31 22:08:05 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-08-31 22:08:05 +0200 |
commit | f60ccb766f30e7518bc348013b72f071f86ecbc6 (patch) | |
tree | 5c1cdb5dfc1bbdc620f034308534eb19e0bcb881 /src/plugins/nitroBypass.ts | |
parent | bac8a648b6012e221fd2150062d2080b9ed0d702 (diff) | |
download | Vencord-f60ccb766f30e7518bc348013b72f071f86ecbc6.tar.gz Vencord-f60ccb766f30e7518bc348013b72f071f86ecbc6.tar.bz2 Vencord-f60ccb766f30e7518bc348013b72f071f86ecbc6.zip |
Add Plugin.start, make Settings actually start/stop plugins
Diffstat (limited to 'src/plugins/nitroBypass.ts')
-rw-r--r-- | src/plugins/nitroBypass.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/nitroBypass.ts b/src/plugins/nitroBypass.ts index 5d128a4..d5c4d22 100644 --- a/src/plugins/nitroBypass.ts +++ b/src/plugins/nitroBypass.ts @@ -1,4 +1,4 @@ -import { addPreSendListener, addPreEditListener } from "../api/MessageEvents"; +import { addPreSendListener, addPreEditListener, SendListener, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; import { findByProps } from "../webpack"; import definePlugin from "../utils/types"; @@ -22,6 +22,7 @@ export default definePlugin({ }) }, ], + start() { const { getCustomEmojiById } = findByProps("getCustomEmojiById"); @@ -33,7 +34,7 @@ export default definePlugin({ delete x.guildPremiumTier; }); - addPreSendListener((_, messageObj) => { + this.preSend = addPreSendListener((_, messageObj) => { const guildId = window.location.href.split("channels/")[1].split("/")[0]; for (const emoji of messageObj.validNonShortcutEmojis) { if (!emoji.require_colons) continue; @@ -44,7 +45,7 @@ export default definePlugin({ messageObj.content = messageObj.content.replace(emojiString, ` ${url} `); } }); - addPreEditListener((_, __, messageObj) => { + this.preEdit = addPreEditListener((_, __, messageObj) => { const guildId = window.location.href.split("channels/")[1].split("/")[0]; for (const [emojiStr, _, emojiId] of messageObj.content.matchAll(/(?<!\\)<a?:(\w+):(\d+)>/ig)) { @@ -56,4 +57,9 @@ export default definePlugin({ } }); }, + + stop() { + removePreSendListener(this.preSend); + removePreEditListener(this.preEdit); + } }); |