decord/beta/source/modules/activity_status/useUserVoiceActivity.tsx

263 lines
7.8 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 10238
// Function ID: 10239
// Name: useUserVoiceActivity
2026-10-12 16:32:48 +00:00
// Dependencies: [2065, 4750, 5113, 1096, 558, 576, 504, 2]
2026-10-02 13:37:24 +00:00
// Exports: canViewUserVoiceChannel, getUserVoiceState
2026-10-12 16:32:48 +00:00
// Module 10238 (useUserVoiceActivity)
2026-10-07 22:43:51 +00:00
import Constants from "Constants" /* 1096 */;
2026-10-12 16:32:48 +00:00
import ChannelStore_mod from "ChannelStore" /* 2065 */;
import PermissionStore_mod from "PermissionStore" /* 4750 */;
import VoiceStateStore_mod from "VoiceStateStore" /* 5113 */;
2026-10-02 13:37:24 +00:00
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
function getVisibleUserVoiceActivity(arg0, arg1) {
2026-10-01 14:13:23 +00:00
let guildId;
let includeNonDiscoverable;
let tmp4;
let userId;
let tmp = arg1;
if (arg1 === undefined) {
tmp = closure_6;
}
({ userId, guildId, includeNonDiscoverable } = arg0);
if (includeNonDiscoverable === undefined) {
includeNonDiscoverable = false;
}
let tmp3 = tmp;
if (tmp === undefined) {
tmp3 = closure_6;
}
if (null != guildId) {
2026-10-01 14:13:23 +00:00
let channel;
let tmp12;
if (null != userId) {
2026-10-01 14:13:23 +00:00
let voiceState;
const VoiceStateStore2 = tmp3.VoiceStateStore;
if (includeNonDiscoverable) {
2026-10-01 14:13:23 +00:00
voiceState = VoiceStateStore2.getVoiceState(guildId, userId);
} else {
voiceState = VoiceStateStore2.getDiscoverableVoiceState(guildId, userId);
}
2026-10-01 14:13:23 +00:00
tmp4 = voiceState;
}
2026-10-01 14:13:23 +00:00
let tmp7 = tmp;
if (tmp === undefined) {
tmp7 = closure_6;
}
let channelId;
2026-10-01 14:13:23 +00:00
if (tmp4 != null) {
channelId = tmp4.channelId;
}
if (null != channelId) {
2026-10-01 14:13:23 +00:00
ChannelStore = tmp7.ChannelStore;
channel = ChannelStore.getChannel(tmp4.channelId);
}
2026-10-01 14:13:23 +00:00
if (tmp === undefined) {
tmp = closure_6;
}
2026-10-01 14:13:23 +00:00
let tmp9 = null != tmp4;
if (tmp9) {
let isPrivateResult;
if (channel != null) {
isPrivateResult = channel.isPrivate();
}
if (!isPrivateResult) {
PermissionStore = tmp.PermissionStore;
isPrivateResult = PermissionStore.can(Permissions.VIEW_CHANNEL, channel);
}
2026-10-01 14:13:23 +00:00
tmp9 = isPrivateResult;
}
2026-10-01 14:13:23 +00:00
if (tmp9) {
tmp12 = { voiceState: tmp4, voiceChannel: channel };
const obj = { voiceState: tmp4, voiceChannel: channel };
} else {
2026-10-01 14:13:23 +00:00
tmp12 = closure_7;
}
2026-10-01 14:13:23 +00:00
return tmp12;
}
if (null != userId) {
let voiceStateForUser;
VoiceStateStore = tmp3.VoiceStateStore;
if (includeNonDiscoverable) {
2026-10-01 14:13:23 +00:00
voiceStateForUser = VoiceStateStore.getVoiceStateForUser(userId);
} else {
voiceStateForUser = VoiceStateStore.getDiscoverableVoiceStateForUser(userId);
}
2026-10-01 14:13:23 +00:00
tmp4 = voiceStateForUser;
}
}
2026-10-01 14:13:23 +00:00
let ChannelStore = ChannelStore_mod;
let PermissionStore = PermissionStore_mod;
let VoiceStateStore = VoiceStateStore_mod;
const Permissions = Constants.Permissions;
let closure_6 = { ChannelStore, PermissionStore, VoiceStateStore };
2026-10-12 16:32:48 +00:00
let closure_7 = Object.freeze({ voiceState: "pos", voiceChannel: "sk" });
2026-10-02 13:37:24 +00:00
function getUserVoiceState(arg0) {
2026-10-01 14:13:23 +00:00
let guildId;
let includeNonDiscoverable;
let tmp2;
let userId;
({ userId, guildId, includeNonDiscoverable } = arg0);
if (includeNonDiscoverable === undefined) {
includeNonDiscoverable = false;
}
let tmp = arg1;
if (arg1 === undefined) {
tmp = closure_6;
}
if (null != guildId) {
if (null != userId) {
2026-10-01 14:13:23 +00:00
let voiceState;
const VoiceStateStore2 = tmp.VoiceStateStore;
if (includeNonDiscoverable) {
2026-10-01 14:13:23 +00:00
voiceState = VoiceStateStore2.getVoiceState(guildId, userId);
} else {
voiceState = VoiceStateStore2.getDiscoverableVoiceState(guildId, userId);
}
2026-10-01 14:13:23 +00:00
tmp2 = voiceState;
}
2026-10-01 14:13:23 +00:00
return tmp2;
}
if (null != userId) {
2026-10-01 14:13:23 +00:00
let voiceStateForUser;
VoiceStateStore = tmp.VoiceStateStore;
if (includeNonDiscoverable) {
2026-10-01 14:13:23 +00:00
voiceStateForUser = VoiceStateStore.getVoiceStateForUser(userId);
} else {
voiceStateForUser = VoiceStateStore.getDiscoverableVoiceStateForUser(userId);
}
2026-10-01 14:13:23 +00:00
tmp2 = voiceStateForUser;
}
2026-10-02 13:37:24 +00:00
}
2026-10-12 16:32:48 +00:00
const tmp5 = ReactCompilerGating.isReactCompilerEnabled() ? (function useUserVoiceActivity(userId) {
2026-10-02 13:37:24 +00:00
let first;
let guildId;
let obj = userId(guildId[5]);
const cResult = obj.c(6);
const tmp = userId;
userId = userId.userId;
const tmp2 = guildId;
guildId = userId.guildId;
const includeNonDiscoverable = userId.includeNonDiscoverable;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [includeNonDiscoverable, PermissionStore, VoiceStateStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] === guildId) {
if (cResult[2] === includeNonDiscoverable) {
let tmp8;
let tmp9;
if (cResult[3] === userId) {
tmp8 = cResult[4];
tmp9 = cResult[5];
}
const tmpResult = tmp(tmp2[6]);
return tmpResult.useStateFromStoresObject(first, tmp8, tmp9);
}
}
const fn = function l() {
const obj = { userId, guildId, includeNonDiscoverable };
const obj2 = { ChannelStore, PermissionStore, VoiceStateStore };
return getVisibleUserVoiceActivity(obj, obj2);
};
const items1 = [guildId, userId, includeNonDiscoverable];
cResult[1] = guildId;
cResult[2] = includeNonDiscoverable;
cResult[3] = userId;
cResult[4] = fn;
cResult[5] = items1;
tmp9 = items1;
tmp8 = fn;
2026-10-12 16:32:48 +00:00
}) : (function useUserVoiceActivity(userId) {
2026-10-02 13:37:24 +00:00
userId = userId.userId;
const guildId = userId.guildId;
const includeNonDiscoverable = userId.includeNonDiscoverable;
let obj = userId(guildId[6]);
const items = [includeNonDiscoverable, PermissionStore, VoiceStateStore];
const items1 = [guildId, userId, includeNonDiscoverable];
return obj.useStateFromStoresObject(items, () => {
const obj = { userId, guildId, includeNonDiscoverable };
const obj2 = { ChannelStore, PermissionStore, VoiceStateStore };
return getVisibleUserVoiceActivity(obj, obj2);
}, items1);
});
const result = size.fileFinishedImporting("modules/activity_status/useUserVoiceActivity.tsx");
export default tmp5;
export { getUserVoiceState };
export const canViewUserVoiceChannel = function canViewUserVoiceChannel(arg0) {
2026-10-01 14:13:23 +00:00
let guildId;
let includeNonDiscoverable;
let tmp4;
let userId;
let tmp = arg1;
if (arg1 === undefined) {
tmp = closure_6;
}
({ userId, guildId, includeNonDiscoverable } = arg0);
if (includeNonDiscoverable === undefined) {
includeNonDiscoverable = false;
}
let tmp3 = tmp;
if (tmp === undefined) {
tmp3 = closure_6;
}
if (null != guildId) {
2026-10-01 14:13:23 +00:00
let channel;
if (null != userId) {
2026-10-01 14:13:23 +00:00
let voiceState;
const VoiceStateStore2 = tmp3.VoiceStateStore;
if (includeNonDiscoverable) {
2026-10-01 14:13:23 +00:00
voiceState = VoiceStateStore2.getVoiceState(guildId, userId);
} else {
voiceState = VoiceStateStore2.getDiscoverableVoiceState(guildId, userId);
}
2026-10-01 14:13:23 +00:00
tmp4 = voiceState;
}
2026-10-01 14:13:23 +00:00
let tmp7 = tmp;
if (tmp === undefined) {
tmp7 = closure_6;
}
let channelId;
2026-10-01 14:13:23 +00:00
if (tmp4 != null) {
channelId = tmp4.channelId;
}
if (null != channelId) {
2026-10-01 14:13:23 +00:00
ChannelStore = tmp7.ChannelStore;
channel = ChannelStore.getChannel(tmp4.channelId);
}
2026-10-01 14:13:23 +00:00
if (tmp === undefined) {
tmp = closure_6;
}
2026-10-01 14:13:23 +00:00
let tmp9 = null != tmp4;
if (tmp9) {
let isPrivateResult;
if (channel != null) {
isPrivateResult = channel.isPrivate();
}
if (!isPrivateResult) {
PermissionStore = tmp.PermissionStore;
isPrivateResult = PermissionStore.can(Permissions.VIEW_CHANNEL, channel);
}
2026-10-01 14:13:23 +00:00
tmp9 = isPrivateResult;
}
2026-10-01 14:13:23 +00:00
return tmp9;
}
if (null != userId) {
let voiceStateForUser;
VoiceStateStore = tmp3.VoiceStateStore;
if (includeNonDiscoverable) {
2026-10-01 14:13:23 +00:00
voiceStateForUser = VoiceStateStore.getVoiceStateForUser(userId);
} else {
voiceStateForUser = VoiceStateStore.getDiscoverableVoiceStateForUser(userId);
}
2026-10-01 14:13:23 +00:00
tmp4 = voiceStateForUser;
}
};
export { getVisibleUserVoiceActivity };