decord/source/modules/calls/useCanRing.tsx

172 lines
5.4 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 8915
// Function ID: 8916
2026-07-20 16:05:17 +00:00
// Name: useCanRingToGuildVoiceChannel
2026-07-29 08:29:29 +00:00
// Dependencies: [1218, 4866, 1372, 1942, 5003, 3817, 4276, 3826, 4205, 676, 589, 8916, 5006, 4631, 2]
2026-07-20 16:05:17 +00:00
// Exports: canRingUsersInChannel, useCanRing
2026-07-29 08:29:29 +00:00
// Module 8915 (useCanRingToGuildVoiceChannel)
import fetchFingerprint from "fetchFingerprint";
import callConnect from "callConnect";
import ensureGuildLoaded from "ensureGuildLoaded";
import trackCommunicationDisabled from "trackCommunicationDisabled";
import recomputeGuild from "recomputeGuild";
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
import sortActivity from "sortActivity";
import upsertRelationship from "upsertRelationship";
import updateVoiceState from "updateVoiceState";
2026-07-23 10:11:24 +00:00
import ME from "ME";
let closure_12;
let closure_14;
2026-07-29 08:29:29 +00:00
let map1;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function useCanRingToGuildVoiceChannel(user, DisconnectedUserRow, stateFromStores) {
2026-07-23 10:11:24 +00:00
const _require = user;
2026-07-29 08:29:29 +00:00
let str = DisconnectedUserRow;
2026-07-20 16:05:17 +00:00
if (DisconnectedUserRow === undefined) {
str = "useCanRingToGuildVoiceChannel";
}
const importDefault = stateFromStores;
2026-07-29 08:29:29 +00:00
const items = [getUncachedChannelPermissions];
stateFromStores = _require(589).useStateFromStores(items, () => {
let tmp2 = null != stateFromStores;
if (tmp2) {
tmp2 = stateFromStores(outer1_2[12])(tmp, outer1_8);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
const obj = _require(589);
const items1 = [trackCommunicationDisabled, recomputeGuild];
const stateFromStores1 = _require(589).useStateFromStores(items1, () => {
2026-07-20 16:05:17 +00:00
let guild_id;
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-23 10:11:24 +00:00
guild_id = stateFromStores.guild_id;
2026-07-20 16:05:17 +00:00
}
if (null == guild_id) {
return false;
} else {
2026-07-23 10:11:24 +00:00
let canChat = null != outer1_6.getMember(guild_id, user.id);
2026-07-20 16:05:17 +00:00
if (canChat) {
2026-07-23 10:11:24 +00:00
canChat = outer1_7.getCheck(guild_id).canChat;
2026-07-20 16:05:17 +00:00
}
return canChat;
}
});
let id;
2026-07-29 08:29:29 +00:00
const obj2 = _require(589);
const tmp4 = importDefault;
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
id = stateFromStores.id;
}
2026-07-29 08:29:29 +00:00
const tmp5 = importDefault(4631);
2026-07-20 16:05:17 +00:00
let guild_id;
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
guild_id = stateFromStores.guild_id;
}
2026-07-29 08:29:29 +00:00
let enabled = tmp4(8916).useExperiment({ guildId: guild_id, location: str }).enabled;
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
const type = stateFromStores.type;
}
if (enabled) {
enabled = type === constants.GUILD_VOICE;
}
if (enabled) {
enabled = stateFromStores1;
}
if (enabled) {
enabled = stateFromStores;
}
if (enabled) {
2026-07-29 08:29:29 +00:00
enabled = !tmp5(id).needSubscriptionToAccess;
2026-07-20 16:05:17 +00:00
}
return enabled;
}
2026-07-29 08:29:29 +00:00
({ ChannelTypes: closure_12, ChannelTypesSets: map1, StatusTypes: closure_14 } = ME);
const result = require("ensureGuildLoaded").fileFinishedImporting("modules/calls/useCanRing.tsx");
2026-07-20 16:05:17 +00:00
export const useCanRing = function useCanRing(user, DisconnectedUserRow, selectedVoiceChannelId) {
2026-07-23 10:11:24 +00:00
const _require = user;
2026-07-29 08:29:29 +00:00
let str = DisconnectedUserRow;
2026-07-20 16:05:17 +00:00
if (DisconnectedUserRow === undefined) {
str = "useCanRing";
}
2026-07-23 10:11:24 +00:00
let closure_1 = selectedVoiceChannelId;
let stateFromStores;
2026-07-29 08:29:29 +00:00
const items = [ensureGuildLoaded];
2026-07-23 10:11:24 +00:00
stateFromStores = _require(stateFromStores[10]).useStateFromStores(items, () => outer1_5.getChannel(closure_1));
const obj = _require(stateFromStores[10]);
2026-07-29 08:29:29 +00:00
const items1 = [fetchFingerprint];
2026-07-23 10:11:24 +00:00
const stateFromStores1 = _require(stateFromStores[10]).useStateFromStores(items1, () => outer1_3.getId() === user.id);
const obj2 = _require(stateFromStores[10]);
2026-07-29 08:29:29 +00:00
const items2 = [upsertRelationship];
2026-07-23 10:11:24 +00:00
let stateFromStores2 = _require(stateFromStores[10]).useStateFromStores(items2, () => outer1_10.isFriend(user.id));
const obj3 = _require(stateFromStores[10]);
2026-07-29 08:29:29 +00:00
const items3 = [sortActivity];
2026-07-20 16:05:17 +00:00
let type;
2026-07-23 10:11:24 +00:00
const stateFromStores3 = _require(stateFromStores[10]).useStateFromStores(items3, () => {
let tmp = outer1_9.getStatus(user.id) === outer1_14.DND;
2026-07-20 16:05:17 +00:00
if (tmp) {
let guild_id;
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
guild_id = stateFromStores.guild_id;
}
tmp = null != guild_id;
}
return tmp;
});
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
type = stateFromStores.type;
}
let hasItem = null != type;
if (hasItem) {
const CALLABLE = constants2.CALLABLE;
hasItem = CALLABLE.has(type);
}
let tmp8 = useCanRingToGuildVoiceChannel(user, str, stateFromStores);
if (stateFromStores2) {
stateFromStores2 = !stateFromStores3;
}
if (stateFromStores2) {
stateFromStores2 = !stateFromStores1;
}
if (stateFromStores2) {
stateFromStores2 = !user.bot;
}
if (stateFromStores2) {
stateFromStores2 = !user.system;
}
if (stateFromStores2) {
stateFromStores2 = !user.isProvisional;
}
if (stateFromStores2) {
if (!tmp8) {
tmp8 = hasItem;
}
stateFromStores2 = tmp8;
}
return stateFromStores2;
};
export const canRingUsersInChannel = function canRingUsersInChannel(channel) {
const CALLABLE = constants2.CALLABLE;
if (CALLABLE.has(channel.type)) {
2026-07-29 08:29:29 +00:00
call = call.getCall(channel.id);
return null != call && null != call.messageId && !call.isCallUnavailable(channel.id);
2026-07-20 16:05:17 +00:00
} else if (tmp === tmp2) {
2026-07-29 08:29:29 +00:00
let obj = importDefault(8916);
obj = { guildId: null, location: "ring" };
obj[0] = channel.guild_id;
2026-07-20 16:05:17 +00:00
let enabled = obj.getCurrentConfig(obj).enabled;
2026-07-23 10:11:24 +00:00
voiceState = voiceState.getVoiceState(channel.guild_id, id.getId());
2026-07-20 16:05:17 +00:00
if (enabled) {
enabled = null != voiceState;
}
if (enabled) {
enabled = voiceState.channelId === channel.id;
}
return enabled;
} else {
return false;
}
};
export { useCanRingToGuildVoiceChannel };