decord/source/modules/guild_role_subscriptions/useChannelRoleSubscriptionStatus.tsx

64 lines
2.1 KiB
TypeScript
Raw Normal View History

// Module ID: 5091
// Function ID: 5092
// Name: useChannelRoleSubscriptionStatus
// Dependencies: [2014, 1958, 4278, 1074, 504, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 5091 (useChannelRoleSubscriptionStatus)
import GatedChannelStore from "GatedChannelStore" /* 2014 */;
import ChannelStore from "ChannelStore" /* 1958 */;
import PermissionStore from "PermissionStore" /* 4278 */;
2026-07-22 07:54:56 +00:00
const require = globalThis.__r;
const require = fn;
function getChannelRoleSubscriptionStatus(id, ChannelStore, GatedChannelStore, PermissionStore) {
let obj = ChannelStore;
if (ChannelStore === undefined) {
obj = ChannelStore;
2026-07-20 16:05:17 +00:00
}
let obj2 = GatedChannelStore;
if (GatedChannelStore === undefined) {
obj2 = GatedChannelStore;
2026-07-20 16:05:17 +00:00
}
let tmp = PermissionStore;
if (PermissionStore === undefined) {
tmp = PermissionStore;
2026-07-20 16:05:17 +00:00
}
const channel = obj.getChannel(id);
2026-07-29 08:29:29 +00:00
let result;
if (channel != null) {
result = channel.isRoleSubscriptionTemplatePreviewChannel();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (result) {
let obj3 = { isSubscriptionGated: true, needSubscriptionToAccess: true };
2026-07-29 08:29:29 +00:00
} else {
if (null != channel) {
if (obj2.isChannelGated(channel.guild_id, channel.id)) {
const can = tmp.can;
let obj4 = Permissions;
2026-07-29 08:29:29 +00:00
if (channel.isGuildVocal()) {
let tmp3 = !can(obj4.CONNECT, channel);
2026-07-29 08:29:29 +00:00
} else {
tmp3 = !can(obj4.VIEW_CHANNEL, channel);
2026-07-29 08:29:29 +00:00
}
obj4 = { isSubscriptionGated: true, needSubscriptionToAccess: tmp3 };
2026-07-20 16:05:17 +00:00
}
}
obj3 = closure_6;
2026-07-20 16:05:17 +00:00
}
return obj3;
2026-07-20 16:05:17 +00:00
}
const Permissions = fn(1074).Permissions;
2026-07-23 10:11:24 +00:00
let closure_6 = { needSubscriptionToAccess: false, isSubscriptionGated: false };
const size = fn(2);
let result = size.fileFinishedImporting("modules/guild_role_subscriptions/useChannelRoleSubscriptionStatus.tsx");
2026-07-20 16:05:17 +00:00
export default function useChannelRoleSubscriptionStatus(arg0) {
_require = arg0;
const items = [ChannelStore, GatedChannelStore, PermissionStore];
2026-07-20 16:05:17 +00:00
const items1 = [arg0];
return require("initialize").useStateFromStoresObject(items, () => getChannelRoleSubscriptionStatus(closure_0, ChannelStore, GatedChannelStore, PermissionStore), items1);
2026-07-20 16:05:17 +00:00
};
export { getChannelRoleSubscriptionStatus };