decord/source/modules/guild_home/useActiveChannels.tsx

81 lines
2.6 KiB
TypeScript
Raw Normal View History

// Module ID: 16163
// Function ID: 16164
// Name: useActiveChannels
// Dependencies: [1961, 1957, 4275, 4817, 13795, 1074, 1964, 1369, 2]
2026-07-20 16:05:17 +00:00
// Exports: getActiveTextChannels
// Module 16163 (useActiveChannels)
import Constants from "Constants" /* 1074 */;
import GlobalUtils from "GlobalUtils" /* 1369 */;
import ChannelRecord from "ChannelRecord" /* 1961 */;
import ChannelConstants from "ChannelConstants" /* 1964 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import PermissionStore from "PermissionStore" /* 4275 */;
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 4817 */;
import ActiveChannelsStore from "ActiveChannelsStore" /* 13795 */;
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
const isTextChannel = ChannelRecord.isTextChannel;
const Permissions = Constants.Permissions;
const ChannelFlags = ChannelConstants.ChannelFlags;
const result = size.fileFinishedImporting("modules/guild_home/useActiveChannels.tsx");
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
export const getActiveTextChannels = function getActiveTextChannels(guildId) {
let tmp = arg1;
if (arg1 === undefined) {
const items = [ChannelStore, PermissionStore, ActiveChannelsStore, UserGuildSettingsStore];
2026-07-20 16:05:17 +00:00
tmp = items;
}
[, , obj, obj2] = tmp;
2026-07-29 08:29:29 +00:00
const activeChannelIds = obj.getActiveChannelIds(guildId);
2026-07-20 16:05:17 +00:00
if (null != activeChannelIds) {
const _Array = Array;
let arr = Array.from(activeChannelIds);
2026-07-20 16:05:17 +00:00
} else {
arr = [];
2026-07-20 16:05:17 +00:00
}
obj2.getMutedChannels(guildId);
const mapped = arr.map((item) => require.getChannel(item));
const found = mapped.filter(GlobalUtils.isNotNullish);
2026-07-20 16:05:17 +00:00
return found.filter((hasFlag) => {
2026-07-29 08:29:29 +00:00
let hasFlagResult;
if (hasFlag != null) {
hasFlagResult = hasFlag.hasFlag(ChannelFlags.ACTIVE_CHANNELS_REMOVED);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (hasFlagResult) {
return false;
} else if (isTextChannel(hasFlag.type)) {
2026-07-20 16:05:17 +00:00
if (set.has(hasFlag.id)) {
return false;
} else {
if (null != hasFlag.parent_id) {
2026-07-29 08:29:29 +00:00
if (obj.has(hasFlag.parent_id)) {
2026-07-20 16:05:17 +00:00
return false;
}
}
if (dependencyMap.can(Permissions.VIEW_CHANNEL, hasFlag)) {
const channel = require.getChannel(hasFlag.parent_id);
2026-07-29 08:29:29 +00:00
const isThreadResult = hasFlag.isThread();
let tmp8 = !isThreadResult;
if (isThreadResult) {
tmp8 = null == channel;
}
if (!tmp8) {
let hasFlagResult1;
if (channel != null) {
hasFlagResult1 = channel.hasFlag(ChannelFlags.ACTIVE_CHANNELS_REMOVED);
2026-07-29 08:29:29 +00:00
}
tmp8 = !hasFlagResult1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp8;
2026-07-20 16:05:17 +00:00
} else {
return false;
}
}
2026-07-29 08:29:29 +00:00
obj = set;
2026-07-20 16:05:17 +00:00
} else {
return false;
}
});
};