71 lines
2.7 KiB
TypeScript
71 lines
2.7 KiB
TypeScript
// Metro module 9065 (f9066).
|
|
import ChannelStore from "../../stores/ChannelStore";
|
|
import PermissionStore from "../../stores/PermissionStore";
|
|
import VoiceStateStore from "../../stores/VoiceStateStore";
|
|
import { Permissions } from "../../_bundle/Module505";
|
|
import { useStateFromStoresObject } from "../../_bundle/Module589";
|
|
let c5932_6, c5932_7;
|
|
const getVisibleUserVoiceActivity = function getVisibleUserVoiceActivity(a0) {
|
|
const { userId: userId2, guildId: guildId2 } = a0;
|
|
let r8 = arguments[1];
|
|
if (r8 === void 0) {
|
|
r8 = c5932_6;
|
|
}
|
|
const r2 = r8 !== void 0;
|
|
const r12 = r2 ? r8 : c5932_6;
|
|
const voiceState = guildId2 != null && userId2 != null ? r12.VoiceStateStore.getDiscoverableVoiceState(guildId2, userId2) : userId2 != null ? r12.VoiceStateStore.getDiscoverableVoiceStateForUser(userId2) : void 0;
|
|
const r15 = r2 ? r8 : c5932_6;
|
|
const voiceChannel = voiceState?.channelId != null ? r15.ChannelStore.getChannel(voiceState.channelId) : void 0;
|
|
if (!r2) {
|
|
r8 = c5932_6;
|
|
}
|
|
return voiceState != null && ((voiceChannel == null ? void 0 : voiceChannel.isPrivate()) || r8.PermissionStore.can(Permissions.VIEW_CHANNEL, voiceChannel)) ? {
|
|
voiceState,
|
|
voiceChannel
|
|
} : c5932_7;
|
|
};
|
|
c5932_6 = {
|
|
ChannelStore,
|
|
PermissionStore,
|
|
VoiceStateStore
|
|
};
|
|
c5932_7 = Object.freeze({
|
|
voiceState: void 0,
|
|
voiceChannel: void 0
|
|
});
|
|
export default function useUserVoiceActivity({ userId, guildId }) {
|
|
return useStateFromStoresObject([ChannelStore, PermissionStore, VoiceStateStore], () => getVisibleUserVoiceActivity({
|
|
userId,
|
|
guildId
|
|
}, {
|
|
ChannelStore,
|
|
PermissionStore,
|
|
VoiceStateStore
|
|
}), [guildId, userId]);
|
|
};
|
|
export function getUserVoiceState(a0) {
|
|
const { userId: userId2, guildId: guildId2 } = a0;
|
|
let r2 = arguments[1];
|
|
if (r2 === void 0) {
|
|
r2 = c5932_6;
|
|
}
|
|
return guildId2 != null && userId2 != null ? r2.VoiceStateStore.getDiscoverableVoiceState(guildId2, userId2) : userId2 != null ? r2.VoiceStateStore.getDiscoverableVoiceStateForUser(userId2) : void 0;
|
|
}
|
|
export function canViewUserVoiceChannel(a0) {
|
|
const { userId: userId2, guildId: guildId2 } = a0;
|
|
let r6 = arguments[1];
|
|
if (r6 === void 0) {
|
|
r6 = c5932_6;
|
|
}
|
|
const r2 = r6 !== void 0;
|
|
const r7 = r2 ? r6 : c5932_6;
|
|
const r12 = guildId2 != null && userId2 != null ? r7.VoiceStateStore.getDiscoverableVoiceState(guildId2, userId2) : userId2 != null ? r7.VoiceStateStore.getDiscoverableVoiceStateForUser(userId2) : void 0;
|
|
const r15 = r2 ? r6 : c5932_6;
|
|
const r19 = r12?.channelId != null ? r15.ChannelStore.getChannel(r12.channelId) : void 0;
|
|
if (!r2) {
|
|
r6 = c5932_6;
|
|
}
|
|
return r12 != null && ((r19 == null ? void 0 : r19.isPrivate()) || r6.PermissionStore.can(Permissions.VIEW_CHANNEL, r19));
|
|
}
|
|
export { getVisibleUserVoiceActivity };
|