Fix some more eslint errors (not yet complete)
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 3d1901b..31df394 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -2,14 +2,14 @@
import getEmojiByName from "../../utils/getEmojiByName.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton, MessageSelectMenu, TextInputComponent } from "discord.js";
+import Discord, { CommandInteraction, GuildChannel, Interaction, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, MessageSelectMenu, Role, SelectMenuInteraction, TextInputComponent } from "discord.js";
import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import { ChannelType } from "discord-api-types";
import client from "../../utils/client.js";
import { toHexInteger, toHexArray, tickets as ticketTypes } from "../../utils/calculate.js";
import { capitalize } from "../../utils/generateKeyValueList.js";
import { modalInteractionCollector } from "../../utils/dualCollector.js";
+import {GuildConfig} from "../../utils/database.js";
const command = (builder: SlashCommandSubcommandBuilder) => builder
.setName("tickets")
@@ -20,9 +20,8 @@
.addNumberOption(option => option.setName("maxticketsperuser").setDescription("The maximum amount of tickets a user can create | Default: 5").setRequired(false).setMinValue(1))
.addRoleOption(option => option.setName("supportrole").setDescription("This role will have view access to all tickets and will be pinged when a ticket is created").setRequired(false));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
- let m;
- m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
+ let m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
const options = {
enabled: interaction.options.getString("enabled") as string | boolean,
category: interaction.options.getChannel("category"),
@@ -33,9 +32,9 @@
if (options.enabled !== null || options.category || options.maxtickets || options.supportping) {
options.enabled = options.enabled === "yes" ? true : false;
if (options.category) {
- let channel;
+ let channel: GuildChannel;
try {
- channel = interaction.guild.channels.cache.get(options.category.id);
+ channel = await interaction.guild.channels.fetch(options.category.id);
} catch {
return await interaction.editReply({
embeds: [new EmojiEmbed()
@@ -66,10 +65,10 @@
]
});
}
- let role;
+ let role: Role;
if (options.supportping) {
try {
- role = interaction.guild.roles.cache.get(options.supportping.id);
+ role = await interaction.guild.roles.fetch(options.supportping.id);
} catch {
return await interaction.editReply({
embeds: [new EmojiEmbed()
@@ -136,9 +135,9 @@
}
}
let data = await client.database.guilds.read(interaction.guild.id);
- data.tickets.customTypes = (data.tickets.customTypes || []).filter((v, i, a) => a.indexOf(v) === i);
+ data.tickets.customTypes = (data.tickets.customTypes || []).filter((value: string, index: number, array: string[]) => array.indexOf(value) === index);
let lastClicked = "";
- let embed;
+ let embed: EmojiEmbed;
data = {
enabled: data.tickets.enabled,
category: data.tickets.category,
@@ -200,30 +199,30 @@
.setCustomId("send")
])]
});
- let i;
+ let i: MessageComponentInteraction;
try {
- i = await m.awaitMessageComponent({ time: 300000 });
+ i = await (m as Message).awaitMessageComponent({ time: 300000 });
} catch (e) { break; }
i.deferUpdate();
- if (i.component.customId === "clearCategory") {
+ if ((i.component as MessageActionRowComponent).customId === "clearCategory") {
if (lastClicked === "cat") {
lastClicked = "";
await client.database.guilds.write(interaction.guild.id, null, ["tickets.category"]);
data.category = undefined;
} else lastClicked = "cat";
- } else if (i.component.customId === "clearMaxTickets") {
+ } else if ((i.component as MessageActionRowComponent).customId === "clearMaxTickets") {
if (lastClicked === "max") {
lastClicked = "";
await client.database.guilds.write(interaction.guild.id, null, ["tickets.maxTickets"]);
data.maxTickets = 5;
} else lastClicked = "max";
- } else if (i.component.customId === "clearSupportPing") {
+ } else if ((i.component as MessageActionRowComponent).customId === "clearSupportPing") {
if (lastClicked === "sup") {
lastClicked = "";
await client.database.guilds.write(interaction.guild.id, null, ["tickets.supportRole"]);
data.supportRole = undefined;
} else lastClicked = "sup";
- } else if (i.component.customId === "send") {
+ } else if ((i.component as MessageActionRowComponent).customId === "send") {
const ticketMessages = [
{label: "Create ticket", description: "Click the button below to create a ticket"},
{label: "Issues, questions or feedback?", description: "Click below to open a ticket and get help from our staff team"},
@@ -260,15 +259,15 @@
.setStyle("PRIMARY")
])
]});
- let i;
+ let i: MessageComponentInteraction;
try {
- i = await m.awaitMessageComponent({time: 300000});
+ i = await (m as Message).awaitMessageComponent({time: 300000});
} catch(e) { break; }
- if (i.component.customId === "template") {
+ if ((i.component as MessageActionRowComponent).customId === "template") {
i.deferUpdate();
await interaction.channel.send({embeds: [new EmojiEmbed()
- .setTitle(ticketMessages[parseInt(i.values[0])].label)
- .setDescription(ticketMessages[parseInt(i.values[0])].description)
+ .setTitle(ticketMessages[parseInt((i as SelectMenuInteraction).values[0])].label)
+ .setDescription(ticketMessages[parseInt((i as SelectMenuInteraction).values[0])].description)
.setStatus("Success")
.setEmoji("GUILD.TICKET.OPEN")
], components: [new MessageActionRow().addComponents([new MessageButton()
@@ -278,7 +277,7 @@
.setCustomId("createticket")
])]});
break;
- } else if (i.component.customId === "blank") {
+ } else if ((i.component as MessageActionRowComponent).customId === "blank") {
i.deferUpdate();
await interaction.channel.send({components: [new MessageActionRow().addComponents([new MessageButton()
.setLabel("Create Ticket")
@@ -287,7 +286,7 @@
.setCustomId("createticket")
])]});
break;
- } else if (i.component.customId === "custom") {
+ } else if ((i.component as MessageActionRowComponent).customId === "custom") {
await i.showModal(new Discord.Modal().setCustomId("modal").setTitle("Enter embed details").addComponents(
new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
.setCustomId("title")
@@ -339,11 +338,11 @@
} else { continue; }
}
}
- } else if (i.component.customId === "enabled") {
+ } else if ((i.component as MessageActionRowComponent).customId === "enabled") {
await client.database.guilds.write(interaction.guild.id, { "tickets.enabled": !data.enabled });
data.enabled = !data.enabled;
- } else if (i.component.customId === "manageTypes") {
- data = await manageTypes(interaction, data, m);
+ } else if ((i.component as MessageActionRowComponent).customId === "manageTypes") {
+ data = await manageTypes(interaction, data, m as Message);
} else {
break;
}
@@ -351,7 +350,7 @@
await interaction.editReply({ embeds: [embed.setFooter({ text: "Message closed" })], components: [] });
};
-async function manageTypes(interaction, data, m) {
+async function manageTypes(interaction: Interaction, data: GuildConfig["tickets"], m: Message) {
while (true) {
if (data.useCustom) {
const customTypes = data.customTypes;
@@ -519,7 +518,7 @@
}
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as Discord.GuildMember);
if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command";
return true;
@@ -527,4 +526,4 @@
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index c100d05..d846511 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -1,10 +1,9 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, Emoji, MessageActionRow, MessageButton, MessageSelectMenu, TextInputComponent } from "discord.js";
+import Discord, { CommandInteraction, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, MessageSelectMenu, Role, SelectMenuInteraction, TextInputComponent } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
-import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
+import { Embed, SlashCommandSubcommandBuilder } from "@discordjs/builders";
import client from "../../utils/client.js";
import { modalInteractionCollector } from "../../utils/dualCollector.js";
@@ -14,13 +13,12 @@
.setDescription("Manage the role given after typing /verify")
.addRoleOption(option => option.setName("role").setDescription("The role to give after verifying").setRequired(false));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
- let m;
- m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
+ const m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
if (interaction.options.getRole("role")) {
- let role;
+ let role: Role;
try {
- role = interaction.options.getRole("role");
+ role = interaction.options.getRole("role") as Role;
} catch {
return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("GUILD.ROLES.DELETE")
@@ -109,19 +107,19 @@
.setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
.setStyle("PRIMARY")
])]});
- let i;
+ let i: MessageComponentInteraction;
try {
- i = await m.awaitMessageComponent({time: 300000});
+ i = await (m as Message).awaitMessageComponent({time: 300000});
} catch(e) { break; }
i.deferUpdate();
- if (i.component.customId === "clear") {
+ if ((i.component as MessageActionRowComponent).customId === "clear") {
clicks += 1;
if (clicks === 2) {
clicks = 0;
await client.database.guilds.write(interaction.guild.id, null, ["verify.role", "verify.enabled"]);
role = undefined;
}
- } else if (i.component.customId === "send") {
+ } else if ((i.component as MessageActionRowComponent).customId === "send") {
const verifyMessages = [
{label: "Verify", description: "Click the button below to get verified"},
{label: "Get verified", description: "To get access to the rest of the server, click the button below"},
@@ -157,15 +155,15 @@
.setStyle("PRIMARY")
])
]});
- let i;
+ let i: MessageComponentInteraction;
try {
- i = await m.awaitMessageComponent({time: 300000});
+ i = await (m as Message).awaitMessageComponent({time: 300000});
} catch(e) { break; }
- if (i.component.customId === "template") {
+ if ((i.component as MessageActionRowComponent).customId === "template") {
i.deferUpdate();
await interaction.channel.send({embeds: [new EmojiEmbed()
- .setTitle(verifyMessages[parseInt(i.values[0])].label)
- .setDescription(verifyMessages[parseInt(i.values[0])].description)
+ .setTitle(verifyMessages[parseInt((i as SelectMenuInteraction).values[0])].label)
+ .setDescription(verifyMessages[parseInt((i as SelectMenuInteraction).values[0])].description)
.setStatus("Success")
.setEmoji("CONTROL.BLOCKTICK")
], components: [new MessageActionRow().addComponents([new MessageButton()
@@ -175,7 +173,7 @@
.setCustomId("verifybutton")
])]});
break;
- } else if (i.component.customId === "blank") {
+ } else if ((i.component as MessageActionRowComponent).customId === "blank") {
i.deferUpdate();
await interaction.channel.send({components: [new MessageActionRow().addComponents([new MessageButton()
.setLabel("Verify")
@@ -184,7 +182,7 @@
.setCustomId("verifybutton")
])]});
break;
- } else if (i.component.customId === "custom") {
+ } else if ((i.component as MessageActionRowComponent).customId === "custom") {
await i.showModal(new Discord.Modal().setCustomId("modal").setTitle("Enter embed details").addComponents(
new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
.setCustomId("title")
@@ -241,10 +239,10 @@
break;
}
}
- await interaction.editReply({embeds: [m.embeds[0].setFooter({text: "Message closed"})], components: []});
+ await interaction.editReply({embeds: [(m.embeds[0] as Embed).setFooter({text: "Message closed"})], components: []});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as Discord.GuildMember);
if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command";
return true;
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index 34ac292..f22f409 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -1,7 +1,6 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
+import Discord, { Channel, CommandInteraction, Message, MessageActionRow, MessageButton, MessageComponentInteraction, Role } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -20,17 +19,17 @@
ChannelType.GuildText, ChannelType.GuildNews
]));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderRole, renderChannel, log, NucleusColors, entry, renderUser } = client.logger;
await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
- let m;
+ let m: Message;
if (interaction.options.getRole("role") || interaction.options.getChannel("channel") || interaction.options.getString("message")) {
- let role;
- let ping;
+ let role: Role;
+ let ping: Role;
const message = interaction.options.getString("message");
try {
- role = interaction.options.getRole("role");
- ping = interaction.options.getRole("ping");
+ role = interaction.options.getRole("role") as Role;
+ ping = interaction.options.getRole("ping") as Role;
} catch {
return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("GUILD.ROLES.DELETE")
@@ -39,9 +38,9 @@
.setStatus("Danger")
]});
}
- let channel;
+ let channel: Channel;
try {
- channel = interaction.options.getChannel("channel");
+ channel = interaction.options.getChannel("channel") as Channel;
} catch {
return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("GUILD.ROLES.DELETE")
@@ -160,8 +159,8 @@
.setDisabled(config.welcome.channel == "dm")
.setStyle("SECONDARY")
])
- ]});
- let i;
+ ]}) as Message;
+ let i: MessageComponentInteraction;
try {
i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) {
@@ -196,7 +195,7 @@
await interaction.editReply({embeds: [m.embeds[0].setFooter({text: "Message closed"})], components: []});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as Discord.GuildMember);
if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command";
return true;
@@ -204,4 +203,4 @@
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index 4cae8e3..adaf2cc 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -1,6 +1,5 @@
import { AutocompleteInteraction, CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import client from "../utils/client.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -9,7 +8,7 @@
.setDescription("Get and manage the servers tags")
.addStringOption(o => o.setName("tag").setDescription("The tag to get").setAutocomplete(true).setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
const config = await client.database.guilds.read(interaction.guild.id);
const tags = config.getKey("tags");
const tag = tags[interaction.options.getString("tag")];
@@ -41,7 +40,7 @@
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
diff --git a/src/commands/tags/create.ts b/src/commands/tags/create.ts
index d2f15e1..4aaa49d 100644
--- a/src/commands/tags/create.ts
+++ b/src/commands/tags/create.ts
@@ -1,6 +1,5 @@
import Discord, { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -13,7 +12,7 @@
.addStringOption(o => o.setName("name").setRequired(true).setDescription("The name of the tag"))
.addStringOption(o => o.setName("value").setRequired(true).setDescription("The value of the tag, shown after running /tag name"));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const name = interaction.options.getString("name");
const value = interaction.options.getString("value");
if (name.length > 100) return await interaction.reply({embeds: [new EmojiEmbed()
@@ -77,7 +76,7 @@
], components: []});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as Discord.GuildMember);
if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command";
return true;
@@ -85,4 +84,4 @@
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/tags/delete.ts b/src/commands/tags/delete.ts
index 5a6d3d4..3509dcc 100644
--- a/src/commands/tags/delete.ts
+++ b/src/commands/tags/delete.ts
@@ -1,6 +1,5 @@
import Discord, { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -12,7 +11,7 @@
.setDescription("Deletes a tag")
.addStringOption(o => o.setName("name").setRequired(true).setDescription("The name of the tag"));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const name = interaction.options.getString("name");
const data = await client.database.guilds.read(interaction.guild.id);
if (!data.tags[name]) return await interaction.reply({embeds: [new EmojiEmbed()
@@ -58,7 +57,7 @@
], components: []});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as Discord.GuildMember);
if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command";
return true;
@@ -66,4 +65,4 @@
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index f3698fc..d7cfd04 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -1,6 +1,5 @@
import Discord, { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -14,7 +13,7 @@
.addStringOption(o => o.setName("value").setRequired(false).setDescription("The new value of the tag / Rename"))
.addStringOption(o => o.setName("newname").setRequired(false).setDescription("The new name of the tag / Edit"));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const name = interaction.options.getString("name");
const value = interaction.options.getString("value") || "";
const newname = interaction.options.getString("newname") || "";
@@ -92,7 +91,7 @@
], components: []});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as Discord.GuildMember);
if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command";
return true;
@@ -100,4 +99,4 @@
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/tags/list.ts b/src/commands/tags/list.ts
index 7f3637f..accdd94 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -1,7 +1,6 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, SelectMenuInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
import { SelectMenuOption } from "@discordjs/builders";
@@ -25,7 +24,7 @@
.setName("list")
.setDescription("Lists all tags in the server");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
const data = await client.database.guilds.read(interaction.guild.id);
const tags = data.getKey("tags");
let strings = [];
@@ -53,8 +52,7 @@
.setStatus("Success")
).setTitle(`Page ${pages.length + 1}`).setPageId(pages.length));
}
- let m;
- m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+ const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
let page = 0;
let selectPaneOpen = false;
while (true) {
@@ -88,21 +86,21 @@
new MessageButton().setCustomId("close").setEmoji(getEmojiByName("CONTROL.CROSS", "id")).setStyle("DANGER")
])])
});
- let i;
+ let i: MessageComponentInteraction;
try {
- i = await m.awaitMessageComponent({time: 300000 });
+ i = await (m as Message).awaitMessageComponent({time: 300000 });
} catch (e) { break; }
i.deferUpdate();
- if (i.component.customId === "left") {
+ if ((i.component as MessageActionRowComponent).customId === "left") {
if (page > 0) page--;
selectPaneOpen = false;
- } else if (i.component.customId === "right") {
+ } else if ((i.component as MessageActionRowComponent).customId === "right") {
if (page < pages.length - 1) page++;
selectPaneOpen = false;
- } else if (i.component.customId === "select") {
+ } else if ((i.component as MessageActionRowComponent).customId === "select") {
selectPaneOpen = !selectPaneOpen;
- } else if (i.component.customId === "page") {
- page = parseInt(i.values[0]);
+ } else if ((i.component as MessageActionRowComponent).customId === "page") {
+ page = parseInt((i as SelectMenuInteraction).values[0]);
selectPaneOpen = false;
} else {
const em = new Discord.MessageEmbed(pages[page].embed);
@@ -131,10 +129,10 @@
});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/ticket/close.ts b/src/commands/ticket/close.ts
index b3e5351..ed27abc 100644
--- a/src/commands/ticket/close.ts
+++ b/src/commands/ticket/close.ts
@@ -1,6 +1,5 @@
import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import close from "../../actions/tickets/delete.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -8,14 +7,14 @@
.setName("close")
.setDescription("Closes a ticket");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
await close(interaction);
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/ticket/create.ts b/src/commands/ticket/create.ts
index 25de336..55962d7 100644
--- a/src/commands/ticket/create.ts
+++ b/src/commands/ticket/create.ts
@@ -1,6 +1,5 @@
import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import create from "../../actions/tickets/create.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -9,14 +8,14 @@
.setDescription("Creates a new modmail ticket")
.addStringOption(option => option.setName("message").setDescription("The content of the ticket").setRequired(false));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
await create(interaction);
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 59ba2e6..4835cd1 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -1,7 +1,6 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, SelectMenuInteraction } from "discord.js";
import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import generateKeyValueList from "../../utils/generateKeyValueList.js";
@@ -27,7 +26,7 @@
}
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
const { renderUser, renderDelta } = client.logger;
const member = (interaction.options.getMember("user") || interaction.member) as Discord.GuildMember;
const flags: string[] = [];
@@ -37,7 +36,7 @@
"261900651230003201", // Coded
"511655498676699136" // Zan
].includes(member.user.id)) { flags.push("NUCLEUSDEVELOPER"); }
- if ((await client.guilds.cache.get("684492926528651336")?.members.fetch())?.filter(m => m.roles.cache.has("760896837866749972"))?.map(m => m.id).includes(member.user.id)) { flags.push("CLICKSDEVELOPER"); }
+ if ((await client.guilds.cache.get("684492926528651336")?.members.fetch())?.filter((m: GuildMember) => m.roles.cache.has("760896837866749972"))?.map((m: GuildMember) => m.id).includes(member.user.id)) { flags.push("CLICKSDEVELOPER"); }
member.user.flags.toArray().map(flag => {
flags.push(flag.toString());
});
@@ -126,7 +125,7 @@
"join position": `${joinPos + 1}`
})
)
- .setThumbnail(await member.user.displayAvatarURL({dynamic: true}))
+ .setThumbnail(member.user.displayAvatarURL({dynamic: true}))
.setImage((await member.user.fetch()).bannerURL({format: "gif"}))
).setTitle("General").setDescription("General information about the user").setPageId(0),
new Embed()
@@ -142,7 +141,7 @@
}) + "\n" +
(s.length > 0 ? s : "*None*") + "\n"
)
- .setThumbnail(await member.user.displayAvatarURL({dynamic: true}))
+ .setThumbnail(member.user.displayAvatarURL({dynamic: true}))
).setTitle("Roles").setDescription("Roles the user has").setPageId(1),
new Embed()
.setEmbed(new EmojiEmbed()
@@ -155,11 +154,10 @@
"id": `\`${member.id}\``
}) + "\n" + perms
)
- .setThumbnail(await member.user.displayAvatarURL({dynamic: true}))
+ .setThumbnail(member.user.displayAvatarURL({dynamic: true}))
).setTitle("Key Permissions").setDescription("Key permissions the user has").setPageId(2)
];
- let m;
- m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+ const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
let page = 0;
let breakReason = "";
while (true) {
@@ -208,24 +206,24 @@
.setStyle("DANGER")
])])
});
- let i;
+ let i: MessageComponentInteraction;
try {
- i = await m.awaitMessageComponent({time: 300000});
+ i = await (m as Message).awaitMessageComponent({time: 300000});
} catch { breakReason = "Message timed out"; break; }
i.deferUpdate();
- if (i.component.customId === "left") {
+ if ((i.component as MessageActionRowComponent).customId === "left") {
if (page > 0) page--;
selectPaneOpen = false;
- } else if (i.component.customId === "right") {
+ } else if ((i.component as MessageActionRowComponent).customId === "right") {
if (page < embeds.length - 1) page++;
selectPaneOpen = false;
- } else if (i.component.customId === "select") {
+ } else if ((i.component as MessageActionRowComponent).customId === "select") {
selectPaneOpen = !selectPaneOpen;
- } else if (i.component.customId === "close") {
+ } else if ((i.component as MessageActionRowComponent).customId === "close") {
breakReason = "Message closed";
break;
- } else if (i.component.customId === "page") {
- page = parseInt(i.values[0]);
+ } else if ((i.component as MessageActionRowComponent).customId === "page") {
+ page = parseInt((i as SelectMenuInteraction).values[0]);
selectPaneOpen = false;
} else {
breakReason = "Message closed";
@@ -258,10 +256,10 @@
])]});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };