Still got errors and warnings, mostly the same and easy to fix
diff --git a/src/Unfinished/categorisationTest.ts b/src/Unfinished/categorisationTest.ts
index c75d1bb..4d0d50a 100644
--- a/src/Unfinished/categorisationTest.ts
+++ b/src/Unfinished/categorisationTest.ts
@@ -1,22 +1,22 @@
-import { LoadingEmbed } from '../utils/defaultEmbeds.js';
+import { LoadingEmbed } from "../utils/defaultEmbeds.js";
import { CommandInteraction, GuildChannel, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
-import client from "../utils/client.js"
+import client from "../utils/client.js";
import addPlural from "../utils/plurals.js";
import getEmojiByName from "../utils/getEmojiByName.js";
const command = new SlashCommandBuilder()
.setName("categorise")
- .setDescription("Categorises your servers channels")
+ .setDescription("Categorises your servers channels");
const callback = async (interaction: CommandInteraction): Promise<any> => {
- let channels = interaction.guild.channels.cache.filter(c => c.type !== "GUILD_CATEGORY");
- let categorised = {}
+ const channels = interaction.guild.channels.cache.filter(c => c.type !== "GUILD_CATEGORY");
+ const categorised = {};
await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
- let predicted = {}
- let types = {
+ const predicted = {};
+ const types = {
general: ["general", "muted", "main", "topic", "discuss"],
commands: ["bot", "command", "music"],
images: ["pic", "selfies", "image"],
@@ -26,25 +26,25 @@
staff: ["staff", "mod", "admin"],
spam: ["spam"],
other: ["random"]
- }
- for (let c of channels.values()) {
- for (let type in types) {
- for (let word of types[type]) {
+ };
+ for (const c of channels.values()) {
+ for (const type in types) {
+ for (const word of types[type]) {
if (c.name.toLowerCase().includes(word)) {
- predicted[c.id] = predicted[c.id] ?? []
- predicted[c.id].push(type)
+ predicted[c.id] = predicted[c.id] ?? [];
+ predicted[c.id].push(type);
}
}
}
}
let m;
- for (let c of channels) {
+ for (const c of channels) {
// convert channel to a channel if its a string
- let channel: any
- if (typeof c === "string") channel = interaction.guild.channels.cache.get(channel).id
- else channel = (c[0] as unknown as GuildChannel).id
- console.log(channel)
- if (!predicted[channel]) predicted[channel] = []
+ let channel: any;
+ if (typeof c === "string") channel = interaction.guild.channels.cache.get(channel).id;
+ else channel = (c[0] as unknown as GuildChannel).id;
+ console.log(channel);
+ if (!predicted[channel]) predicted[channel] = [];
m = await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Categorise")
.setDescription(`Select all types that apply to <#${channel}>.\n\n` +
@@ -65,7 +65,7 @@
new MessageButton().setLabel("Use \"Other\"").setCustomId("reject").setStyle("SECONDARY")
.setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.CROSS", "id")))
])
- ]})
+ ]});
let i;
try {
i = await m.awaitMessageComponent({ time: 300000 });
@@ -77,21 +77,21 @@
.setDescription(`Select all types that apply to <#${channel}>.\n\n` +
`${addPlural(predicted[channel].length, "Suggestion")}: ${predicted[channel].join(", ")}`)
.setFooter({text: "Message timed out"})
- ]})
+ ]});
}
- i.deferUpdate()
+ i.deferUpdate();
let selected;
if (i.customId === "select") { selected = i.values; }
if (i.customId === "accept") { selected = predicted[channel]; }
if (i.customId === "reject") { selected = ["other"]; }
- categorised[channel] = selected
+ categorised[channel] = selected;
}
- console.log(categorised)
-}
+ console.log(categorised);
+};
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
return true;
-}
+};
export { command };
export { callback };