Please look over - not for production
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 628b607..88f7b39 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -3,9 +3,9 @@
GuildMember,
ActionRowBuilder,
ButtonBuilder,
- User,
ButtonStyle,
- SlashCommandSubcommandBuilder
+ SlashCommandSubcommandBuilder,
+ ButtonInteraction
} from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -29,8 +29,16 @@
.setRequired(false)
);
-const callback = async (interaction: CommandInteraction): Promise<void> => {
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<void> => {
if (!interaction.guild) return;
+ let deleteDays;
+ if (!interaction.isButton()) {
+ member = interaction.options.getMember("user") as GuildMember;
+ deleteDays = (interaction.options.get("delete")?.value as number | null) ?? 0
+ } else {
+ deleteDays = 0;
+ }
+ if (!member) return;
const { renderUser } = client.logger;
// TODO:[Modals] Replace the command arguments with a modal
let reason = null;
@@ -44,15 +52,12 @@
.setTitle("Ban")
.setDescription(
keyValueList({
- user: renderUser(interaction.options.getUser("user")!),
+ user: renderUser(member.user),
reason: reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*"
}) +
`The user **will${notify ? "" : " not"}** be notified\n` +
- `${addPlurals(
- (interaction.options.get("delete")?.value as number | null) ?? 0,
- "day"
- )} of messages will be deleted\n\n` +
- `Are you sure you want to ban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
+ `${addPlurals(deleteDays, "day")} of messages will be deleted\n\n` +
+ `Are you sure you want to ban <@!${member.id}>?`
)
.addCustomBoolean(
"notify",
@@ -113,23 +118,21 @@
.setURL(
config.moderation.ban.link.replaceAll(
"{id}",
- (interaction.options.getMember("user") as GuildMember).id
+ member.id
)
)
)
);
}
- dmMessage = await (interaction.options.getMember("user") as GuildMember).send(messageData);
+ dmMessage = await member.send(messageData);
dmSent = true;
}
} catch {
dmSent = false;
}
try {
- const member = interaction.options.getMember("user") as GuildMember;
- const days: number = (interaction.options.get("delete")?.value as number | null) ?? 0;
member.ban({
- deleteMessageSeconds: days * 24 * 60 * 60,
+ deleteMessageSeconds: deleteDays * 24 * 60 * 60,
reason: reason ?? "*No reason provided*"
});
await client.database.history.create("ban", interaction.guild.id, member.user, interaction.user, reason);
@@ -189,23 +192,22 @@
});
};
-const check = async (interaction: CommandInteraction, partial: boolean = false) => {
+const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
// Check if the user has ban_members permission
if (!member.permissions.has("BanMembers")) return "You do not have the *Ban Members* permission";
if (partial) return true;
const me = interaction.guild.members.me!;
- let apply = interaction.options.getUser("user") as User | GuildMember;
+ let apply: GuildMember;
+ if (interaction.isButton()) {
+ apply = target!;
+ } else {
+ apply = interaction.options.getMember("user") as GuildMember;
+ };
const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
const mePos = me.roles.cache.size > 1 ? me.roles.highest.position : 0;
- let applyPos = 0;
- try {
- apply = (await interaction.guild.members.fetch(apply.id)) as GuildMember;
- applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
- } catch {
- apply = apply as User;
- }
+ const applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
// Do not allow banning the owner
if (member.id === interaction.guild.ownerId) return "You cannot ban the owner of the server";
// Check if Nucleus can ban the member
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index c4f1867..4d325a2 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -5,7 +5,8 @@
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
- SlashCommandSubcommandBuilder
+ SlashCommandSubcommandBuilder,
+ ButtonInteraction
} from "discord.js";
// @ts-expect-error
import humanizeDuration from "humanize-duration";
@@ -22,8 +23,12 @@
.setDescription("Kicks a user from the server")
.addUserOption((option) => option.setName("user").setDescription("The user to kick").setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<void> => {
if (!interaction.guild) return;
+ if (!interaction.isButton()) {
+ member = interaction.options.getMember("user") as GuildMember;
+ }
+ if (!member) return;
const { renderUser } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason: string | null = null;
@@ -37,9 +42,9 @@
.setTitle("Kick")
.setDescription(
keyValueList({
- user: renderUser(interaction.options.getUser("user")!),
+ user: renderUser(member.user),
reason: reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*"
- }) + `Are you sure you want to kick <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
+ }) + `Are you sure you want to kick <@!${member.id}>?`
)
.setColor("Danger")
.addCustomBoolean(
@@ -101,21 +106,20 @@
.setURL(
config.moderation.kick.link.replaceAll(
"{id}",
- (interaction.options.getMember("user") as GuildMember).id
+ member.id
)
)
)
);
}
- dmMessage = await (interaction.options.getMember("user") as GuildMember).send(messageData);
+ dmMessage = await member.send(messageData);
dmSent = true;
}
} catch {
dmSent = false;
}
try {
- (interaction.options.getMember("user") as GuildMember).kick(reason || "No reason provided");
- const member = interaction.options.getMember("user") as GuildMember;
+ member.kick(reason || "No reason provided");
await client.database.history.create("kick", interaction.guild.id, member.user, interaction.user, reason);
const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
const timeInServer = member.joinedTimestamp
@@ -186,7 +190,7 @@
});
};
-const check = (interaction: CommandInteraction, partial: boolean = false) => {
+const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
@@ -195,7 +199,12 @@
if (partial) return true;
const me = interaction.guild.members.me!;
- const apply = interaction.options.getMember("user") as GuildMember;
+ let apply: GuildMember;
+ if (interaction.isButton()) {
+ apply = target!;
+ } else {
+ apply = interaction.options.getMember("user") as GuildMember;
+ }
const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
const mePos = me.roles.cache.size > 1 ? me.roles.highest.position : 0;
const applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 39c9e5e..51ffc4d 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,5 +1,5 @@
import { LinkWarningFooter, LoadingEmbed } from "../../utils/defaults.js";
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } from "discord.js";
import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -49,16 +49,22 @@
.setRequired(false)
);
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
if (!interaction.guild) return;
const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
- const member = interaction.options.getMember("user") as GuildMember;
- const time: { days: number; hours: number; minutes: number; seconds: number } = {
- days: (interaction.options.get("days")?.value as number | null) ?? 0,
- hours: (interaction.options.get("hours")?.value as number | null) ?? 0,
- minutes: (interaction.options.get("minutes")?.value as number | null) ?? 0,
- seconds: (interaction.options.get("seconds")?.value as number | null) ?? 0
- };
+ let time: { days: number; hours: number; minutes: number; seconds: number } | null = null;
+ if (!interaction.isButton()) {
+ member = interaction.options.getMember("user") as GuildMember;
+ time = {
+ days: (interaction.options.get("days")?.value as number | null) ?? 0,
+ hours: (interaction.options.get("hours")?.value as number | null) ?? 0,
+ minutes: (interaction.options.get("minutes")?.value as number | null) ?? 0,
+ seconds: (interaction.options.get("seconds")?.value as number | null) ?? 0
+ };
+ } else {
+ time = {days: 0, hours: 0, minutes: 0, seconds: 0};
+ }
+ if (!member) return;
const config = await client.database.guilds.read(interaction.guild.id);
let serverSettingsDescription = config.moderation.mute.timeout ? "given a timeout" : "";
if (config.moderation.mute.role)
@@ -198,7 +204,7 @@
"Create appeal ticket",
!(await areTicketsEnabled(interaction.guild.id)),
async () =>
- await create(interaction.guild!, interaction.options.getUser("user")!, interaction.user, reason),
+ await create(interaction.guild!, member!.user, interaction.user, reason),
"An appeal ticket will be created when Confirm is clicked",
null,
"CONTROL.TICKET",
@@ -275,12 +281,7 @@
new ButtonBuilder()
.setStyle(ButtonStyle.Link)
.setLabel(config.moderation.mute.text)
- .setURL(
- config.moderation.mute.link.replaceAll(
- "{id}",
- (interaction.options.getMember("user") as GuildMember).id
- )
- )
+ .setURL(config.moderation.mute.link.replaceAll("{id}", member.id))
)
);
}
@@ -399,14 +400,19 @@
});
};
-const check = async (interaction: CommandInteraction, partial: boolean = false) => {
+const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
// Check if the user has moderate_members permission
if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission";
if (partial) return true;
const me = interaction.guild.members.me!;
- const apply = interaction.options.getMember("user") as GuildMember;
+ let apply;
+ if (interaction.isButton()) {
+ apply = target!;
+ } else {
+ apply = interaction.options.getMember("user") as GuildMember;
+ }
const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
const mePos = me.roles.cache.size > 1 ? me.roles.highest.position : 0;
const applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 8b33551..743579b 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -1,5 +1,5 @@
import { LinkWarningFooter } from "./../../utils/defaults.js";
-import { ActionRowBuilder, ButtonBuilder, CommandInteraction, GuildMember, ButtonStyle, Message } from "discord.js";
+import { ActionRowBuilder, ButtonBuilder, CommandInteraction, GuildMember, ButtonStyle, Message, ButtonInteraction, ModalBuilder, TextInputBuilder, TextInputStyle } from "discord.js";
import type { SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -17,31 +17,37 @@
option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false)
);
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
const { log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
+ let newNickname;
+ if (!interaction.isButton()) {
+ member = interaction.options.getMember("user") as GuildMember;
+ newNickname = interaction.options.get("name")?.value as string | undefined;
+ }
+ if (!member) return;
// TODO:[Modals] Replace this with a modal
- let notify = true;
+ let notify = false;
let confirmation;
let timedOut = false;
let success = false;
let createAppealTicket = false;
- let firstRun = true;
+ let firstRun = !interaction.isButton();
do {
confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.NICKNAME.RED")
.setTitle("Nickname")
.setDescription(
keyValueList({
- user: renderUser(interaction.options.getUser("user")!),
+ user: renderUser(member.user),
"new nickname": `${
- (interaction.options.get("name")?.value as string)
- ? (interaction.options.get("name")?.value as string)
+ newNickname
+ ? newNickname
: "*No nickname*"
}`
}) +
`Are you sure you want to ${
- (interaction.options.get("name")?.value as string) ? "change" : "clear"
- } <@!${(interaction.options.getMember("user") as GuildMember).id}>'s nickname?`
+ newNickname ? "change" : "clear"
+ } <@!${member.id}>'s nickname?`
)
.setColor("Danger")
.addCustomBoolean(
@@ -51,7 +57,7 @@
async () =>
await create(
interaction.guild!,
- interaction.options.getUser("user")!,
+ member!.user,
interaction.user,
"Nickname changed"
),
@@ -70,6 +76,25 @@
"ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
notify
)
+ .addModal(
+ "Change nickname",
+ "ICONS.EDIT",
+ "modal",
+ newNickname ?? "",
+ new ModalBuilder()
+ .setTitle("Editing nickname")
+ .addComponents(
+ new ActionRowBuilder<TextInputBuilder>().addComponents(
+ new TextInputBuilder()
+ .setCustomId("default")
+ .setLabel("Nickname")
+ .setMaxLength(32)
+ .setRequired(false)
+ .setStyle(TextInputStyle.Short)
+ .setValue(newNickname ? newNickname : " ")
+ )
+ )
+ )
.setFailedMessage("No changes were made", "Success", "PUNISH.NICKNAME.GREEN")
.send(!firstRun);
firstRun = false;
@@ -79,6 +104,7 @@
notify = confirmation.components["notify"]!.active;
createAppealTicket = confirmation.components["appeal"]!.active;
}
+ if (confirmation.modals) newNickname = confirmation.modals![0]!.value
} while (!timedOut && !success);
if (timedOut || !success) return;
let dmSent = false;
@@ -96,10 +122,10 @@
.setTitle("Nickname changed")
.setDescription(
`Your nickname was ${
- (interaction.options.get("name")?.value as string) ? "changed" : "cleared"
+ newNickname ? "changed" : "cleared"
} in ${interaction.guild!.name}.` +
- ((interaction.options.get("name")?.value as string)
- ? `\nIt is now: ${interaction.options.get("name")?.value as string}`
+ (newNickname
+ ? `\nIt is now: ${newNickname}`
: "") +
"\n\n" +
(createAppealTicket
@@ -122,26 +148,22 @@
.setURL(
config.moderation.nick.link.replaceAll(
"{id}",
- (interaction.options.getMember("user") as GuildMember).id
+ member.id
)
)
)
);
}
- dmMessage = await (interaction.options.getMember("user") as GuildMember).send(messageData);
+ dmMessage = await member.send(messageData);
dmSent = true;
}
} catch {
dmSent = false;
}
- let member: GuildMember;
let before: string | null;
- let nickname: string | undefined;
try {
- member = interaction.options.getMember("user") as GuildMember;
before = member.nickname;
- nickname = interaction.options.get("name")?.value as string | undefined;
- member.setNickname(nickname ?? null, "Nucleus Nickname command");
+ member.setNickname(newNickname ?? null, "Nucleus Nickname command");
await client.database.history.create(
"nickname",
interaction.guild!.id,
@@ -149,7 +171,7 @@
interaction.user,
null,
before,
- nickname
+ newNickname
);
} catch {
await interaction.editReply({
@@ -175,9 +197,9 @@
timestamp: Date.now()
},
list: {
- memberId: entry(member.id, `\`${member.id}\``),
+ member: entry(member.id, renderUser(member.user)),
before: entry(before, before ?? "*No nickname set*"),
- after: entry(nickname ?? null, nickname ?? "*No nickname set*"),
+ after: entry(newNickname ?? null, newNickname ?? "*No nickname set*"),
updated: entry(Date.now(), renderDelta(Date.now())),
updatedBy: entry(interaction.user.id, renderUser(interaction.user))
},
@@ -210,13 +232,18 @@
});
};
-const check = async (interaction: CommandInteraction, partial: boolean = false) => {
+const check = async (interaction: CommandInteraction | ButtonInteraction, partial: boolean, target?: GuildMember) => {
const member = interaction.member as GuildMember;
// Check if the user has manage_nicknames permission
if (!member.permissions.has("ManageNicknames")) return "You do not have the *Manage Nicknames* permission";
if (partial) return true;
const me = interaction.guild!.members.me!;
- const apply = interaction.options.getMember("user") as GuildMember;
+ let apply: GuildMember;
+ if (interaction.isButton()) {
+ apply = target!;
+ } else {
+ apply = interaction.options.getMember("user") as GuildMember;
+ }
const memberPos = member.roles.cache.size ? member.roles.highest.position : 0;
const mePos = me.roles.cache.size ? me.roles.highest.position : 0;
const applyPos = apply.roles.cache.size ? apply.roles.highest.position : 0;
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 5d1bd94..8408303 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,4 +1,4 @@
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } from "discord.js";
import type { SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -14,9 +14,11 @@
.setDescription("Warns a user")
.addUserOption((option) => option.setName("user").setDescription("The user to warn").setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
- if (interaction.guild === null) return;
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
+ if (!interaction.guild) return;
const { log, NucleusColors, renderUser, entry } = client.logger;
+ if (!interaction.isButton()) member = interaction.options.getMember("user") as GuildMember;
+ if (!member) return;
// TODO:[Modals] Replace this with a modal
let reason: string | null = null;
let notify = true;
@@ -30,9 +32,9 @@
.setTitle("Warn")
.setDescription(
keyValueList({
- user: renderUser(interaction.options.getUser("user")!),
+ user: renderUser(member.user),
reason: reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*"
- }) + `Are you sure you want to warn <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
+ }) + `Are you sure you want to warn <@!${member.id}>?`
)
.setColor("Danger")
.addCustomBoolean(
@@ -40,7 +42,7 @@
"Create appeal ticket",
!(await areTicketsEnabled(interaction.guild.id)),
async () =>
- await create(interaction.guild!, interaction.options.getUser("user")!, interaction.user, reason),
+ await create(interaction.guild!, member!.user, interaction.user, reason),
"An appeal ticket will be created",
null,
"CONTROL.TICKET",
@@ -111,13 +113,13 @@
.setURL(
config.moderation.warn.link.replaceAll(
"{id}",
- (interaction.options.getMember("user") as GuildMember).id
+ member.id
)
)
)
);
}
- await (interaction.options.getMember("user") as GuildMember).send(messageData);
+ await member.send(messageData);
dmSent = true;
}
} catch (e) {
@@ -134,8 +136,8 @@
},
list: {
user: entry(
- (interaction.options.getMember("user") as GuildMember).user.id,
- renderUser((interaction.options.getMember("user") as GuildMember).user)
+ member.user.id,
+ renderUser(member.user)
),
warnedBy: entry(interaction.member!.user.id, renderUser(interaction.member!.user as Discord.User)),
reason: reason ? reason : "*No reason provided*"
@@ -152,7 +154,7 @@
await client.database.history.create(
"warn",
interaction.guild.id,
- (interaction.options.getMember("user") as GuildMember).user,
+ member.user,
interaction.user,
reason
);
@@ -177,7 +179,7 @@
components: []
});
} else {
- const canSeeChannel = (interaction.options.getMember("user") as GuildMember)
+ const canSeeChannel = member
.permissionsIn(interaction.channel as Discord.TextChannel)
.has("ViewChannel");
const m = (await interaction.editReply({
@@ -235,9 +237,9 @@
.setDescription("You have been warned" + (reason ? ` for:\n> ${reason}` : "."))
.setStatus("Danger")
],
- content: `<@!${(interaction.options.getMember("user") as GuildMember).id}>`,
+ content: `<@!${member.id}>`,
allowedMentions: {
- users: [(interaction.options.getMember("user") as GuildMember).id]
+ users: [member.id]
}
});
return await interaction.editReply({
@@ -271,7 +273,7 @@
} else if (component.customId === "ticket") {
const ticketChannel = await create(
interaction.guild,
- interaction.options.getUser("user")!,
+ member.user,
interaction.user,
reason,
"Warn Notification"
@@ -302,13 +304,17 @@
}
};
-const check = (interaction: CommandInteraction, partial: boolean = false) => {
+const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission";
if (partial) return true;
- const apply = interaction.options.getMember("user") as GuildMember | null;
- if (apply === null) return "That member is not in the server";
+ let apply: GuildMember;
+ if (interaction.isButton()) {
+ apply = target!;
+ } else {
+ apply = interaction.options.getMember("user") as GuildMember;
+ }
const memberPos = member.roles.cache.size ? member.roles.highest.position : 0;
const applyPos = apply.roles.cache.size ? apply.roles.highest.position : 0;
// Do not allow warning bots
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 058695c..1eceae2 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -28,7 +28,10 @@
.setDescription(description)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
- ], components: [new ActionRowBuilder<ButtonBuilder>().addComponents(new ButtonBuilder().setCustomId("admin").setLabel("Admin Panel").setStyle(ButtonStyle.Primary))]
+ ], components: [new ActionRowBuilder<ButtonBuilder>().addComponents(
+ new ButtonBuilder().setCustomId("admin").setLabel("Admin Panel").setStyle(ButtonStyle.Primary),
+ new ButtonBuilder().setCustomId("mod:nickname:599498449733550102").setLabel("Testing").setStyle(ButtonStyle.Primary)
+ )]
});
const modal = new ModalBuilder()
diff --git a/src/commands/settings/automod.ts b/src/commands/settings/automod.ts
index 9d59520..db4a1c4 100644
--- a/src/commands/settings/automod.ts
+++ b/src/commands/settings/automod.ts
@@ -1069,17 +1069,19 @@
closed = true;
continue;
}
- await i.deferUpdate();
if (i.isButton()) {
+ await i.deferUpdate();
await client.database.guilds.write(interaction.guild.id, { filters: config });
await client.memory.forceUpdate(interaction.guild.id);
} else {
switch (i.values[0]) {
case "invites": {
+ i.deferUpdate();
config.invite = await inviteMenu(i, m, config.invite);
break;
}
case "mentions": {
+ i.deferUpdate();
config.pings = await mentionMenu(i, m, config.pings);
break;
}
@@ -1088,15 +1090,18 @@
break;
}
case "malware": {
+ i.deferUpdate();
config.malware = !config.malware;
break;
}
case "images": {
+ i.deferUpdate();
const next = await imageMenu(i, m, config.images);
config.images = next;
break;
}
case "clean": {
+ i.deferUpdate();
const next = await cleanMenu(i, m, config.clean);
config.clean = next;
break;