decord/source/modules/activity_status/useUserVoiceActivity.tsx

184 lines
5.6 KiB
TypeScript
Raw Normal View History

// Module ID: 10970
// Function ID: 10971
// Name: useUserVoiceActivity
// Dependencies: [1957, 4245, 4626, 1085, 504, 2]
2026-07-29 08:29:29 +00:00
// Exports: canViewUserVoiceChannel, default, getUserVoiceState
2026-07-20 16:05:17 +00:00
// Module 10970 (useUserVoiceActivity)
import ChannelStore from "ChannelStore" /* 1957 */;
import PermissionStore from "PermissionStore" /* 4245 */;
import VoiceStateStore from "VoiceStateStore" /* 4626 */;
2026-07-23 10:11:24 +00:00
const require = fn;
2026-08-24 06:08:38 +00:00
function getVisibleUserVoiceActivity(arg0, arg1) {
2026-07-29 08:29:29 +00:00
let tmp = arg1;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
tmp = closure_6;
}
({ userId, guildId, includeNonDiscoverable } = arg0);
if (includeNonDiscoverable === undefined) {
includeNonDiscoverable = false;
}
2026-07-29 08:29:29 +00:00
let tmp3 = tmp;
if (tmp === undefined) {
tmp3 = closure_6;
}
2026-07-20 16:05:17 +00:00
if (null != guildId) {
if (null != userId) {
2026-07-29 08:29:29 +00:00
const VoiceStateStore2 = tmp3.VoiceStateStore;
if (includeNonDiscoverable) {
let voiceState = VoiceStateStore2.getVoiceState(guildId, userId);
} else {
voiceState = VoiceStateStore2.getDiscoverableVoiceState(guildId, userId);
}
2026-07-20 16:05:17 +00:00
}
}
if (null == userId) {
let tmp8 = tmp;
2026-07-29 08:29:29 +00:00
if (!tmp2) {
tmp8 = closure_6;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let channelId;
if (undefined != null) {
channelId = undefined.channelId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (null != channelId) {
ChannelStore = tmp8.ChannelStore;
const channel = ChannelStore.getChannel(undefined.channelId);
2026-07-29 08:29:29 +00:00
}
if (!tmp2) {
tmp = closure_6;
}
let tmp10 = null != undefined;
if (tmp10) {
2026-07-29 08:29:29 +00:00
let isPrivateResult;
if (channel != null) {
isPrivateResult = channel.isPrivate();
}
if (!isPrivateResult) {
PermissionStore = tmp.PermissionStore;
2026-07-29 08:29:29 +00:00
isPrivateResult = PermissionStore.can(Permissions.VIEW_CHANNEL, channel);
}
tmp10 = isPrivateResult;
2026-07-29 08:29:29 +00:00
}
if (tmp10) {
const obj = { voiceState: undefined, voiceChannel: channel };
let tmp13 = obj;
2026-07-29 08:29:29 +00:00
} else {
tmp13 = closure_7;
2026-07-29 08:29:29 +00:00
}
return tmp13;
} else {
VoiceStateStore = tmp3.VoiceStateStore;
if (includeNonDiscoverable) {
let voiceStateForUser = VoiceStateStore.getVoiceStateForUser(userId);
} else {
voiceStateForUser = VoiceStateStore.getDiscoverableVoiceStateForUser(userId);
}
2026-07-20 16:05:17 +00:00
}
}
const Permissions = fn(1085).Permissions;
let closure_6 = { ChannelStore, PermissionStore, VoiceStateStore };
let closure_7 = Object.freeze({ voiceState: "guild", voiceChannel: "call" });
const size = fn(2);
const result = size.fileFinishedImporting("modules/activity_status/useUserVoiceActivity.tsx");
2026-07-20 16:05:17 +00:00
export default function useUserVoiceActivity(userId) {
userId = userId.userId;
const guildId = userId.guildId;
const includeNonDiscoverable = userId.includeNonDiscoverable;
const items = [includeNonDiscoverable, PermissionStore, VoiceStateStore];
const items1 = [guildId, userId, includeNonDiscoverable];
return userId(guildId[4]).useStateFromStoresObject(items, () => getVisibleUserVoiceActivity({ userId, guildId, includeNonDiscoverable }, { ChannelStore, PermissionStore, VoiceStateStore }), items1);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
export const getUserVoiceState = function getUserVoiceState(arg0) {
({ userId, guildId, includeNonDiscoverable } = arg0);
if (includeNonDiscoverable === undefined) {
includeNonDiscoverable = false;
}
2026-07-20 16:05:17 +00:00
let tmp = arg1;
2026-07-29 08:29:29 +00:00
if (arg1 === undefined) {
tmp = closure_6;
}
if (null != guildId) {
if (null != userId) {
const VoiceStateStore2 = tmp.VoiceStateStore;
if (includeNonDiscoverable) {
let voiceState = VoiceStateStore2.getVoiceState(guildId, userId);
} else {
voiceState = VoiceStateStore2.getDiscoverableVoiceState(guildId, userId);
}
2026-07-29 08:29:29 +00:00
}
}
if (null != userId) {
VoiceStateStore = tmp.VoiceStateStore;
if (includeNonDiscoverable) {
let voiceStateForUser = VoiceStateStore.getVoiceStateForUser(userId);
} else {
voiceStateForUser = VoiceStateStore.getDiscoverableVoiceStateForUser(userId);
}
2026-07-29 08:29:29 +00:00
}
};
export const canViewUserVoiceChannel = function canViewUserVoiceChannel(arg0) {
let tmp = arg1;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
tmp = closure_6;
}
({ userId, guildId, includeNonDiscoverable } = arg0);
if (includeNonDiscoverable === undefined) {
includeNonDiscoverable = false;
}
2026-07-29 08:29:29 +00:00
let tmp3 = tmp;
if (tmp === undefined) {
tmp3 = closure_6;
}
if (null != guildId) {
if (null != userId) {
const VoiceStateStore2 = tmp3.VoiceStateStore;
if (includeNonDiscoverable) {
let voiceState = VoiceStateStore2.getVoiceState(guildId, userId);
} else {
voiceState = VoiceStateStore2.getDiscoverableVoiceState(guildId, userId);
}
2026-07-29 08:29:29 +00:00
}
}
if (null == userId) {
let tmp8 = tmp;
2026-07-29 08:29:29 +00:00
if (!tmp2) {
tmp8 = closure_6;
2026-07-29 08:29:29 +00:00
}
let channelId;
if (undefined != null) {
channelId = undefined.channelId;
2026-07-29 08:29:29 +00:00
}
if (null != channelId) {
ChannelStore = tmp8.ChannelStore;
const channel = ChannelStore.getChannel(undefined.channelId);
2026-07-29 08:29:29 +00:00
}
if (!tmp2) {
tmp = closure_6;
}
let tmp10 = null != undefined;
if (tmp10) {
2026-07-29 08:29:29 +00:00
let isPrivateResult;
if (channel != null) {
isPrivateResult = channel.isPrivate();
}
if (!isPrivateResult) {
PermissionStore = tmp.PermissionStore;
2026-07-29 08:29:29 +00:00
isPrivateResult = PermissionStore.can(Permissions.VIEW_CHANNEL, channel);
}
tmp10 = isPrivateResult;
2026-07-29 08:29:29 +00:00
}
return tmp10;
} else {
VoiceStateStore = tmp3.VoiceStateStore;
if (includeNonDiscoverable) {
let voiceStateForUser = VoiceStateStore.getVoiceStateForUser(userId);
} else {
voiceStateForUser = VoiceStateStore.getDiscoverableVoiceStateForUser(userId);
}
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
};
export { getVisibleUserVoiceActivity };