Fixed typing
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 88f7b39..91e074d 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -34,7 +34,7 @@
let deleteDays;
if (!interaction.isButton()) {
member = interaction.options.getMember("user") as GuildMember;
- deleteDays = (interaction.options.get("delete")?.value as number | null) ?? 0
+ deleteDays = (interaction.options.get("delete")?.value as number | null) ?? 0;
} else {
deleteDays = 0;
}
@@ -115,12 +115,7 @@
new ButtonBuilder()
.setStyle(ButtonStyle.Link)
.setLabel(config.moderation.ban.text)
- .setURL(
- config.moderation.ban.link.replaceAll(
- "{id}",
- member.id
- )
- )
+ .setURL(config.moderation.ban.link.replaceAll("{id}", member.id))
)
);
}
@@ -204,7 +199,7 @@
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/kick.ts b/src/commands/mod/kick.ts
index 4d325a2..4ef78c8 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -103,12 +103,7 @@
new ButtonBuilder()
.setStyle(ButtonStyle.Link)
.setLabel(config.moderation.kick.text)
- .setURL(
- config.moderation.kick.link.replaceAll(
- "{id}",
- member.id
- )
- )
+ .setURL(config.moderation.kick.link.replaceAll("{id}", member.id))
)
);
}
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 51ffc4d..2266a1a 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,5 +1,12 @@
import { LinkWarningFooter, LoadingEmbed } from "../../utils/defaults.js";
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } 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,7 +56,10 @@
.setRequired(false)
);
-const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
+const callback = async (
+ interaction: CommandInteraction | ButtonInteraction,
+ member?: GuildMember
+): Promise<unknown> => {
if (!interaction.guild) return;
const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
let time: { days: number; hours: number; minutes: number; seconds: number } | null = null;
@@ -62,7 +72,7 @@
seconds: (interaction.options.get("seconds")?.value as number | null) ?? 0
};
} else {
- time = {days: 0, hours: 0, minutes: 0, seconds: 0};
+ time = { days: 0, hours: 0, minutes: 0, seconds: 0 };
}
if (!member) return;
const config = await client.database.guilds.read(interaction.guild.id);
@@ -203,8 +213,7 @@
"appeal",
"Create appeal ticket",
!(await areTicketsEnabled(interaction.guild.id)),
- async () =>
- await create(interaction.guild!, member!.user, interaction.user, reason),
+ async () => await create(interaction.guild!, member!.user, interaction.user, reason),
"An appeal ticket will be created when Confirm is clicked",
null,
"CONTROL.TICKET",
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 743579b..cfdcf47 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -1,5 +1,16 @@
import { LinkWarningFooter } from "./../../utils/defaults.js";
-import { ActionRowBuilder, ButtonBuilder, CommandInteraction, GuildMember, ButtonStyle, Message, ButtonInteraction, ModalBuilder, TextInputBuilder, TextInputStyle } 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,7 +28,10 @@
option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false)
);
-const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): 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()) {
@@ -39,28 +53,15 @@
.setDescription(
keyValueList({
user: renderUser(member.user),
- "new nickname": `${
- newNickname
- ? newNickname
- : "*No nickname*"
- }`
- }) +
- `Are you sure you want to ${
- newNickname ? "change" : "clear"
- } <@!${member.id}>'s nickname?`
+ "new nickname": `${newNickname ? newNickname : "*No nickname*"}`
+ }) + `Are you sure you want to ${newNickname ? "change" : "clear"} <@!${member.id}>'s nickname?`
)
.setColor("Danger")
.addCustomBoolean(
"appeal",
"Create appeal ticket",
!(await areTicketsEnabled(interaction.guild!.id)),
- async () =>
- await create(
- interaction.guild!,
- member!.user,
- interaction.user,
- "Nickname changed"
- ),
+ async () => await create(interaction.guild!, member!.user, interaction.user, "Nickname changed"),
"An appeal ticket will be created",
null,
"CONTROL.TICKET",
@@ -81,18 +82,16 @@
"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 : " ")
- )
+ 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")
@@ -104,7 +103,7 @@
notify = confirmation.components["notify"]!.active;
createAppealTicket = confirmation.components["appeal"]!.active;
}
- if (confirmation.modals) newNickname = confirmation.modals![0]!.value
+ if (confirmation.modals) newNickname = confirmation.modals![0]!.value;
} while (!timedOut && !success);
if (timedOut || !success) return;
let dmSent = false;
@@ -121,12 +120,8 @@
.setEmoji("PUNISH.NICKNAME.RED")
.setTitle("Nickname changed")
.setDescription(
- `Your nickname was ${
- newNickname ? "changed" : "cleared"
- } in ${interaction.guild!.name}.` +
- (newNickname
- ? `\nIt is now: ${newNickname}`
- : "") +
+ `Your nickname was ${newNickname ? "changed" : "cleared"} in ${interaction.guild!.name}.` +
+ (newNickname ? `\nIt is now: ${newNickname}` : "") +
"\n\n" +
(createAppealTicket
? `You can appeal this in the ticket created in <#${
@@ -145,12 +140,7 @@
new ButtonBuilder()
.setStyle(ButtonStyle.Link)
.setLabel(config.moderation.nick.text)
- .setURL(
- config.moderation.nick.link.replaceAll(
- "{id}",
- member.id
- )
- )
+ .setURL(config.moderation.nick.link.replaceAll("{id}", member.id))
)
);
}
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index ff69079..dadab04 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -101,8 +101,7 @@
let component;
try {
component = m.awaitMessageComponent({
- filter: (i) =>
- i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id,
+ filter: (i) => i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id,
time: 300000
});
} catch (e) {
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 8408303..232219b 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,4 +1,11 @@
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } 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,7 +21,10 @@
.setDescription("Warns a user")
.addUserOption((option) => option.setName("user").setDescription("The user to warn").setRequired(true));
-const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
+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;
@@ -41,8 +51,7 @@
"appeal",
"Create appeal ticket",
!(await areTicketsEnabled(interaction.guild.id)),
- async () =>
- await create(interaction.guild!, member!.user, interaction.user, reason),
+ async () => await create(interaction.guild!, member!.user, interaction.user, reason),
"An appeal ticket will be created",
null,
"CONTROL.TICKET",
@@ -110,12 +119,7 @@
new ButtonBuilder()
.setStyle(ButtonStyle.Link)
.setLabel(config.moderation.warn.text)
- .setURL(
- config.moderation.warn.link.replaceAll(
- "{id}",
- member.id
- )
- )
+ .setURL(config.moderation.warn.link.replaceAll("{id}", member.id))
)
);
}
@@ -135,10 +139,7 @@
timestamp: Date.now()
},
list: {
- user: entry(
- member.user.id,
- renderUser(member.user)
- ),
+ user: entry(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*"
},
@@ -151,13 +152,7 @@
guild: interaction.guild.id
}
};
- await client.database.history.create(
- "warn",
- interaction.guild.id,
- member.user,
- interaction.user,
- reason
- );
+ await client.database.history.create("warn", interaction.guild.id, member.user, interaction.user, reason);
log(data);
const failed = !dmSent && notify;
if (!failed) {
@@ -179,9 +174,7 @@
components: []
});
} else {
- const canSeeChannel = member
- .permissionsIn(interaction.channel as Discord.TextChannel)
- .has("ViewChannel");
+ const canSeeChannel = member.permissionsIn(interaction.channel as Discord.TextChannel).has("ViewChannel");
const m = (await interaction.editReply({
embeds: [
new EmojiEmbed()
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 1eceae2..294ee27 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -1,4 +1,18 @@
-import { ActionRowBuilder, AttachmentBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, ChannelType, CommandInteraction, ComponentType, Guild, ModalBuilder, ModalSubmitInteraction, TextInputBuilder, TextInputStyle } from "discord.js";
+import {
+ ActionRowBuilder,
+ AttachmentBuilder,
+ ButtonBuilder,
+ ButtonInteraction,
+ ButtonStyle,
+ ChannelType,
+ CommandInteraction,
+ ComponentType,
+ Guild,
+ ModalBuilder,
+ ModalSubmitInteraction,
+ TextInputBuilder,
+ TextInputStyle
+} from "discord.js";
import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -8,7 +22,7 @@
builder.setName("stats").setDescription("Gets the bot's stats");
const callback = async (interaction: CommandInteraction): Promise<void> => {
- const description = `**Servers:** ${client.guilds.cache.size}\n` + `**Ping:** \`${client.ws.ping * 2}ms\``
+ const description = `**Servers:** ${client.guilds.cache.size}\n` + `**Ping:** \`${client.ws.ping * 2}ms\``;
const m = await interaction.reply({
embeds: [
new EmojiEmbed()
@@ -28,30 +42,39 @@
.setDescription(description)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
- ], 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)
- )]
+ ],
+ 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()
.addComponents(
- new ActionRowBuilder<TextInputBuilder>()
- .addComponents(
- new TextInputBuilder()
- .setStyle(TextInputStyle.Short)
- .setLabel("Guild ID")
- .setCustomId("guildID")
- .setPlaceholder("Guild ID")
- .setMinLength(16)
- .setMaxLength(25)
- )
+ new ActionRowBuilder<TextInputBuilder>().addComponents(
+ new TextInputBuilder()
+ .setStyle(TextInputStyle.Short)
+ .setLabel("Guild ID")
+ .setCustomId("guildID")
+ .setPlaceholder("Guild ID")
+ .setMinLength(16)
+ .setMaxLength(25)
+ )
)
.setTitle("Admin Panel")
- .setCustomId("adminPanel")
+ .setCustomId("adminPanel");
let i1: ButtonInteraction;
- const channel = await client.channels.fetch(interaction.channelId)
- if(!channel || [ChannelType.GuildCategory, ChannelType.GroupDM, ChannelType.GuildStageVoice].includes(channel.type)) return;
+ const channel = await client.channels.fetch(interaction.channelId);
+ if (
+ !channel ||
+ [ChannelType.GuildCategory, ChannelType.GroupDM, ChannelType.GuildStageVoice].includes(channel.type)
+ )
+ return;
// console.log(interaction)
if (!("awaitMessageComponent" in channel)) return;
try {
@@ -59,27 +82,28 @@
filter: (i) => i.customId === "admin" && i.user.id === interaction.user.id,
time: 300000
});
- } catch (e) { console.log(e); return }
- await i1.showModal(modal)
+ } catch (e) {
+ console.log(e);
+ return;
+ }
+ await i1.showModal(modal);
let out: ModalSubmitInteraction;
try {
out = await i1.awaitModalSubmit({
filter: (i) => i.customId === "adminPanel" && i.user.id === interaction.user.id,
time: 300000
- })
- } catch { return }
+ });
+ } catch {
+ return;
+ }
out.deferUpdate();
const GuildID = out.fields.getTextInputValue("guildID");
if (!client.guilds.cache.has(GuildID)) {
await interaction.editReply({
- embeds: [
- new EmojiEmbed()
- .setTitle("Admin")
- .setDescription("Not in server")
- .setStatus("Danger")
- ], components: []
+ embeds: [new EmojiEmbed().setTitle("Admin").setDescription("Not in server").setStatus("Danger")],
+ components: []
});
- };
+ }
await interaction.editReply({
embeds: [],
@@ -91,24 +115,23 @@
new ButtonBuilder().setCustomId("purge").setLabel("Delete data").setStyle(ButtonStyle.Danger),
new ButtonBuilder().setCustomId("cache").setLabel("Reset cache").setStyle(ButtonStyle.Success)
)
- ]});
+ ]
+ });
let i;
try {
i = await m.awaitMessageComponent<ComponentType.Button>({
filter: (i) => i.user.id === interaction.user.id,
time: 300000
- })
- } catch { return }
+ });
+ } catch {
+ return;
+ }
i.deferUpdate();
- const guild = await client.guilds.fetch(GuildID) as Guild | null;
+ const guild = (await client.guilds.fetch(GuildID)) as Guild | null;
if (!guild) {
await interaction.editReply({
- embeds: [
- new EmojiEmbed()
- .setTitle("Admin")
- .setDescription("Not in server")
- .setStatus("Danger")
- ], components: []
+ embeds: [new EmojiEmbed().setTitle("Admin").setDescription("Not in server").setStatus("Danger")],
+ components: []
});
return;
}
@@ -119,17 +142,17 @@
.setTitle("Stats")
.setDescription(
`**Name:** ${guild.name}\n` +
- `**ID:** \`${guild.id}\`\n` +
- `**Owner:** ${client.users.cache.get(guild.ownerId)!.tag}\n` +
- `**Member Count:** ${guild.memberCount}\n` +
- `**Created:** <t:${guild.createdTimestamp}:F>\n` +
- `**Added Nucleus:** <t:${guild.members.me!.joinedTimestamp}:R>\n` +
- `**Nucleus' Perms:** https://discordapi.com/permissions.html#${guild.members.me!.permissions.valueOf()}\n`
+ `**ID:** \`${guild.id}\`\n` +
+ `**Owner:** ${client.users.cache.get(guild.ownerId)!.tag}\n` +
+ `**Member Count:** ${guild.memberCount}\n` +
+ `**Created:** <t:${guild.createdTimestamp}:F>\n` +
+ `**Added Nucleus:** <t:${guild.members.me!.joinedTimestamp}:R>\n` +
+ `**Nucleus' Perms:** https://discordapi.com/permissions.html#${guild.members.me!.permissions.valueOf()}\n`
)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
]
- })
+ });
} else if (i.customId === "leave") {
await guild.leave();
await interaction.editReply({
@@ -139,8 +162,9 @@
.setDescription(`Left ${guild.name}`)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
- ], components: []
- })
+ ],
+ components: []
+ });
} else if (i.customId === "data") {
// Get all the data and convert to a string
const data = await client.database.guilds.read(guild.id);
@@ -150,9 +174,10 @@
await interaction.editReply({
embeds: [
new EmojiEmbed().setTitle("Data").setDescription(`Data for ${guild.name}`).setStatus("Success")
- ], components: [],
+ ],
+ components: [],
files: [attachment]
- })
+ });
} else if (i.customId === "purge") {
await client.database.guilds.delete(GuildID);
await client.database.history.delete(GuildID);
@@ -165,8 +190,9 @@
.setDescription(`Deleted data for ${guild.name}`)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
- ], components: []
- })
+ ],
+ components: []
+ });
} else if (i.customId === "cache") {
await client.memory.forceUpdate(guild.id);
await interaction.editReply({
@@ -176,8 +202,9 @@
.setDescription(`Reset cache for ${guild.name}`)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
- ], components: []
- })
+ ],
+ components: []
+ });
}
}
};
diff --git a/src/commands/settings/rolemenu.ts b/src/commands/settings/rolemenu.ts
index 0c174f5..e683e4f 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -176,7 +176,7 @@
m: Message,
data?: ObjectSchema
): Promise<ObjectSchema | null> => {
- if (!data) data = _.cloneDeep(defaultRoleMenuData)
+ if (!data) data = _.cloneDeep(defaultRoleMenuData);
const buttons = new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
.setCustomId("back")