decord/source/modules/opt_in_channels/OptInOnboardingUtils.tsx

129 lines
4 KiB
TypeScript
Raw Normal View History

2026-08-12 06:57:52 +00:00
// Module ID: 11086
// Function ID: 11087
2026-07-29 08:29:29 +00:00
// Name: optIntoAllChannelsForExistingMember
2026-08-12 06:57:52 +00:00
// Dependencies: [1340, 1980, 1990, 4539, 3977, 7036, 1403, 5295, 5286, 1306, 2]
2026-07-29 08:29:29 +00:00
// Exports: hasClearedGuildOnboardingNotice, hasNotSetUpChannelOptIn, toggleShowAllChannels
2026-07-20 16:05:17 +00:00
2026-08-12 06:57:52 +00:00
// Module 11086 (optIntoAllChannelsForExistingMember)
2026-07-29 08:29:29 +00:00
import handleConnectionClosedOrResumed from "handleConnectionClosedOrResumed";
import comparator from "comparator";
import closure_6 from "comparator";
import trackCommunicationDisabled from "trackCommunicationDisabled";
import updateUserGuildSettingsInternal from "updateUserGuildSettingsInternal";
2026-07-23 10:11:24 +00:00
import { GuildMemberFlags } from "GuildMemberFlags";
2026-07-29 08:29:29 +00:00
let c4;
let c5;
2026-07-23 10:11:24 +00:00
const 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-12 06:57:52 +00:00
const obj2 = mapped(5286);
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);
let result = require("trackCommunicationDisabled").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-12 06:57:52 +00:00
const result = require(7036) /* 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-12 06:57:52 +00:00
const obj = require(7036) /* useOptInEnabledForGuild */;
2026-07-29 08:29:29 +00:00
const tmp = require;
2026-08-11 06:20:06 +00:00
const tmpResult = require(1403) /* hasFlag */;
2026-07-29 08:29:29 +00:00
let tmp7 = !result;
2026-08-11 06:20:06 +00:00
const hasFlagResult = require(1403) /* 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-12 06:57:52 +00:00
const result = require(7036) /* 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-12 06:57:52 +00:00
const obj = require(7036) /* 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-12 06:57:52 +00:00
tmpResult = tmp(7036);
2026-07-29 08:29:29 +00:00
const result1 = tmpResult.isOptInEnabledForGuild(id);
2026-08-12 06:57:52 +00:00
tmp(5295).setGuildOptIn(id, !result1);
const tmpResult1 = tmp(5295);
2026-07-20 16:05:17 +00:00
}
};
export { optIntoAllChannelsForExistingMember };
export const hasClearedGuildOnboardingNotice = function hasClearedGuildOnboardingNotice(arg0) {
let tmp = arg1;
if (arg1 === undefined) {
2026-07-29 08:29:29 +00:00
tmp = handleConnectionClosedOrResumed;
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-11 06:20:06 +00:00
hasFlagResult = require(1403) /* hasFlag */.hasFlag(num, require(1306) /* create */.GuildOnboardingProgress.GUILD_NOTICE_CLEARED);
const obj = require(1403) /* hasFlag */;
2026-07-29 08:29:29 +00:00
const tmp3 = require;
2026-07-20 16:05:17 +00:00
}
return hasFlagResult;
};