decord/source/modules/opt_in_channels/OptInOnboardingUtils.tsx
2026-08-26 06:04:24 +00:00

129 lines
3.9 KiB
TypeScript

// Module ID: 11187
// Function ID: 11188
// Name: optIntoAllChannelsForExistingMember
// Dependencies: [1340, 1982, 1992, 4653, 4077, 7207, 1403, 5428, 5419, 1306, 2]
// Exports: hasClearedGuildOnboardingNotice, hasNotSetUpChannelOptIn, toggleShowAllChannels
// Module 11187 (optIntoAllChannelsForExistingMember)
import create from "create" /* 1306 */;
import hasFlag from "hasFlag" /* 1403 */;
import useOptInEnabledForGuild from "useOptInEnabledForGuild" /* 7207 */;
import closure_3 from "handleConnectionClosedOrResumed" /* 1340 */;
import comparator from "comparator" /* 1982 */;
import closure_6 from "comparator" /* 1982 */;
import closure_7 from "trackCommunicationDisabled" /* 1992 */;
import closure_8 from "updateUserGuildSettingsInternal" /* 4653 */;
import { GuildMemberFlags } from "GuildMemberFlags" /* 4077 */;
require = arg1;
function optIntoAllChannelsForExistingMember(id, arg1) {
let obj = arg1;
if (arg1 === undefined) {
obj = {};
}
let include = obj.include;
if (include === undefined) {
const _Set = Set;
include = new Set();
}
let exclude = obj.exclude;
if (exclude === undefined) {
const _Set2 = Set;
exclude = new Set();
}
let mapped;
channels = channels.getChannels(id);
const items = [...channels[closure_5]];
const found = items.filter((channel) => {
channel = channel.channel;
const isThreadResult = channel.isThread();
let tmp2 = !isThreadResult;
if (!isThreadResult) {
tmp2 = !exclude.has(channel.id);
}
return tmp2;
});
mapped = found.map((channel) => channel.channel.id);
const item = include.forEach((arg0) => mapped.push(arg0));
const obj2 = mapped(5419);
const result = obj2.onboardExistingMember(id, new Set(mapped));
}
({ GUILD_SELECTABLE_CHANNELS_KEY: c4, GUILD_VOCAL_CHANNELS_KEY: c5 } = comparator);
let result = require("set").fileFinishedImporting("modules/opt_in_channels/OptInOnboardingUtils.tsx");
export const hasNotSetUpChannelOptIn = function hasNotSetUpChannelOptIn(guildId) {
const result = useOptInEnabledForGuild.isOptInEnabledForGuild(guildId);
const selfMember = store.getSelfMember(guildId);
let num;
if (selfMember != null) {
num = selfMember.flags;
}
if (num == null) {
num = 0;
}
const obj = useOptInEnabledForGuild;
const tmp = require;
const tmpResult = hasFlag;
let tmp7 = !result;
const hasFlagResult = hasFlag.hasFlag(num, GuildMemberFlags.COMPLETED_ONBOARDING);
if (!result) {
tmp7 = !hasFlagResult;
}
if (tmp7) {
tmp7 = !tmp6;
}
return tmp7;
};
export const toggleShowAllChannels = function toggleShowAllChannels(id) {
const result = useOptInEnabledForGuild.isOptInEnabledForGuild(id);
const selfMember = store.getSelfMember(id);
let num;
if (selfMember != null) {
num = selfMember.flags;
}
if (num == null) {
num = 0;
}
let tmpResult = tmp(1403);
const obj = useOptInEnabledForGuild;
let tmp7 = !result;
const hasFlagResult = tmpResult.hasFlag(num, GuildMemberFlags.COMPLETED_ONBOARDING);
if (!result) {
tmp7 = !hasFlagResult;
}
if (tmp7) {
tmp7 = !tmp6;
}
if (tmp7) {
optIntoAllChannelsForExistingMember(id);
} else {
tmpResult = tmp(7207);
const result1 = tmpResult.isOptInEnabledForGuild(id);
tmp(5428).setGuildOptIn(id, !result1);
const tmpResult1 = tmp(5428);
}
};
export { optIntoAllChannelsForExistingMember };
export const hasClearedGuildOnboardingNotice = function hasClearedGuildOnboardingNotice(arg0) {
let tmp = arg1;
if (arg1 === undefined) {
tmp = closure_3;
}
let hasFlagResult = null != arg0;
if (hasFlagResult) {
const guilds = tmp.settings.guilds;
let num;
if (guilds != null) {
if (guilds.guilds[arg0] != null) {
num = tmp5.guildOnboardingProgress;
}
}
if (num == null) {
num = 0;
}
hasFlagResult = hasFlag.hasFlag(num, create.GuildOnboardingProgress.GUILD_NOTICE_CLEARED);
const obj = hasFlag;
const tmp3 = require;
}
return hasFlagResult;
};