From 2cf11e2784c7f6534c3d2faba4d4dcbbaf203789 Mon Sep 17 00:00:00 2001 From: paring Date: Thu, 29 Jun 2023 01:46:26 +0900 Subject: [PATCH] fix: skip bot in counter --- src/index.ts | 1 + src/utils/wrapper/VoiceState.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index 40939dc..9e04709 100644 --- a/src/index.ts +++ b/src/index.ts @@ -117,6 +117,7 @@ client.on(GatewayDispatchEvents.VoiceStateUpdate, async ({ data, api }) => { hasMe = true continue } + if (state.bot) continue counter++ } diff --git a/src/utils/wrapper/VoiceState.ts b/src/utils/wrapper/VoiceState.ts index fdfefaf..c377005 100644 --- a/src/utils/wrapper/VoiceState.ts +++ b/src/utils/wrapper/VoiceState.ts @@ -31,6 +31,7 @@ export class VoiceState { channelId!: Snowflake | null mute!: boolean + bot!: boolean constructor(data: GuildVoiceState, public guild: Snowflake) { this.update(data) @@ -40,5 +41,6 @@ export class VoiceState { this.channelId = data.channel_id this.id = data.user_id this.mute = data.mute || data.self_mute + this.bot = data.member?.user?.bot ?? false } }