aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegumin <megumin.bakaretsurie@gmail.com>2022-11-10 13:04:06 +0000
committerGitHub <noreply@github.com>2022-11-10 14:04:06 +0100
commit010523eeace659fe95c85961e6f3fee5c5596a3f (patch)
tree4c66d42d89c7a56fb66021e50efcb6b52c647748 /src
parent15f12073cf94dd9111bd67742705f0a9721f9424 (diff)
downloadVencord-010523eeace659fe95c85961e6f3fee5c5596a3f.tar.gz
Vencord-010523eeace659fe95c85961e6f3fee5c5596a3f.tar.bz2
Vencord-010523eeace659fe95c85961e6f3fee5c5596a3f.zip
feat(plugins): add vc effect event to moyai plugin (#199)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/moyai.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/moyai.ts b/src/plugins/moyai.ts
index 0a8a51f..5427fed 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: {