prettiered
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index c2bf9a1..9690258 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -21,7 +21,6 @@
const command = (builder: SlashCommandSubcommandBuilder) =>
builder.setName("stats").setDescription("Gets the bot's stats");
-
const confirm = async (interaction: CommandInteraction) => {
const requiredTexts = [
"just do it",
@@ -36,23 +35,23 @@
"what's a java script",
"it's a feature not a bug",
"that never happened during testing"
- ]
+ ];
const chosen = requiredTexts[Math.floor(Math.random() * (requiredTexts.length - 1))]!;
const modal = new ModalBuilder()
- .addComponents(
- new ActionRowBuilder<TextInputBuilder>().addComponents(
- new TextInputBuilder()
- .setStyle(TextInputStyle.Short)
- .setLabel(`Type "${chosen}" below`)
- .setCustomId("confirm")
- .setPlaceholder("Guild ID")
- .setMinLength(chosen.length)
- .setMaxLength(chosen.length)
- )
+ .addComponents(
+ new ActionRowBuilder<TextInputBuilder>().addComponents(
+ new TextInputBuilder()
+ .setStyle(TextInputStyle.Short)
+ .setLabel(`Type "${chosen}" below`)
+ .setCustomId("confirm")
+ .setPlaceholder("Guild ID")
+ .setMinLength(chosen.length)
+ .setMaxLength(chosen.length)
)
- .setTitle("Admin Panel")
- .setCustomId("adminPanel");
+ )
+ .setTitle("Admin Panel")
+ .setCustomId("adminPanel");
await interaction.showModal(modal);
let out: ModalSubmitInteraction;
try {
@@ -65,9 +64,8 @@
}
await out.deferUpdate();
const typed = out.fields.getTextInputValue("confirm");
- return typed.toLowerCase() === chosen.toLowerCase()
-}
-
+ return typed.toLowerCase() === chosen.toLowerCase();
+};
const callback = async (interaction: CommandInteraction): Promise<void> => {
const description = `**Servers:** ${client.guilds.cache.size}\n` + `**Ping:** \`${client.ws.ping * 2}ms\``;
@@ -159,7 +157,7 @@
new ButtonBuilder().setCustomId("data").setLabel("Guild data").setStyle(ButtonStyle.Secondary),
new ButtonBuilder().setCustomId("cache").setLabel("Reset cache").setStyle(ButtonStyle.Success),
new ButtonBuilder().setCustomId("leave").setLabel("Leave").setStyle(ButtonStyle.Danger),
- new ButtonBuilder().setCustomId("purge").setLabel("Delete data").setStyle(ButtonStyle.Danger),
+ new ButtonBuilder().setCustomId("purge").setLabel("Delete data").setStyle(ButtonStyle.Danger)
)
]
});
@@ -186,87 +184,79 @@
await interaction.editReply({
embeds: [
new EmojiEmbed()
- .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`
+ .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`
)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
- ]
- });
- } else if (i.customId === "leave") {
- if (!await confirm(interaction)) {
- await interaction.editReply({
- embeds: [
- new EmojiEmbed()
- .setTitle("No changes were made")
- .setStatus("Danger")
- ],
- components: []
- });
- return;
- }
- await guild.leave();
+ ]
+ });
+ } else if (i.customId === "leave") {
+ if (!(await confirm(interaction))) {
await interaction.editReply({
- embeds: [
- new EmojiEmbed()
+ embeds: [new EmojiEmbed().setTitle("No changes were made").setStatus("Danger")],
+ components: []
+ });
+ return;
+ }
+ await guild.leave();
+ await interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
.setTitle("Left")
.setDescription(`Left ${guild.name}`)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
- ],
+ ],
+ components: []
+ });
+ } else if (i.customId === "data") {
+ await i.deferUpdate();
+ // Get all the data and convert to a string
+ const data = await client.database.guilds.read(guild.id);
+ const stringified = JSON.stringify(data, null, 2);
+ const buffer = Buffer.from(stringified);
+ const attachment = new AttachmentBuilder(buffer).setName("data.json");
+ await interaction.editReply({
+ embeds: [
+ new EmojiEmbed().setTitle("Data").setDescription(`Data for ${guild.name}`).setStatus("Success")
+ ],
+ components: [],
+ files: [attachment]
+ });
+ } else if (i.customId === "purge") {
+ if (!(await confirm(interaction))) {
+ await interaction.editReply({
+ embeds: [new EmojiEmbed().setTitle("No changes were made").setStatus("Danger")],
components: []
});
- } else if (i.customId === "data") {
- await i.deferUpdate();
- // Get all the data and convert to a string
- const data = await client.database.guilds.read(guild.id);
- const stringified = JSON.stringify(data, null, 2);
- const buffer = Buffer.from(stringified);
- const attachment = new AttachmentBuilder(buffer).setName("data.json");
- await interaction.editReply({
- embeds: [
- new EmojiEmbed().setTitle("Data").setDescription(`Data for ${guild.name}`).setStatus("Success")
- ],
- components: [],
- files: [attachment]
- });
- } else if (i.customId === "purge") {
- if (!await confirm(interaction)) {
- await interaction.editReply({
- embeds: [
- new EmojiEmbed()
- .setTitle("No changes were made")
- .setStatus("Danger")
- ],
- components: []
- });
- return;
- }
- await client.database.guilds.delete(GuildID);
- await client.database.history.delete(GuildID);
- await client.database.notes.delete(GuildID);
- await client.database.transcripts.deleteAll(GuildID);
- await interaction.editReply({
- embeds: [
- new EmojiEmbed()
+ return;
+ }
+ await client.database.guilds.delete(GuildID);
+ await client.database.history.delete(GuildID);
+ await client.database.notes.delete(GuildID);
+ await client.database.transcripts.deleteAll(GuildID);
+ await interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
.setTitle("Purge")
.setDescription(`Deleted data for ${guild.name}`)
.setStatus("Success")
.setEmoji("SETTINGS.STATS.GREEN")
- ],
- components: []
- });
- } else if (i.customId === "cache") {
- await i.deferUpdate();
- await client.memory.forceUpdate(guild.id);
- await interaction.editReply({
+ ],
+ components: []
+ });
+ } else if (i.customId === "cache") {
+ await i.deferUpdate();
+ await client.memory.forceUpdate(guild.id);
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Cache")