Fix a bunch of linter errors
diff --git a/src/Unfinished/categorisationTest.ts b/src/Unfinished/categorisationTest.ts
index 4ba582d..e4346d6 100644
--- a/src/Unfinished/categorisationTest.ts
+++ b/src/Unfinished/categorisationTest.ts
@@ -1,5 +1,11 @@
import { LoadingEmbed } from "../utils/defaultEmbeds.js";
-import { CommandInteraction, GuildChannel, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.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";
@@ -11,10 +17,14 @@
.setName("categorise")
.setDescription("Categorises your servers channels");
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
- const channels = interaction.guild.channels.cache.filter(c => c.type !== "GUILD_CATEGORY");
+const callback = async (
+ interaction: CommandInteraction
+): Promise<void | unknown> => {
+ const channels = interaction.guild.channels.cache.filter(
+ (c) => c.type !== "GUILD_CATEGORY"
+ );
const categorised = {};
- await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
+ await interaction.reply({ embeds: LoadingEmbed, ephemeral: true });
const predicted = {};
const types = {
general: ["general", "muted", "main", "topic", "discuss"],
@@ -41,58 +51,110 @@
for (const c of channels) {
// convert channel to a channel if its a string
let channel: string | GuildChannel;
- if (typeof c === "string") channel = interaction.guild.channels.cache.get(channel as string).id;
+ if (typeof c === "string")
+ channel = interaction.guild.channels.cache.get(
+ channel as string
+ ).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` +
- `${addPlural(predicted[channel].length, "Suggestion")}: ${predicted[channel].join(", ")}`)
- .setEmoji("CHANNEL.CATEGORY.CREATE")
- .setStatus("Success")
- ], components: [
- new MessageActionRow().addComponents([new MessageSelectMenu()
- .setCustomId("selected")
- .setMaxValues(Object.keys(types).length)
- .setMinValues(1)
- .setPlaceholder("Select all types that apply to this channel")
- .setOptions(Object.keys(types).map(type => ({label: type, value: type})))
- ]),
- new MessageActionRow().addComponents([
- new MessageButton().setLabel("Accept Suggestion").setCustomId("accept").setStyle("SUCCESS").setDisabled(predicted[channel].length === 0)
- .setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.TICK", "id"))),
- new MessageButton().setLabel("Use \"Other\"").setCustomId("reject").setStyle("SECONDARY")
- .setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.CROSS", "id")))
- ])
- ]});
+ m = await interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
+ .setTitle("Categorise")
+ .setDescription(
+ `Select all types that apply to <#${channel}>.\n\n` +
+ `${addPlural(
+ predicted[channel].length,
+ "Suggestion"
+ )}: ${predicted[channel].join(", ")}`
+ )
+ .setEmoji("CHANNEL.CATEGORY.CREATE")
+ .setStatus("Success")
+ ],
+ components: [
+ new MessageActionRow().addComponents([
+ new MessageSelectMenu()
+ .setCustomId("selected")
+ .setMaxValues(Object.keys(types).length)
+ .setMinValues(1)
+ .setPlaceholder(
+ "Select all types that apply to this channel"
+ )
+ .setOptions(
+ Object.keys(types).map((type) => ({
+ label: type,
+ value: type
+ }))
+ )
+ ]),
+ new MessageActionRow().addComponents([
+ new MessageButton()
+ .setLabel("Accept Suggestion")
+ .setCustomId("accept")
+ .setStyle("SUCCESS")
+ .setDisabled(predicted[channel].length === 0)
+ .setEmoji(
+ client.emojis.cache.get(
+ getEmojiByName("ICONS.TICK", "id")
+ )
+ ),
+ 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 });
} catch (e) {
- return await interaction.editReply({embeds: [new EmojiEmbed()
- .setTitle("Categorise")
- .setEmoji("CHANNEL.CATEGORY.DELETE")
- .setStatus("Danger")
- .setDescription(`Select all types that apply to <#${channel}>.\n\n` +
- `${addPlural(predicted[channel].length, "Suggestion")}: ${predicted[channel].join(", ")}`)
- .setFooter({text: "Message timed out"})
- ]});
+ return await interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
+ .setTitle("Categorise")
+ .setEmoji("CHANNEL.CATEGORY.DELETE")
+ .setStatus("Danger")
+ .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();
let selected;
- if (i.customId === "select") { selected = i.values; }
- if (i.customId === "accept") { selected = predicted[channel]; }
- if (i.customId === "reject") { selected = ["other"]; }
+ if (i.customId === "select") {
+ selected = i.values;
+ }
+ if (i.customId === "accept") {
+ selected = predicted[channel];
+ }
+ if (i.customId === "reject") {
+ selected = ["other"];
+ }
categorised[channel] = selected;
}
console.log(categorised);
};
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+ _interaction: CommandInteraction,
+ _defaultCheck: WrappedCheck
+) => {
return true;
};
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };