decord/source/modules/guild_onboarding/DefaultChannelUtils.tsx

56 lines
2.2 KiB
TypeScript
Raw Normal View History

// Module ID: 7175
// Function ID: 7176
// Name: DefaultChannelUtils
// Dependencies: [2013, 1957, 1074, 1086, 504, 4250, 2]
2026-07-20 16:05:17 +00:00
// Exports: canChannelBeDefault, useCanChannelBeDefault
// Module 7175 (DefaultChannelUtils)
import BigFlagUtilsAll from "BigFlagUtils" /* 1086 */;
import PermissionUtilsAll from "PermissionUtils" /* 4250 */;
import GatedChannelStore from "GatedChannelStore" /* 2013 */;
import ChannelStore from "ChannelStore" /* 1957 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const require = fn;
const Constants = fn(1074);
({ ChannelTypesSets: hasOwnProperty, Permissions: metroRequire } = Constants);
const size = fn(2);
const result = size.fileFinishedImporting("modules/guild_onboarding/DefaultChannelUtils.tsx");
2026-07-20 16:05:17 +00:00
export const useCanChannelBeDefault = function useCanChannelBeDefault(arg0, arg1) {
_require = arg0;
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
const items = [GatedChannelStore, ChannelStore];
return require("initialize").useStateFromStores(items, () => {
const channel = ChannelStore.getChannel(closure_1);
2026-07-29 08:29:29 +00:00
if (null != channel) {
const GUILD_VOCAL = constants.GUILD_VOCAL;
2026-07-29 08:29:29 +00:00
if (GUILD_VOCAL.has(channel.type)) {
let VIEW_CHANNEL = BigFlagUtilsAll.combine(constants2.VIEW_CHANNEL, constants2.CONNECT);
2026-07-29 08:29:29 +00:00
}
let isChannelGatedResult = GatedChannelStore.isChannelGated(closure_0, closure_1);
2026-07-29 08:29:29 +00:00
if (!isChannelGatedResult) {
isChannelGatedResult = PermissionUtilsAll.canEveryoneRole(VIEW_CHANNEL, channel);
2026-07-29 08:29:29 +00:00
}
return isChannelGatedResult;
2026-07-20 16:05:17 +00:00
}
VIEW_CHANNEL = constants2.VIEW_CHANNEL;
2026-07-20 16:05:17 +00:00
});
};
export const canChannelBeDefault = function canChannelBeDefault(guild_id, id) {
const channel = ChannelStore.getChannel(id);
2026-07-29 08:29:29 +00:00
if (null != channel) {
const GUILD_VOCAL = constants.GUILD_VOCAL;
if (GUILD_VOCAL.has(channel.type)) {
let VIEW_CHANNEL = BigFlagUtilsAll.combine(constants2.VIEW_CHANNEL, constants2.CONNECT);
2026-07-29 08:29:29 +00:00
}
let isChannelGatedResult = GatedChannelStore.isChannelGated(guild_id, id);
2026-07-29 08:29:29 +00:00
if (!isChannelGatedResult) {
isChannelGatedResult = PermissionUtilsAll.canEveryoneRole(VIEW_CHANNEL, ChannelStore.getChannel(id));
2026-07-29 08:29:29 +00:00
}
return isChannelGatedResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
VIEW_CHANNEL = constants2.VIEW_CHANNEL;
2026-07-20 16:05:17 +00:00
};