Files
discord-decomp/utils/GuildRecordUtils.tsx
T
2026-11-01 12:12:55 +02:00

785 lines
25 KiB
TypeScript

// Metro module 1411 (f1412).
import { constructInPlace, merge, objectIsPlainRecordOfType, tryReuseExistingInPlacePlainRecord } from "../lib/PlainRecord";
import { GUILD_DEFAULT_PROPERTY_VALUES, GuildRecordTypeTag } from "../records/GuildRecord";
import { GuildNSFWContentLevel } from "../Constants";
import { toSetInplace } from "../_bundle/Module1414";
import Module38 from "../_bundle/Module38";
import { fromServerGuildTheme, toServerGuildThemeSettings } from "../modules/guild_themes/guildThemeSerialization";
const fromGuildPropertiesWithAdditionalFields = function fromGuildPropertiesWithAdditionalFields(properties, a1, a2) {
let guildTheme;
let description = properties.description;
if (description == null) {
description = null;
}
let icon = properties.icon;
if (icon == null) {
icon = null;
}
let splash = properties.splash;
if (splash == null) {
splash = null;
}
let banner = properties.banner;
if (banner == null) {
banner = null;
}
let home_header = properties.home_header;
if (home_header == null) {
home_header = null;
}
const r4 = {
id: properties.id,
joinedAt: a1.joinedAt,
premiumSubscriberCount: a1.premiumSubscriberCount,
name: properties.name,
description,
icon,
splash,
banner,
homeHeader: home_header,
features: toSetInplace(properties.features),
preferredLocale: null,
ownerId: null,
application_id: null,
afkChannelId: null,
afkTimeout: null,
systemChannelId: null,
verificationLevel: null,
explicitContentFilter: null,
defaultMessageNotifications: null,
mfaLevel: null,
vanityURLCode: null,
premiumTier: null,
premiumProgressBarEnabled: null,
premiumProgressBarEnabledUserUpdatedAt: null,
systemChannelFlags: null,
discoverySplash: null,
rulesChannelId: null,
safetyAlertsChannelId: null,
publicUpdatesChannelId: null,
maxStageVideoChannelUsers: null,
maxVideoChannelUsers: null,
maxMembers: null,
nsfwLevel: null,
ownerConfiguredContentLevel: null,
hubType: null,
latestOnboardingQuestionId: null,
profile: null,
guildTheme: null,
premiumFeatures: null,
moderatorReporting: null,
verificationRoleId: null,
gameApplicationIds: null,
officialMessageColor: null
};
let preferred_locale = properties.preferred_locale;
if (preferred_locale == null) {
preferred_locale = GUILD_DEFAULT_PROPERTY_VALUES.preferredLocale;
}
r4.preferredLocale = preferred_locale;
r4.ownerId = properties.owner_id;
let application_id = properties.application_id;
if (application_id == null) {
application_id = null;
}
r4.application_id = application_id;
let afk_channel_id = properties.afk_channel_id;
if (afk_channel_id == null) {
afk_channel_id = null;
}
r4.afkChannelId = afk_channel_id;
let afk_timeout = properties.afk_timeout;
if (afk_timeout == null) {
afk_timeout = GUILD_DEFAULT_PROPERTY_VALUES.afkTimeout;
}
r4.afkTimeout = afk_timeout;
let system_channel_id = properties.system_channel_id;
if (system_channel_id == null) {
system_channel_id = null;
}
r4.systemChannelId = system_channel_id;
let verification_level = properties.verification_level;
if (verification_level == null) {
verification_level = GUILD_DEFAULT_PROPERTY_VALUES.verificationLevel;
}
r4.verificationLevel = verification_level;
let explicit_content_filter = properties.explicit_content_filter;
if (explicit_content_filter == null) {
explicit_content_filter = GUILD_DEFAULT_PROPERTY_VALUES.explicitContentFilter;
}
r4.explicitContentFilter = explicit_content_filter;
r4.defaultMessageNotifications = properties.default_message_notifications;
let mfa_level = properties.mfa_level;
if (mfa_level == null) {
mfa_level = GUILD_DEFAULT_PROPERTY_VALUES.mfaLevel;
}
r4.mfaLevel = mfa_level;
let vanity_url_code = properties.vanity_url_code;
if (vanity_url_code == null) {
vanity_url_code = null;
}
r4.vanityURLCode = vanity_url_code;
let premium_tier = properties.premium_tier;
if (premium_tier == null) {
premium_tier = GUILD_DEFAULT_PROPERTY_VALUES.premiumTier;
}
r4.premiumTier = premium_tier;
r4.premiumProgressBarEnabled = properties.premium_progress_bar_enabled || GUILD_DEFAULT_PROPERTY_VALUES.premiumProgressBarEnabled;
r4.premiumProgressBarEnabledUserUpdatedAt = properties.premium_progress_bar_enabled_user_updated_at != null ? new Date(properties.premium_progress_bar_enabled_user_updated_at) : null;
r4.systemChannelFlags = properties.system_channel_flags;
let discovery_splash = properties.discovery_splash;
if (discovery_splash == null) {
discovery_splash = null;
}
r4.discoverySplash = discovery_splash;
let rules_channel_id = properties.rules_channel_id;
if (rules_channel_id == null) {
rules_channel_id = null;
}
r4.rulesChannelId = rules_channel_id;
let safety_alerts_channel_id = properties.safety_alerts_channel_id;
if (safety_alerts_channel_id == null) {
safety_alerts_channel_id = null;
}
r4.safetyAlertsChannelId = safety_alerts_channel_id;
let public_updates_channel_id = properties.public_updates_channel_id;
if (public_updates_channel_id == null) {
public_updates_channel_id = null;
}
r4.publicUpdatesChannelId = public_updates_channel_id;
let max_stage_video_channel_users = properties.max_stage_video_channel_users;
if (max_stage_video_channel_users == null) {
max_stage_video_channel_users = GUILD_DEFAULT_PROPERTY_VALUES.maxStageVideoChannelUsers;
}
r4.maxStageVideoChannelUsers = max_stage_video_channel_users;
let max_video_channel_users = properties.max_video_channel_users;
if (max_video_channel_users == null) {
max_video_channel_users = GUILD_DEFAULT_PROPERTY_VALUES.maxVideoChannelUsers;
}
r4.maxVideoChannelUsers = max_video_channel_users;
let max_members = properties.max_members;
if (max_members == null) {
max_members = GUILD_DEFAULT_PROPERTY_VALUES.maxMembers;
}
r4.maxMembers = max_members;
let nsfw_level = properties.nsfw_level;
if (nsfw_level == null) {
nsfw_level = GUILD_DEFAULT_PROPERTY_VALUES.nsfwLevel;
}
r4.nsfwLevel = nsfw_level;
let owner_configured_content_level = properties.owner_configured_content_level;
if (owner_configured_content_level == null) {
owner_configured_content_level = null;
}
r4.ownerConfiguredContentLevel = owner_configured_content_level;
let hub_type = properties.hub_type;
if (hub_type == null) {
hub_type = null;
}
r4.hubType = hub_type;
let latest_onboarding_question_id = properties.latest_onboarding_question_id;
if (latest_onboarding_question_id == null) {
latest_onboarding_question_id = null;
}
r4.latestOnboardingQuestionId = latest_onboarding_question_id;
let profile = properties.profile;
if (profile == null) {
profile = null;
}
r4.profile = profile;
const theme = properties.theme;
if (theme === void 0) {
let r81 = a2?.guildTheme;
if (r81 == null) {
r81 = null;
}
guildTheme = r81;
} else {
const r74 = theme != null;
guildTheme = null;
if (r74) {
let r79 = fromServerGuildTheme(theme);
if (r79 == null) {
r79 = {
enabled: false,
themeSettings: null
};
}
guildTheme = r79;
}
}
r4.guildTheme = guildTheme;
const r83 = properties.premium_features != null;
let premiumFeatures = null;
if (r83) {
const premium_features = properties.premium_features;
premiumFeatures = {
features: premium_features.features,
additionalEmojiSlots: premium_features.additional_emoji_slots,
additionalStickerSlots: premium_features.additional_sticker_slots,
additionalSoundSlots: premium_features.additional_sound_slots
};
}
r4.premiumFeatures = premiumFeatures;
const r92 = properties.moderator_reporting != null;
let moderatorReporting = null;
if (r92) {
const moderator_reporting = properties.moderator_reporting;
moderatorReporting = {
moderatorReportingEnabled: moderator_reporting.moderator_reporting_enabled,
moderatorReportChannelId: moderator_reporting.moderator_report_channel_id
};
}
r4.moderatorReporting = moderatorReporting;
let verification_role_id = properties.verification_role_id;
if (verification_role_id == null) {
verification_role_id = null;
}
r4.verificationRoleId = verification_role_id;
let game_application_ids = properties.game_application_ids;
if (game_application_ids == null) {
game_application_ids = null;
}
r4.gameApplicationIds = game_application_ids;
let official_message_color = properties.official_message_color;
if (official_message_color == null) {
official_message_color = null;
}
r4.officialMessageColor = official_message_color;
return tryReuseExistingInPlacePlainRecord(GuildRecordTypeTag, a2, r4);
};
export function isGuildRecord(a0) {
return objectIsPlainRecordOfType(GuildRecordTypeTag, a0);
}
export { fromGuildPropertiesWithAdditionalFields };
export function fromServer(a0, a1) {
let r22, joinedAt;
if (a0.joined_at != null) {
joinedAt = new Date(a0.joined_at);
} else {
joinedAt = a1?.joinedAt;
if (joinedAt == null) {
joinedAt = null;
}
}
let premium_subscription_count = a0.premium_subscription_count;
if (premium_subscription_count == null) {
premium_subscription_count = 0;
}
if (a0.properties == null) {
Module38(a1 != null, "If guild.properties is null, existingGuild must be passed in");
r22 = merge(a1, {
joinedAt,
premiumSubscriberCount: premium_subscription_count
});
} else {
r22 = fromGuildPropertiesWithAdditionalFields(a0.properties, {
joinedAt,
premiumSubscriberCount: premium_subscription_count
}, a1);
}
return r22;
}
export function attachSerializedData(a0, a1, a2) {
return {
...a0,
joinedAt: a0.joinedAt != null ? a0.joinedAt.toISOString() : null,
premiumProgressBarEnabledUserUpdatedAt: a0.premiumProgressBarEnabledUserUpdatedAt != null ? a0.premiumProgressBarEnabledUserUpdatedAt.toISOString() : null,
features: Array.from(a0.features),
roles: a1,
member: a2 != null ? {
userId: a2.userId,
roles: a2.roles
} : null
};
}
export function fromBackgroundSync(a0, a1) {
return a0.properties != null ? fromGuildPropertiesWithAdditionalFields(a0.properties, {
joinedAt: a1.joinedAt,
premiumSubscriberCount: a1.premiumSubscriberCount
}, a1) : a1;
}
export function fromGuild(a0, a1) {
let joinedAt;
if (a0.joined_at != null) {
joinedAt = new Date(a0.joined_at);
} else {
joinedAt = a1?.joinedAt;
if (joinedAt == null) {
joinedAt = null;
}
}
return fromGuildPropertiesWithAdditionalFields(a0, {
joinedAt,
premiumSubscriberCount: a0.premium_subscription_count
}, a1);
}
export function fromInviteGuild(a0) {
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
description: a0.description,
icon: a0.icon,
splash: a0.splash,
banner: a0.banner,
features: toSetInplace(a0.features),
verificationLevel: a0.verification_level,
vanityURLCode: a0.vanity_url_code,
premiumSubscriberCount: a0.premium_subscription_count,
nsfwLevel: a0.nsfw_level,
premiumTier: a0.premium_tier,
homeHeader: a0.home_header
}
});
}
export function fromGuildProfile(a0) {
let premiumSubscriberCount = a0.premiumSubscriberCount;
if (premiumSubscriberCount == null) {
premiumSubscriberCount = GUILD_DEFAULT_PROPERTY_VALUES.premiumSubscriberCount;
}
let premiumTier = a0.premiumTier;
if (premiumTier == null) {
premiumTier = GUILD_DEFAULT_PROPERTY_VALUES.premiumTier;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
description: a0.description,
icon: a0.icon,
premiumSubscriberCount,
premiumTier,
features: toSetInplace(a0.features)
}
});
}
export function fromStoreListingGuild(a0) {
let icon = a0.icon;
if (icon == null) {
icon = null;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
icon
}
});
}
export function fromDirectoryGuild(a0) {
let icon = a0.icon;
if (icon == null) {
icon = null;
}
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
icon,
description,
splash,
features: toSetInplace(a0.features)
}
});
}
export function fromGuildDirectoryEntry(a0) {
let name = a0.name;
if (name == null) {
name = "";
}
let icon = a0.icon;
if (icon == null) {
icon = null;
}
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.guildId,
name,
icon,
description,
splash,
features: toSetInplace(a0.features)
}
});
}
export function fromVerificationGateGuild(a0) {
let icon = a0.icon;
if (icon == null) {
icon = null;
}
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
const r3 = {
id: a0.id,
name: a0.name,
icon,
description,
splash,
features: toSetInplace(a0.features),
verificationLevel: null
};
let verification_level = a0.verification_level;
if (verification_level == null) {
verification_level = GUILD_DEFAULT_PROPERTY_VALUES.verificationLevel;
}
r3.verificationLevel = verification_level;
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...r3
});
}
export function fromClientDiscoverableGuild(a0) {
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
let banner = a0.banner;
if (banner == null) {
banner = null;
}
let preferredLocale = a0.preferredLocale;
if (preferredLocale == null) {
preferredLocale = GUILD_DEFAULT_PROPERTY_VALUES.preferredLocale;
}
let icon = a0.icon;
if (icon == null) {
icon = null;
}
const r3 = {
id: a0.id,
name: a0.name,
description,
splash,
banner,
preferredLocale,
icon,
features: toSetInplace(a0.features),
premiumSubscriberCount: null,
discoverySplash: null
};
let premiumSubscriptionCount = a0.premiumSubscriptionCount;
if (premiumSubscriptionCount == null) {
premiumSubscriptionCount = GUILD_DEFAULT_PROPERTY_VALUES.premiumSubscriberCount;
}
r3.premiumSubscriberCount = premiumSubscriptionCount;
let discoverySplash = a0.discoverySplash;
if (discoverySplash == null) {
discoverySplash = null;
}
r3.discoverySplash = discoverySplash;
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...r3
});
}
export function fromGuildBasic(a0) {
let icon = a0.icon;
if (icon == null) {
icon = null;
}
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
let discovery_splash = a0.discovery_splash;
if (discovery_splash == null) {
discovery_splash = null;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
icon,
description,
splash,
discoverySplash: discovery_splash,
features: toSetInplace(a0.features)
}
});
}
export function dangerouslyConstructGuildRecordFromUntypedObject(a0) {
const r4 = {
id: a0.id,
name: a0.name || "",
description: a0.description || null,
ownerId: a0.ownerId || null,
icon: a0.icon || null,
splash: a0.splash || null,
banner: a0.banner || null,
homeHeader: a0.homeHeader || null,
features: toSetInplace(a0.features),
preferredLocale: a0.preferredLocale || GUILD_DEFAULT_PROPERTY_VALUES.preferredLocale,
afkChannelId: a0.afkChannelId || null,
afkTimeout: a0.afkTimeout,
systemChannelId: a0.systemChannelId || null,
verificationLevel: a0.verificationLevel || GUILD_DEFAULT_PROPERTY_VALUES.verificationLevel,
joinedAt: null,
defaultMessageNotifications: null,
mfaLevel: null,
application_id: null,
explicitContentFilter: null,
vanityURLCode: null,
premiumTier: null,
premiumSubscriberCount: null,
premiumProgressBarEnabled: null,
premiumProgressBarEnabledUserUpdatedAt: null,
systemChannelFlags: null,
discoverySplash: null,
rulesChannelId: null,
safetyAlertsChannelId: null,
publicUpdatesChannelId: null,
maxStageVideoChannelUsers: null,
maxVideoChannelUsers: null,
maxMembers: null,
nsfwLevel: null,
ownerConfiguredContentLevel: null,
hubType: null,
latestOnboardingQuestionId: null,
profile: null,
guildTheme: null,
premiumFeatures: null,
moderatorReporting: null,
gameApplicationIds: null,
officialMessageColor: null,
verificationRoleId: null
};
const r0 = a0.joinedAt instanceof Date;
const joinedAt = a0.joinedAt;
r4.joinedAt = r0 ? joinedAt : joinedAt != null ? new Date(a0.joinedAt) : a0.joinedAt;
r4.defaultMessageNotifications = a0.defaultMessageNotifications || GUILD_DEFAULT_PROPERTY_VALUES.defaultMessageNotifications;
r4.mfaLevel = a0.mfaLevel || GUILD_DEFAULT_PROPERTY_VALUES.mfaLevel;
r4.application_id = a0.application_id || null;
r4.explicitContentFilter = a0.explicitContentFilter || GUILD_DEFAULT_PROPERTY_VALUES.explicitContentFilter;
r4.vanityURLCode = a0.vanityURLCode || null;
r4.premiumTier = a0.premiumTier || GUILD_DEFAULT_PROPERTY_VALUES.premiumTier;
r4.premiumSubscriberCount = a0.premiumSubscriberCount || GUILD_DEFAULT_PROPERTY_VALUES.premiumSubscriberCount;
r4.premiumProgressBarEnabled = a0.premiumProgressBarEnabled || GUILD_DEFAULT_PROPERTY_VALUES.premiumProgressBarEnabled;
const r55 = a0.premiumProgressBarEnabledUserUpdatedAt instanceof Date;
const premiumProgressBarEnabledUserUpdatedAt = a0.premiumProgressBarEnabledUserUpdatedAt;
r4.premiumProgressBarEnabledUserUpdatedAt = r55 ? premiumProgressBarEnabledUserUpdatedAt : premiumProgressBarEnabledUserUpdatedAt != null ? new Date(a0.premiumProgressBarEnabledUserUpdatedAt) : null;
r4.systemChannelFlags = a0.systemChannelFlags;
r4.discoverySplash = a0.discoverySplash || null;
r4.rulesChannelId = a0.rulesChannelId || null;
r4.safetyAlertsChannelId = a0.safetyAlertsChannelId || null;
r4.publicUpdatesChannelId = a0.publicUpdatesChannelId || null;
r4.maxStageVideoChannelUsers = a0.maxStageVideoChannelUsers || GUILD_DEFAULT_PROPERTY_VALUES.maxStageVideoChannelUsers;
r4.maxVideoChannelUsers = a0.maxVideoChannelUsers || GUILD_DEFAULT_PROPERTY_VALUES.maxVideoChannelUsers;
r4.maxMembers = a0.maxMembers || GUILD_DEFAULT_PROPERTY_VALUES.maxMembers;
let nsfwLevel = a0.nsfwLevel;
if (nsfwLevel == null) {
nsfwLevel = GUILD_DEFAULT_PROPERTY_VALUES.nsfwLevel;
}
r4.nsfwLevel = nsfwLevel;
let ownerConfiguredContentLevel = a0.ownerConfiguredContentLevel;
if (ownerConfiguredContentLevel == null) {
ownerConfiguredContentLevel = null;
}
r4.ownerConfiguredContentLevel = ownerConfiguredContentLevel;
r4.hubType = a0.hubType;
let latestOnboardingQuestionId = a0.latestOnboardingQuestionId;
if (latestOnboardingQuestionId == null) {
latestOnboardingQuestionId = null;
}
r4.latestOnboardingQuestionId = latestOnboardingQuestionId;
let profile = a0.profile;
if (profile == null) {
profile = null;
}
r4.profile = profile;
let guildTheme = a0.guildTheme;
if (guildTheme == null) {
guildTheme = null;
}
r4.guildTheme = guildTheme;
let premiumFeatures = a0.premiumFeatures;
if (premiumFeatures == null) {
premiumFeatures = null;
}
r4.premiumFeatures = premiumFeatures;
let moderatorReporting = a0.moderatorReporting;
if (moderatorReporting == null) {
moderatorReporting = null;
}
r4.moderatorReporting = moderatorReporting;
let gameApplicationIds = a0.gameApplicationIds;
if (gameApplicationIds == null) {
gameApplicationIds = null;
}
r4.gameApplicationIds = gameApplicationIds;
let officialMessageColor = a0.officialMessageColor;
if (officialMessageColor == null) {
officialMessageColor = null;
}
r4.officialMessageColor = officialMessageColor;
let verificationRoleId = a0.verificationRoleId;
if (verificationRoleId == null) {
verificationRoleId = null;
}
r4.verificationRoleId = verificationRoleId;
return constructInPlace(GuildRecordTypeTag, r4);
}
export function toGuildProperties(a0) {
const r2 = {
id: a0.id,
name: a0.name,
description: a0.description,
icon: a0.icon,
splash: a0.splash,
banner: a0.banner,
home_header: a0.homeHeader,
features: Array.from(a0.features),
preferred_locale: a0.preferredLocale,
owner_id: a0.ownerId,
application_id: a0.application_id,
afk_channel_id: a0.afkChannelId,
afk_timeout: a0.afkTimeout,
system_channel_id: a0.systemChannelId,
verification_level: a0.verificationLevel,
explicit_content_filter: a0.explicitContentFilter,
default_message_notifications: a0.defaultMessageNotifications,
mfa_level: a0.mfaLevel,
vanity_url_code: null,
premium_tier: null,
premium_progress_bar_enabled: null,
premium_progress_bar_enabled_user_updated_at: null,
premium_features: null,
system_channel_flags: null,
discovery_splash: null,
rules_channel_id: null,
safety_alerts_channel_id: null,
public_updates_channel_id: null,
max_stage_video_channel_users: null,
max_video_channel_users: null,
max_members: null,
nsfw_level: null,
nsfw: null,
owner_configured_content_level: null,
hub_type: null,
latest_onboarding_question_id: null,
profile: null,
theme: null,
moderator_reporting: null,
official_message_color: null,
incidents_data: null,
game_application_ids: null,
verification_role_id: null
};
let vanityURLCode = a0.vanityURLCode;
if (vanityURLCode == null) {
vanityURLCode = null;
}
r2.vanity_url_code = vanityURLCode;
r2.premium_tier = a0.premiumTier;
r2.premium_progress_bar_enabled = a0.premiumProgressBarEnabled;
const premiumProgressBarEnabledUserUpdatedAt = a0.premiumProgressBarEnabledUserUpdatedAt;
let premium_progress_bar_enabled_user_updated_at = premiumProgressBarEnabledUserUpdatedAt == null ? void 0 : premiumProgressBarEnabledUserUpdatedAt.toISOString();
if (premium_progress_bar_enabled_user_updated_at == null) {
premium_progress_bar_enabled_user_updated_at = null;
}
r2.premium_progress_bar_enabled_user_updated_at = premium_progress_bar_enabled_user_updated_at;
const r38 = a0.premiumFeatures != null;
let premium_features = null;
if (r38) {
const premiumFeatures = a0.premiumFeatures;
premium_features = {
features: premiumFeatures.features,
additional_emoji_slots: premiumFeatures.additionalEmojiSlots,
additional_sticker_slots: premiumFeatures.additionalStickerSlots,
additional_sound_slots: premiumFeatures.additionalSoundSlots
};
}
r2.premium_features = premium_features;
r2.system_channel_flags = a0.systemChannelFlags;
r2.discovery_splash = a0.discoverySplash;
r2.rules_channel_id = a0.rulesChannelId;
r2.safety_alerts_channel_id = a0.safetyAlertsChannelId;
r2.public_updates_channel_id = a0.publicUpdatesChannelId;
r2.max_stage_video_channel_users = a0.maxStageVideoChannelUsers;
r2.max_video_channel_users = a0.maxVideoChannelUsers;
r2.max_members = a0.maxMembers;
r2.nsfw_level = a0.nsfwLevel;
r2.nsfw = [GuildNSFWContentLevel.AGE_RESTRICTED, GuildNSFWContentLevel.EXPLICIT].includes(a0.nsfwLevel);
r2.owner_configured_content_level = a0.ownerConfiguredContentLevel;
r2.hub_type = a0.hubType;
r2.latest_onboarding_question_id = a0.latestOnboardingQuestionId;
r2.profile = a0.profile;
const r67 = a0.guildTheme != null;
let theme = null;
if (r67) {
const guildTheme = a0.guildTheme;
theme = {
enabled: guildTheme.enabled,
...toServerGuildThemeSettings(guildTheme.themeSettings)
};
}
r2.theme = theme;
const r79 = a0.moderatorReporting != null;
let moderator_reporting = null;
if (r79) {
const moderatorReporting = a0.moderatorReporting;
moderator_reporting = {
moderator_reporting_enabled: moderatorReporting.moderatorReportingEnabled,
moderator_report_channel_id: moderatorReporting.moderatorReportChannelId
};
}
r2.moderator_reporting = moderator_reporting;
r2.official_message_color = a0.officialMessageColor;
r2.game_application_ids = a0.gameApplicationIds;
r2.verification_role_id = a0.verificationRoleId;
return r2;
}
export function fromSerializedGuildRecord(a0) {
const r4 = {
...a0,
features: toSetInplace(a0.features),
joinedAt: a0.joinedAt != null ? new Date(a0.joinedAt) : null,
premiumProgressBarEnabledUserUpdatedAt: a0.premiumProgressBarEnabledUserUpdatedAt != null ? new Date(a0.premiumProgressBarEnabledUserUpdatedAt) : null
};
delete r4["roles"];
delete r4["member"];
return constructInPlace(GuildRecordTypeTag, r4);
}
export function constructFromPartialGuildRecord(a0) {
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...a0
});
}