From 010523eeace659fe95c85961e6f3fee5c5596a3f Mon Sep 17 00:00:00 2001 From: megumin Date: Thu, 10 Nov 2022 13:04:06 +0000 Subject: [PATCH] feat(plugins): add vc effect event to moyai plugin (#199) --- src/plugins/moyai.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/plugins/moyai.ts b/src/plugins/moyai.ts index 0a8a51fff..5427fed62 100644 --- a/src/plugins/moyai.ts +++ b/src/plugins/moyai.ts @@ -42,6 +42,15 @@ interface IReactionAdd { emoji: ReactionEmoji; } +interface IVoiceChannelEffectSendEvent { + type: string; + emoji?: ReactionEmoji; // Just in case... + channelId: string; + userId: string; + animationType: number; + animationId: number; +} + const MOYAI = "🗿"; const MOYAI_URL = "https://raw.githubusercontent.com/MeguminSama/VencordPlugins/main/plugins/moyai/moyai.mp3"; @@ -77,14 +86,24 @@ export default definePlugin({ boom(); }, + onVoiceChannelEffect(e: IVoiceChannelEffectSendEvent) { + if (!e.emoji?.name) return; + const name = e.emoji.name.toLowerCase(); + if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai")) return; + + boom(); + }, + start() { FluxDispatcher.subscribe("MESSAGE_CREATE", this.onMessage); FluxDispatcher.subscribe("MESSAGE_REACTION_ADD", this.onReaction); + FluxDispatcher.subscribe("VOICE_CHANNEL_EFFECT_SEND", this.onVoiceChannelEffect); }, stop() { FluxDispatcher.unsubscribe("MESSAGE_CREATE", this.onMessage); FluxDispatcher.unsubscribe("MESSAGE_REACTION_ADD", this.onReaction); + FluxDispatcher.unsubscribe("VOICE_CHANNEL_EFFECT_SEND", this.onVoiceChannelEffect); }, options: {