Skip to content

Commit 5ed4772

Browse files
committed
let guilds be set as discoverable
1 parent e3bcb9d commit 5ed4772

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/webpage/guild.ts

+21-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,22 @@ class Guild extends SnowFlake {
165165
{defaultIndex: sysmap.indexOf(this.properties.system_channel_id)},
166166
sysmap,
167167
);
168+
console.log(textChannels, this.channels);
169+
const options: ["DISCOVERABLE", "COMMUNITY", "INVITES_DISABLED"] = [
170+
"DISCOVERABLE",
171+
"COMMUNITY",
172+
"INVITES_DISABLED",
173+
];
174+
const defaultIndex = options.findIndex((_) => this.properties.features.includes(_));
175+
form.addSelect(
176+
I18n.guild.howJoin(),
177+
"features",
178+
options.map((_) => I18n.guild[_]()),
179+
{
180+
defaultIndex: defaultIndex == -1 ? 1 : defaultIndex,
181+
},
182+
options,
183+
);
168184

169185
form.addCheckboxInput(I18n.getTranslation("guild.sendrandomwelcome?"), "s1", {
170186
initState: !(this.properties.system_channel_flags & 1),
@@ -189,6 +205,11 @@ class Guild extends SnowFlake {
189205
bits += (1 - e.s4) * 8;
190206
delete e.s4;
191207
e.system_channel_flags = bits;
208+
const temp = this.properties.features;
209+
//@ts-ignore
210+
temp.filter((_) => !options.includes(_));
211+
temp.push(e.features);
212+
e.features = temp;
192213
});
193214

194215
form.addHR();
@@ -439,7 +460,6 @@ class Guild extends SnowFlake {
439460
this.member_count = json.member_count;
440461
this.emojis = json.emojis;
441462
this.headers = this.owner.headers;
442-
this.channels = [];
443463
if (this.properties.icon !== json.icon) {
444464
this.properties.icon = json.icon;
445465
if (this.HTMLicon) {

translations/en.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@
237237
"stickWelcomeReact?": "Prompt members of your guild to react with a sticker when someone joins!",
238238
"boostMessage?": "Send a message when someone boosts your guild!",
239239
"helpTips?": "Send helpful tips for your guild!",
240-
"defaultNoti": "Set the default notification settings of your guild!"
240+
"defaultNoti": "Set the default notification settings of your guild!",
241+
"howJoin": "How can people join your guild?",
242+
"COMMUNITY": "Apply to join",
243+
"INVITES_DISABLED": "Invite only",
244+
"DISCOVERABLE": "Discovery"
241245
},
242246
"role": {
243247
"displaySettings": "Display settings",

0 commit comments

Comments
 (0)