fixed loads of typing errors
diff --git a/src/commands/settings/stats.ts b/src/commands/settings/stats.ts
index dd4027d..f8a57b7 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -136,11 +136,12 @@
}
if (i.isButton()) {
switch (i.customId) {
- case "back":
+ case "back": {
await i.deferUpdate();
closed = true;
break;
- case "save":
+ }
+ case "save": {
await i.deferUpdate();
if (newChannel) {
currentObject[newChannel] = {
@@ -150,7 +151,8 @@
}
closed = true;
break;
- case "editName":
+ }
+ case "editName": {
await interaction.editReply({
embeds: [new EmojiEmbed()
.setTitle("Stats Channel")
@@ -170,20 +172,21 @@
});
showModal(i, {name: newChannelName, enabled: newChannelEnabled})
- const out = await modalInteractionCollector(
+ const out: Discord.ModalSubmitInteraction | ButtonInteraction| null = await modalInteractionCollector(
m,
(m) => m.channel!.id === interaction.channel!.id && m.user!.id === interaction.user!.id,
(i) => i.channel!.id === interaction.channel!.id && i.user!.id === interaction.user!.id && i.message!.id === m.id
- ) as Discord.ModalSubmitInteraction | null;
+ );
if (!out) continue;
- if (!out.fields) continue;
if (out.isButton()) continue;
newChannelName = out.fields.getTextInputValue("text");
break;
- case "toggleEnabled":
+ }
+ case "toggleEnabled": {
await i.deferUpdate();
newChannelEnabled = !newChannelEnabled;
break;
+ }
}
} else {
await i.deferUpdate();
@@ -307,11 +310,12 @@
if(i.isStringSelectMenu()) {
switch(i.customId) {
- case "page":
+ case "page": {
await i.deferUpdate();
page = Object.keys(currentObject).indexOf(i.values[0]!);
break;
- case "action":
+ }
+ case "action": {
modified = true;
switch(i.values[0]!) {
case "edit": {
@@ -345,7 +349,6 @@
continue;
}
if (!out) continue
- if (!out.fields) continue
if (out.isButton()) continue;
currentObject[Object.keys(currentObject)[page]!]!.name = out.fields.getTextInputValue("text");
break;
@@ -358,32 +361,37 @@
}
case "delete": {
await i.deferUpdate();
- delete currentObject[Object.keys(currentObject)[page]!];
+ currentObject = Object.fromEntries(Object.entries(currentObject).filter(([k]) => k !== Object.keys(currentObject)[page]!));
page = Math.min(page, Object.keys(currentObject).length - 1);
modified = true;
break;
}
}
break;
+ }
}
} else {
await i.deferUpdate();
switch(i.customId) {
- case "back":
+ case "back": {
page--;
break;
- case "next":
+ }
+ case "next": {
page++;
break;
- case "add":
+ }
+ case "add": {
currentObject = await addStatsChannel(interaction, m, currentObject);
page = Object.keys(currentObject).length - 1;
break;
- case "save":
+ }
+ case "save": {
client.database.guilds.write(interaction.guild.id, {stats: currentObject});
singleNotify("statsChannelDeleted", interaction.guild.id, true);
modified = false;
break;
+ }
}
}