mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
hotfix
This commit is contained in:
1 parent
082cdbc3b1
commit
b75ea56ca9
5 files changed
+222
-47
No files matched your search
+22
-7
@@ -16,13 +16,28 @@ export async function run(msg, data) {
|
||||
|
||||
const channelCounts = new Map();
|
||||
|
||||
for (const [, state] of this.observedVoiceUsers) {
|
||||
if (state.guildId !== guild.id) continue;
|
||||
channelCounts.set(state.channelId, (channelCounts.get(state.channelId) ?? 0) + 1);
|
||||
}
|
||||
for (const [, state] of this.observedVoiceBots) {
|
||||
if (state.guildId !== guild.id) continue;
|
||||
channelCounts.set(state.channelId, (channelCounts.get(state.channelId) ?? 0) + 1);
|
||||
// Use VoiceStateCache API for both humans and bots
|
||||
const cache = this.voiceCache ?? this.observedVoiceUsers;
|
||||
if (cache) {
|
||||
// Humans
|
||||
if (typeof cache.iterateHumanUsers === "function") {
|
||||
for (const [, state] of cache.iterateHumanUsers()) {
|
||||
if (state.guildId !== guild.id) continue;
|
||||
channelCounts.set(state.channelId, (channelCounts.get(state.channelId) ?? 0) + 1);
|
||||
}
|
||||
} else {
|
||||
for (const [, state] of cache) {
|
||||
if (state.guildId !== guild.id) continue;
|
||||
channelCounts.set(state.channelId, (channelCounts.get(state.channelId) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
// Bots
|
||||
if (typeof cache.iterateBotUsers === "function") {
|
||||
for (const [, state] of cache.iterateBotUsers()) {
|
||||
if (state.guildId !== guild.id) continue;
|
||||
channelCounts.set(state.channelId, (channelCounts.get(state.channelId) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (channelCounts.size === 0) {
|
||||
|
||||
Reference in new issue
Block a user