decord/source/lib/VoiceStateAnalytics.tsx

152 lines
5.3 KiB
TypeScript
Raw Normal View History

2026-07-24 07:16:23 +00:00
// Module ID: 12805
// Function ID: 99751
2026-07-20 16:05:17 +00:00
// Name: VoiceStateAnalytics
2026-07-23 10:11:24 +00:00
// Dependencies: [6, 7, 4177, 4146, 4203, 4191, 22, 2]
2026-07-20 16:05:17 +00:00
2026-07-24 07:16:23 +00:00
// Module 12805 (VoiceStateAnalytics)
2026-07-23 10:11:24 +00:00
import apply from "apply";
import set from "set";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import closure_6 from "_isNativeReflectConstruct";
import { SpeakingFlags } from "DesktopSources";
const require = arg1;
let tmp2 = (() => {
2026-07-20 16:05:17 +00:00
class VoiceStateAnalytics {
constructor(arg0, arg1) {
2026-07-23 10:11:24 +00:00
tmp = outer1_2(this, VoiceStateAnalytics);
2026-07-20 16:05:17 +00:00
this.maxVoiceStateCount = 1;
set = new Set();
this.totalParticipants = set;
2026-07-23 10:11:24 +00:00
this.speaking = outer1_7.NONE;
2026-07-20 16:05:17 +00:00
this.maxListenerCount = 0;
set1 = new Set();
this.totalListeners = set1;
this.maxSpeakerCount = 0;
this.totalSpeakers = {};
this.userId = arg0;
setChannelIdResult = this.setChannelId(arg1);
return;
}
}
let obj = {
key: "updateVoiceStates",
value(arg0, arg1) {
const self = this;
if (arg1 === this.channelId) {
const totalParticipants = self.totalParticipants;
totalParticipants.add(arg0);
const _Math = Math;
2026-07-23 10:11:24 +00:00
self.maxVoiceStateCount = Math.max(outer1_6.countVoiceStatesForChannel(arg1), self.maxVoiceStateCount);
2026-07-20 16:05:17 +00:00
} else {
if (tmp2) {
2026-07-23 10:11:24 +00:00
self.totalSpeakers[arg0] = outer1_7.NONE;
2026-07-20 16:05:17 +00:00
}
if (tmp4) {
self.setChannelId(arg1);
}
2026-07-23 10:11:24 +00:00
tmp2 = null == arg1 && arg0 in self.totalSpeakers;
tmp4 = arg0 === self.userId && null != arg1;
2026-07-20 16:05:17 +00:00
}
}
};
2026-07-23 10:11:24 +00:00
let items = [obj, , , , ];
2026-07-20 16:05:17 +00:00
obj = {
key: "getStats",
value() {
return { max_voice_state_count: this.maxVoiceStateCount, total_voice_state_count: this.totalParticipants.size, max_listener_count: this.maxListenerCount, total_listener_count: this.totalListeners.size, max_speaker_count: this.maxSpeakerCount, total_speaker_count: Object.keys(this.totalSpeakers).length };
}
};
items[1] = obj;
obj = {
key: "getUserVoiceSettingsStats",
2026-07-23 10:11:24 +00:00
value(guildId) {
const settings = outer1_4.getSettings(guildId);
2026-07-20 16:05:17 +00:00
const set = new Set(Object.keys(settings.localMutes));
const set1 = new Set(Object.keys(settings.localVolumes));
set1.delete(this.userId);
set.delete(this.userId);
const obj = {};
let arr = Array.from(set);
2026-07-23 10:11:24 +00:00
obj.num_local_voice_user_mutes = VoiceStateAnalytics(outer1_1[6]).intersection(arr, Array.from(this.totalParticipants)).length;
const obj4 = VoiceStateAnalytics(outer1_1[6]);
2026-07-20 16:05:17 +00:00
arr = Array.from(set1);
2026-07-23 10:11:24 +00:00
obj.num_local_voice_volumes = VoiceStateAnalytics(outer1_1[6]).intersection(arr, Array.from(this.totalParticipants)).length;
2026-07-20 16:05:17 +00:00
return obj;
}
};
items[2] = obj;
items[3] = {
key: "setSpeaking",
value(arg0, speaking) {
2026-07-23 10:11:24 +00:00
let self = this;
self = this;
if (speaking !== outer1_7.NONE) {
const voiceStateForChannel = outer1_5.getVoiceStateForChannel(self.channelId, arg0);
2026-07-20 16:05:17 +00:00
if (null != voiceStateForChannel) {
if (!voiceStateForChannel.selfMute) {
if (!voiceStateForChannel.mute) {
self.totalSpeakers[arg0] = speaking;
const _Object = Object;
let values = Object.values(self.totalSpeakers);
const _Math = Math;
2026-07-23 10:11:24 +00:00
self.maxSpeakerCount = Math.max(self.maxSpeakerCount, values.filter((arg0) => arg0 !== outer2_7.NONE).length);
2026-07-20 16:05:17 +00:00
}
}
}
} else if (arg0 in self.totalSpeakers) {
2026-07-23 10:11:24 +00:00
self.totalSpeakers[arg0] = outer1_7.NONE;
2026-07-20 16:05:17 +00:00
}
if (self.userId === arg0) {
if (speaking !== self.speaking) {
2026-07-23 10:11:24 +00:00
if (speaking !== outer1_7.NONE) {
2026-07-20 16:05:17 +00:00
const _Object2 = Object;
2026-07-23 10:11:24 +00:00
values = Object.values(outer1_5.getVoiceStatesForChannel(self.channelId));
2026-07-20 16:05:17 +00:00
const found = values.filter((selfDeaf) => !selfDeaf.selfDeaf && !selfDeaf.deaf);
const item = found.forEach((userId) => {
const totalListeners = self.totalListeners;
return totalListeners.add(userId.userId);
});
const _Math2 = Math;
self.maxListenerCount = Math.max(found.length, self.maxListenerCount);
}
self.speaking = speaking;
}
}
}
};
items[4] = {
key: "setChannelId",
value(channelId) {
2026-07-23 10:11:24 +00:00
let self = this;
self = this;
2026-07-20 16:05:17 +00:00
if (channelId !== this.channelId) {
self.channelId = channelId;
const _Set = Set;
const items = [self.userId];
const set = new Set(items);
self.totalParticipants = set;
const _Object = Object;
2026-07-23 10:11:24 +00:00
const keys = Object.keys(outer1_5.getVoiceStatesForChannel(self.channelId));
2026-07-20 16:05:17 +00:00
const item = keys.forEach((arg0) => {
const totalParticipants = self.totalParticipants;
return totalParticipants.add(arg0);
});
self.maxVoiceStateCount = keys.length;
2026-07-23 10:11:24 +00:00
self.speaking = outer1_7.NONE;
2026-07-20 16:05:17 +00:00
self.maxListenerCount = 0;
const _Set2 = Set;
const set1 = new Set();
self.totalListeners = set1;
self.maxSpeakerCount = 0;
self.totalSpeakers = {};
}
}
};
return callback(VoiceStateAnalytics, items);
2026-07-23 10:11:24 +00:00
})();
const result = require("_isNativeReflectConstruct").fileFinishedImporting("lib/VoiceStateAnalytics.tsx");
2026-07-20 16:05:17 +00:00
export default tmp2;