From 5ed4772bc4c77527fc5f7578746bec4156b393ed Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Sun, 16 Mar 2025 23:02:31 -0500 Subject: [PATCH] let guilds be set as discoverable --- src/webpage/guild.ts | 22 +++++++++++++++++++++- translations/en.json | 6 +++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/webpage/guild.ts b/src/webpage/guild.ts index b2ec26b..0850f16 100644 --- a/src/webpage/guild.ts +++ b/src/webpage/guild.ts @@ -165,6 +165,22 @@ class Guild extends SnowFlake { {defaultIndex: sysmap.indexOf(this.properties.system_channel_id)}, sysmap, ); + console.log(textChannels, this.channels); + const options: ["DISCOVERABLE", "COMMUNITY", "INVITES_DISABLED"] = [ + "DISCOVERABLE", + "COMMUNITY", + "INVITES_DISABLED", + ]; + const defaultIndex = options.findIndex((_) => this.properties.features.includes(_)); + form.addSelect( + I18n.guild.howJoin(), + "features", + options.map((_) => I18n.guild[_]()), + { + defaultIndex: defaultIndex == -1 ? 1 : defaultIndex, + }, + options, + ); form.addCheckboxInput(I18n.getTranslation("guild.sendrandomwelcome?"), "s1", { initState: !(this.properties.system_channel_flags & 1), @@ -189,6 +205,11 @@ class Guild extends SnowFlake { bits += (1 - e.s4) * 8; delete e.s4; e.system_channel_flags = bits; + const temp = this.properties.features; + //@ts-ignore + temp.filter((_) => !options.includes(_)); + temp.push(e.features); + e.features = temp; }); form.addHR(); @@ -439,7 +460,6 @@ class Guild extends SnowFlake { this.member_count = json.member_count; this.emojis = json.emojis; this.headers = this.owner.headers; - this.channels = []; if (this.properties.icon !== json.icon) { this.properties.icon = json.icon; if (this.HTMLicon) { diff --git a/translations/en.json b/translations/en.json index 31542e2..09d3961 100644 --- a/translations/en.json +++ b/translations/en.json @@ -237,7 +237,11 @@ "stickWelcomeReact?": "Prompt members of your guild to react with a sticker when someone joins!", "boostMessage?": "Send a message when someone boosts your guild!", "helpTips?": "Send helpful tips for your guild!", - "defaultNoti": "Set the default notification settings of your guild!" + "defaultNoti": "Set the default notification settings of your guild!", + "howJoin": "How can people join your guild?", + "COMMUNITY": "Apply to join", + "INVITES_DISABLED": "Invite only", + "DISCOVERABLE": "Discovery" }, "role": { "displaySettings": "Display settings",