decord/source/modules/voice_calls/CallIdleManager.tsx
2026-08-12 06:57:52 +00:00

115 lines
4.5 KiB
TypeScript

// Module ID: 16466
// Function ID: 16467
// Name: disconnect
// Dependencies: [1390, 1391, 4360, 4416, 6959, 1236, 5169, 5300, 4229, 2]
// Module 16466 (disconnect)
import participantFromServer from "participantFromServer";
import ensureGuildLoaded from "ensureGuildLoaded";
import updateVoiceState from "updateVoiceState";
import getVoiceStatesForGuild from "getVoiceStatesForGuild";
import "initialize";
let require = arg1;
function disconnect() {
currentClientVoiceChannelId = currentClientVoiceChannelId.getCurrentClientVoiceChannelId(null);
let flag = false;
if (null != currentClientVoiceChannelId) {
channel = channel.getChannel(currentClientVoiceChannelId);
const tmp3 = null == channel || !channel.isPrivate();
let tmp4 = !tmp3;
if (!tmp3) {
let tmp5 = channel.recipients.length <= 1;
if (tmp5) {
let tmp7 = getVoiceStatesForGuild.countVoiceStatesForChannel(currentClientVoiceChannelId) <= 1;
if (tmp7) {
tmp7 = null == selfEmbeddedActivityForChannel.getSelfEmbeddedActivityForChannel(currentClientVoiceChannelId);
}
tmp5 = tmp7;
}
tmp4 = tmp5;
}
flag = tmp4;
}
if (flag) {
const currentClientVoiceChannelId1 = currentClientVoiceChannelId.getCurrentClientVoiceChannelId(null);
if (null != currentClientVoiceChannelId1) {
const intl = require(1236) /* getSystemLocale */.intl;
importDefault(6959).sendBotMessage(currentClientVoiceChannelId1, intl.formatToPlainString(require(1236) /* getSystemLocale */.t.XYof5G, { number: 3 }));
const obj3 = importDefault(6959);
const voiceChannel = importDefault(5169).selectVoiceChannel(null);
const obj4 = importDefault(5169);
}
}
}
let c7 = 180000;
let prototype = function CallIdleManager() {
const applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
const require = applyArgumentsResult;
const timeout = new require(4229) /* start */.Timeout();
applyArgumentsResult.idleTimeout = timeout;
applyArgumentsResult.handleConnectionClosed = function handleConnectionClosed() {
const idleTimeout = applyArgumentsResult.idleTimeout;
idleTimeout.stop();
};
applyArgumentsResult.handleEmbeddedActivityDisconnect = function handleEmbeddedActivityDisconnect() {
const currentClientVoiceChannelId = outer1_5.getCurrentClientVoiceChannelId(null);
let flag = false;
if (null != currentClientVoiceChannelId) {
const channel = outer1_4.getChannel(currentClientVoiceChannelId);
const tmp3 = null == channel || !channel.isPrivate();
let tmp4 = !tmp3;
if (!tmp3) {
let tmp5 = channel.recipients.length <= 1;
if (tmp5) {
let tmp7 = outer1_6.countVoiceStatesForChannel(currentClientVoiceChannelId) <= 1;
if (tmp7) {
tmp7 = null == outer1_3.getSelfEmbeddedActivityForChannel(currentClientVoiceChannelId);
}
tmp5 = tmp7;
}
tmp4 = tmp5;
}
flag = tmp4;
}
if (flag) {
const idleTimeout = applyArgumentsResult.idleTimeout;
idleTimeout.start(outer1_7, outer1_8, true);
}
};
applyArgumentsResult.handleVoiceStateUpdates = function handleVoiceStateUpdates() {
const currentClientVoiceChannelId = outer1_5.getCurrentClientVoiceChannelId(null);
let flag = false;
if (null != currentClientVoiceChannelId) {
const channel = outer1_4.getChannel(currentClientVoiceChannelId);
const tmp3 = null == channel || !channel.isPrivate();
let tmp4 = !tmp3;
if (!tmp3) {
let tmp5 = channel.recipients.length <= 1;
if (tmp5) {
let tmp7 = outer1_6.countVoiceStatesForChannel(currentClientVoiceChannelId) <= 1;
if (tmp7) {
tmp7 = null == outer1_3.getSelfEmbeddedActivityForChannel(currentClientVoiceChannelId);
}
tmp5 = tmp7;
}
tmp4 = tmp5;
}
flag = tmp4;
}
const idleTimeout = applyArgumentsResult.idleTimeout;
if (flag) {
idleTimeout.start(outer1_7, outer1_8, false);
} else {
idleTimeout.stop();
}
};
applyArgumentsResult.actions = { VOICE_STATE_UPDATES: applyArgumentsResult.handleVoiceStateUpdates, CONNECTION_CLOSED: applyArgumentsResult.handleConnectionClosed, EMBEDDED_ACTIVITY_CLOSE: applyArgumentsResult.handleEmbeddedActivityDisconnect };
return applyArgumentsResult;
}.prototype;
class prototype extends tmp2 {
}
prototype = new prototype();
const result = require("updateVoiceState").fileFinishedImporting("modules/voice_calls/CallIdleManager.tsx");
export default prototype;