decord/source/modules/gateway/LocalVoiceStateManager.tsx

91 lines
3.7 KiB
TypeScript
Raw Normal View History

2026-09-03 10:05:34 +00:00
// Module ID: 13567
// Function ID: 13568
2026-07-29 08:29:29 +00:00
// Name: guildId
2026-09-03 10:05:34 +00:00
// Dependencies: [1386, 4529, 4575, 673, 13565, 4166, 1398, 4539, 2]
2026-07-20 16:05:17 +00:00
2026-09-03 10:05:34 +00:00
// Module 13567 (guildId)
2026-09-02 09:53:35 +00:00
import hasFlag from "hasFlag" /* 1398 */;
2026-09-01 10:26:29 +00:00
import explicitContentFromProto from "explicitContentFromProto" /* 4166 */;
import isClipsEnabled from "isClipsEnabled" /* 4539 */;
2026-09-03 10:05:34 +00:00
import shouldCommitDefault from "shouldCommit" /* 13565 */;
2026-09-02 09:53:35 +00:00
import closure_2 from "ensureGuildLoaded" /* 1386 */;
2026-09-01 10:26:29 +00:00
import closure_3 from "_detectH265HardwareDecode" /* 4529 */;
import closure_4 from "initialize" /* 4575 */;
2026-09-02 09:53:35 +00:00
import ME from "ME" /* 673 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-08-25 06:04:03 +00:00
({ ChannelTypes: c5, VoiceFlags: closure_6 } = ME);
2026-08-24 06:08:38 +00:00
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-08-25 06:04:03 +00:00
const setFlagResult = hasFlag.setFlag(0, constants2.ALLOW_VOICE_RECORDING, setting);
const obj2 = hasFlag;
return obj2.setFlag(setFlagResult, constants2.CLIPS_ENABLED, isClipsEnabled.isClipsEnabled());
2026-07-29 08:29:29 +00:00
};
prototype["getInitialState"] = function getInitialState() {
2026-08-25 06:04:03 +00:00
return { guildId: null, channelId: null, selfMute: closure_3.isSelfMute(), selfDeaf: closure_3.isSelfDeaf(), selfVideo: closure_3.isVideoEnabled(), preferredRegion: null, preferredRegions: null, videoStreamParameters: null, flags: 0 };
2026-07-29 08:29:29 +00:00
};
prototype["getNextState"] = function getNextState(guildId) {
2026-08-25 06:04:03 +00:00
return { guildId: guildId.guildId, channelId: guildId.channelId, selfMute: closure_3.isSelfMute(), selfDeaf: closure_3.isSelfDeaf(), selfVideo: closure_3.isVideoEnabled(), preferredRegion: store.getPreferredRegion(), preferredRegions: store.getPreferredRegions(), videoStreamParameters: closure_3.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;
}
2026-08-25 06:04:03 +00:00
if (type === constants.GUILD_STAGE_VOICE) {
2026-07-29 08:29:29 +00:00
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-25 06:04:03 +00:00
const 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;