36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
// Metro module 8837 (f8838).
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import SortedVoiceStateStore from "../../stores/views/SortedVoiceStateStore";
|
|
import { ChannelTypes } from "../../Constants";
|
|
import { useStateFromStoresObject } from "../../_bundle/Module589";
|
|
export default function useChannelVideoLimit(a0) {
|
|
return useStateFromStoresObject([SortedVoiceStateStore, GuildStore], () => {
|
|
const r10 = SortedVoiceStateStore.countVoiceStatesForChannel(a0.id);
|
|
const guild = GuildStore.getGuild(a0.getGuildId());
|
|
return guild == null ? {
|
|
reachedLimit: false,
|
|
limit: -1
|
|
} : a0.type === ChannelTypes.GUILD_STAGE_VOICE ? {
|
|
reachedLimit: r10 > guild.maxStageVideoChannelUsers,
|
|
limit: guild.maxStageVideoChannelUsers
|
|
} : {
|
|
reachedLimit: guild.maxVideoChannelUsers > 0 && r10 > guild.maxVideoChannelUsers,
|
|
limit: guild.maxVideoChannelUsers
|
|
};
|
|
}, [a0]);
|
|
};
|
|
export function getChannelVideoLimit(a0) {
|
|
const r9 = SortedVoiceStateStore.countVoiceStatesForChannel(a0.id);
|
|
const guild = GuildStore.getGuild(a0.getGuildId());
|
|
return guild == null ? {
|
|
reachedLimit: false,
|
|
limit: -1
|
|
} : a0.type === ChannelTypes.GUILD_STAGE_VOICE ? {
|
|
reachedLimit: r9 > guild.maxStageVideoChannelUsers,
|
|
limit: guild.maxStageVideoChannelUsers
|
|
} : {
|
|
reachedLimit: guild.maxVideoChannelUsers > 0 && r9 > guild.maxVideoChannelUsers,
|
|
limit: guild.maxVideoChannelUsers
|
|
};
|
|
}
|