decord/source/modules/gateway/LocalVoiceStateManager.tsx

126 lines
4.8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 13285
// Function ID: 13286
2026-07-29 08:29:29 +00:00
// Name: guildId
2026-08-24 06:08:38 +00:00
// Dependencies: [4508, 4658, 1391, 4501, 4570, 676, 13283, 4069, 1403, 4531, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 13285 (guildId)
import hasFlag from "hasFlag" /* 1403 */;
import explicitContentFromProto from "explicitContentFromProto" /* 4069 */;
import isClipsEnabled from "isClipsEnabled" /* 4531 */;
import shouldCommitDefault from "shouldCommit" /* 13283 */;
import closure_2 from "initialize" /* 4508 */;
import closure_3 from "reset" /* 4658 */;
import closure_4 from "ensureGuildLoaded" /* 1391 */;
import closure_5 from "_detectH265HardwareDecode" /* 4501 */;
import closure_6 from "initialize" /* 4570 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
({ ApplicationStreamStates: error, ChannelTypes: closure_8, VoiceFlags: c9 } = ME);
shouldCommitDefault;
2026-07-29 08:29:29 +00:00
class LocalVoiceStateManager extends tmp3 {
constructor(arg0) {
tmp = new LocalVoiceStateManager(new.target);
// ThrowIfThisInitialized (0x7c)
tmp.socket = global;
return tmp;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const prototype = LocalVoiceStateManager.prototype;
Object.defineProperty(prototype, "guildId", {
get: function guildId() {
return this.getState().guildId;
},
set: undefined
});
Object.defineProperty(prototype, "channelId", {
get: function channelId() {
return this.getState().channelId;
},
set: undefined
});
prototype["computeVoiceFlags"] = function computeVoiceFlags() {
2026-08-24 06:08:38 +00:00
const ClipsAllowVoiceRecording = explicitContentFromProto.ClipsAllowVoiceRecording;
2026-07-29 08:29:29 +00:00
const setting = ClipsAllowVoiceRecording.getSetting();
2026-08-24 06:08:38 +00:00
const obj = hasFlag;
2026-07-29 08:29:29 +00:00
const tmp4 = constants3;
2026-08-24 06:08:38 +00:00
const setFlagResult = hasFlag.setFlag(0, constants3.ALLOW_VOICE_RECORDING, setting);
let isClipsEnabledResult = isClipsEnabled.isClipsEnabled();
2026-07-29 08:29:29 +00:00
if (isClipsEnabledResult) {
currentUserActiveStream = currentUserActiveStream.getCurrentUserActiveStream();
let state;
if (currentUserActiveStream != null) {
state = currentUserActiveStream.state;
}
let tmp11 = state === constants.ACTIVE;
if (!tmp11) {
const currentUserActiveStream1 = obj3.getCurrentUserActiveStream();
let state1;
if (currentUserActiveStream1 != null) {
state1 = currentUserActiveStream1.state;
}
tmp11 = state1 === tmp10.PAUSED;
}
isClipsEnabledResult = tmp11;
obj3 = currentUserActiveStream;
}
2026-08-24 06:08:38 +00:00
let tmpResult = tmp(4531);
2026-07-29 08:29:29 +00:00
let result = tmpResult.isDecoupledClipsEnabled();
if (result) {
visibleGame = visibleGame.getVisibleGame();
let windowHandle;
if (visibleGame != null) {
windowHandle = visibleGame.windowHandle;
}
result = null != windowHandle;
}
2026-08-11 06:20:06 +00:00
tmpResult = tmp(1403);
2026-07-29 08:29:29 +00:00
if (!isClipsEnabledResult) {
isClipsEnabledResult = result;
}
return tmpResult.setFlag(setFlagResult, tmp4.CLIPS_ENABLED, isClipsEnabledResult);
};
prototype["getInitialState"] = function getInitialState() {
2026-08-24 06:08:38 +00:00
return { guildId: null, channelId: null, selfMute: closure_5.isSelfMute(), selfDeaf: closure_5.isSelfDeaf(), selfVideo: closure_5.isVideoEnabled(), preferredRegion: null, preferredRegions: null, videoStreamParameters: null, flags: 0 };
2026-07-29 08:29:29 +00:00
};
prototype["getNextState"] = function getNextState(guildId) {
2026-08-24 06:08:38 +00:00
return { guildId: guildId.guildId, channelId: guildId.channelId, selfMute: closure_5.isSelfMute(), selfDeaf: closure_5.isSelfDeaf(), selfVideo: closure_5.isVideoEnabled(), preferredRegion: store.getPreferredRegion(), preferredRegions: store.getPreferredRegions(), videoStreamParameters: closure_5.getVideoStreamParameters(), flags: this.computeVoiceFlags() };
2026-07-29 08:29:29 +00:00
};
prototype["shouldCommit"] = function shouldCommit() {
const socket = this.socket;
return socket.isSessionEstablished();
};
prototype["didCommit"] = function didCommit(state) {
({ guildId, channelId, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, flags } = state);
if (flags === undefined) {
flags = 0;
}
const self = this;
if (selfVideo) {
channel = channel.getChannel(channelId);
let type;
if (channel != null) {
type = channel.type;
}
if (type === constants2.GUILD_STAGE_VOICE) {
const socket2 = self.socket;
const obj = { guildId: null, channelId: null, selfMute: null, selfDeaf: null, selfVideo: null, preferredRegion: null, preferredRegions: null, videoStreamParameters: null, flags: null };
obj[0] = guildId;
obj[1] = channelId;
obj[2] = selfMute;
obj[3] = selfDeaf;
obj[4] = selfVideo;
obj[5] = preferredRegion;
obj[6] = preferredRegions;
obj[7] = state.videoStreamParameters;
obj[8] = flags;
socket2.voiceStateUpdate(obj);
}
}
const socket = self.socket;
socket.voiceStateUpdate({ guildId, channelId, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, flags });
};
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/gateway/LocalVoiceStateManager.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default LocalVoiceStateManager;