decord/source/modules/opt_in_channels/OptInOnboardingUtils.tsx

130 lines
3.9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10786
// Function ID: 10787
2026-07-29 08:29:29 +00:00
// Name: optIntoAllChannelsForExistingMember
2026-08-24 06:08:38 +00:00
// Dependencies: [1340, 1981, 1991, 5048, 4012, 5287, 1403, 6831, 6828, 1306, 2]
2026-07-29 08:29:29 +00:00
// Exports: hasClearedGuildOnboardingNotice, hasNotSetUpChannelOptIn, toggleShowAllChannels
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 10786 (optIntoAllChannelsForExistingMember)
import create from "create" /* 1306 */;
import hasFlag from "hasFlag" /* 1403 */;
import useOptInEnabledForGuild from "useOptInEnabledForGuild" /* 5287 */;
import closure_3 from "handleConnectionClosedOrResumed" /* 1340 */;
import comparator from "comparator" /* 1981 */;
import closure_6 from "comparator" /* 1981 */;
import closure_7 from "trackCommunicationDisabled" /* 1991 */;
import closure_8 from "updateUserGuildSettingsInternal" /* 5048 */;
import { GuildMemberFlags } from "GuildMemberFlags" /* 4012 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
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();
}
2026-07-23 10:11:24 +00:00
let mapped;
channels = channels.getChannels(id);
2026-07-20 16:05:17 +00:00
const items = [...channels[closure_5]];
const found = items.filter((channel) => {
channel = channel.channel;
2026-07-29 08:29:29 +00:00
const isThreadResult = channel.isThread();
let tmp2 = !isThreadResult;
if (!isThreadResult) {
tmp2 = !exclude.has(channel.id);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
2026-07-20 16:05:17 +00:00
});
2026-07-23 10:11:24 +00:00
mapped = found.map((channel) => channel.channel.id);
2026-07-20 16:05:17 +00:00
const item = include.forEach((arg0) => mapped.push(arg0));
2026-08-24 06:08:38 +00:00
const obj2 = mapped(6828);
2026-07-20 16:05:17 +00:00
const result = obj2.onboardExistingMember(id, new Set(mapped));
}
2026-07-29 08:29:29 +00:00
({ GUILD_SELECTABLE_CHANNELS_KEY: c4, GUILD_VOCAL_CHANNELS_KEY: c5 } = comparator);
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/opt_in_channels/OptInOnboardingUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const hasNotSetUpChannelOptIn = function hasNotSetUpChannelOptIn(guildId) {
2026-08-24 06:08:38 +00:00
const result = useOptInEnabledForGuild.isOptInEnabledForGuild(guildId);
2026-07-29 08:29:29 +00:00
const selfMember = store.getSelfMember(guildId);
let num;
if (selfMember != null) {
num = selfMember.flags;
}
if (num == null) {
num = 0;
}
2026-08-24 06:08:38 +00:00
const obj = useOptInEnabledForGuild;
2026-07-29 08:29:29 +00:00
const tmp = require;
2026-08-24 06:08:38 +00:00
const tmpResult = hasFlag;
2026-07-29 08:29:29 +00:00
let tmp7 = !result;
2026-08-24 06:08:38 +00:00
const hasFlagResult = hasFlag.hasFlag(num, GuildMemberFlags.COMPLETED_ONBOARDING);
2026-07-29 08:29:29 +00:00
if (!result) {
tmp7 = !hasFlagResult;
}
if (tmp7) {
tmp7 = !tmp6;
}
return tmp7;
};
2026-07-20 16:05:17 +00:00
export const toggleShowAllChannels = function toggleShowAllChannels(id) {
2026-08-24 06:08:38 +00:00
const result = useOptInEnabledForGuild.isOptInEnabledForGuild(id);
2026-07-29 08:29:29 +00:00
const selfMember = store.getSelfMember(id);
let num;
if (selfMember != null) {
num = selfMember.flags;
}
if (num == null) {
num = 0;
}
2026-08-11 06:20:06 +00:00
let tmpResult = tmp(1403);
2026-08-24 06:08:38 +00:00
const obj = useOptInEnabledForGuild;
2026-07-29 08:29:29 +00:00
let tmp7 = !result;
const hasFlagResult = tmpResult.hasFlag(num, GuildMemberFlags.COMPLETED_ONBOARDING);
if (!result) {
tmp7 = !hasFlagResult;
}
if (tmp7) {
tmp7 = !tmp6;
}
if (tmp7) {
2026-07-20 16:05:17 +00:00
optIntoAllChannelsForExistingMember(id);
} else {
2026-08-24 06:08:38 +00:00
tmpResult = tmp(5287);
2026-07-29 08:29:29 +00:00
const result1 = tmpResult.isOptInEnabledForGuild(id);
2026-08-24 06:08:38 +00:00
tmp(6831).setGuildOptIn(id, !result1);
const tmpResult1 = tmp(6831);
2026-07-20 16:05:17 +00:00
}
};
export { optIntoAllChannelsForExistingMember };
export const hasClearedGuildOnboardingNotice = function hasClearedGuildOnboardingNotice(arg0) {
let tmp = arg1;
if (arg1 === undefined) {
2026-08-24 06:08:38 +00:00
tmp = closure_3;
2026-07-20 16:05:17 +00:00
}
let hasFlagResult = null != arg0;
if (hasFlagResult) {
const guilds = tmp.settings.guilds;
2026-07-29 08:29:29 +00:00
let num;
if (guilds != null) {
if (guilds.guilds[arg0] != null) {
num = tmp5.guildOnboardingProgress;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
hasFlagResult = hasFlag.hasFlag(num, create.GuildOnboardingProgress.GUILD_NOTICE_CLEARED);
const obj = hasFlag;
2026-07-29 08:29:29 +00:00
const tmp3 = require;
2026-07-20 16:05:17 +00:00
}
return hasFlagResult;
};