update defaults

This commit is contained in:
Erkin Alp Güney 2022-01-12 16:13:13 +03:00 committed by GitHub
parent 072a60fb03
commit cc698225a0

View File

@ -213,7 +213,7 @@ export class Guild extends BaseClass {
owner: User; owner: User;
@Column({ nullable: true }) @Column({ nullable: true })
preferred_locale?: string; // only community guilds can choose this preferred_locale?: string;
@Column({ nullable: true }) @Column({ nullable: true })
premium_subscription_count?: number; premium_subscription_count?: number;
@ -301,22 +301,22 @@ export class Guild extends BaseClass {
name: body.name || "Fosscord", name: body.name || "Fosscord",
icon: await handleFile(`/icons/${guild_id}`, body.icon as string), icon: await handleFile(`/icons/${guild_id}`, body.icon as string),
region: Config.get().regions.default, region: Config.get().regions.default,
owner_id: body.owner_id, owner_id: body.owner_id, // TODO: need to figure out a way for ownerless guilds and multiply-owned guilds
afk_timeout: 300, afk_timeout: 300,
default_message_notifications: 0, default_message_notifications: 1, // defaults effect: setting the push default at mentions-only will save a lot
explicit_content_filter: 0, explicit_content_filter: 0,
features: [], features: [],
id: guild_id, id: guild_id,
max_members: 250000, max_members: 250000,
max_presences: 250000, max_presences: 250000,
max_video_channel_users: 25, max_video_channel_users: 200,
presence_count: 0, presence_count: 0,
member_count: 0, // will automatically be increased by addMember() member_count: 0, // will automatically be increased by addMember()
mfa_level: 0, mfa_level: 0,
preferred_locale: "en-US", preferred_locale: "en-US",
premium_subscription_count: 0, premium_subscription_count: 0,
premium_tier: 0, premium_tier: 0,
system_channel_flags: 0, system_channel_flags: 4, // defaults effect: suppress the setup tips to save performance
unavailable: false, unavailable: false,
nsfw: false, nsfw: false,
nsfw_level: 0, nsfw_level: 0,
@ -326,7 +326,7 @@ export class Guild extends BaseClass {
description: "No description", description: "No description",
welcome_channels: [], welcome_channels: [],
}, },
widget_enabled: false, widget_enabled: true, // NB: don't set it as false to prevent artificial restrictions
}).save(); }).save();
// we have to create the role _after_ the guild because else we would get a "SQLITE_CONSTRAINT: FOREIGN KEY constraint failed" error // we have to create the role _after_ the guild because else we would get a "SQLITE_CONSTRAINT: FOREIGN KEY constraint failed" error
@ -337,6 +337,7 @@ export class Guild extends BaseClass {
color: 0, color: 0,
hoist: false, hoist: false,
managed: false, managed: false,
// NB: in Fosscord, every role will be non-managed, as we use user-groups instead of roles for managed groups
mentionable: false, mentionable: false,
name: "@everyone", name: "@everyone",
permissions: String("2251804225"), permissions: String("2251804225"),
@ -358,7 +359,6 @@ export class Guild extends BaseClass {
for (const channel of body.channels?.sort((a, b) => (a.parent_id ? 1 : -1))) { for (const channel of body.channels?.sort((a, b) => (a.parent_id ? 1 : -1))) {
var id = ids.get(channel.id) || Snowflake.generate(); var id = ids.get(channel.id) || Snowflake.generate();
// TODO: should we abort if parent_id is a category? (to disallow sub category channels)
var parent_id = ids.get(channel.parent_id); var parent_id = ids.get(channel.parent_id);
await Channel.createChannel({ ...channel, guild_id, id, parent_id }, body.owner_id, { await Channel.createChannel({ ...channel, guild_id, id, parent_id }, body.owner_id, {