eslint problems fixed, now theres only 850 ts ones to go
diff --git a/package.json b/package.json
index a26b083..872b186 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,8 @@
{
"dependencies": {
"@discordjs/builders": "^0.12.0",
+ "@hokify/agenda": "^6.2.12",
+ "@tsconfig/node18-strictest-esm": "^1.0.0",
"@ungap/structured-clone": "^1.0.1",
"agenda": "^4.3.0",
"body-parser": "^1.20.0",
@@ -9,6 +11,7 @@
"express": "^4.18.1",
"fuse.js": "^6.6.2",
"humanize-duration": "^3.27.1",
+ "immutable": "^4.1.0",
"jshaiku": "file:../haiku",
"mongodb": "^4.7.0",
"node-tesseract-ocr": "^2.2.1",
@@ -45,7 +48,6 @@
"private": false,
"type": "module",
"devDependencies": {
- "@tsconfig/node16-strictest-esm": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0"
}
diff --git a/src/Unfinished/all.ts b/src/Unfinished/all.ts
index db43527..51be5cb 100644
--- a/src/Unfinished/all.ts
+++ b/src/Unfinished/all.ts
@@ -39,18 +39,18 @@
},
joined: {
render: "joined",
- before: (date) => ( new Filter((data) => `Joined server before <t:${Math.round(date.getTime() / 1000)}:D>`, {date: date, type: Date, render: "before"}, (member) => {
+ before: (date) => ( new Filter((_data) => `Joined server before <t:${Math.round(date.getTime() / 1000)}:D>`, {date: date, type: Date, render: "before"}, (member) => {
return member.joinedTimestamp < date.getTime();
}))
},
nickname: {
render: "Nickname",
- set: () => ( new Filter((data) => "Member has a nickname set\"", {render: "set"}, (member) => { return member.nickname !== null;})),
- includes: (name) => ( new Filter((data) => `Nickname includes "${name}"`, {nickname: name, type: String, render: "includes"}, (member) => {
+ set: () => ( new Filter((_data) => "Member has a nickname set\"", {render: "set"}, (member) => { return member.nickname !== null;})),
+ includes: (name) => ( new Filter((_data) => `Nickname includes "${name}"`, {nickname: name, type: String, render: "includes"}, (member) => {
return member.displayName.includes(name);})),
- startsWith: (name) => ( new Filter((data) => `Nickname starts with "${name}"`, {nickname: name, type: String, render: "starts with"}, (member) => {
+ startsWith: (name) => ( new Filter((_data) => `Nickname starts with "${name}"`, {nickname: name, type: String, render: "starts with"}, (member) => {
return member.displayName.startsWith(name);})),
- endsWith: (name) => ( new Filter((data) => `Nickname ends with "${name}"`, {nickname: name, type: String, render: "ends with"}, (member) => {
+ endsWith: (name) => ( new Filter((_data) => `Nickname ends with "${name}"`, {nickname: name, type: String, render: "ends with"}, (member) => {
return member.displayName.endsWith(name);}))
}
},
@@ -58,27 +58,27 @@
render: "Account",
created: {
render: "created",
- before: (date) => ( new Filter((data) => `Account created before <t:${Math.round(date.getTime() / 1000)}:D>`, {date: date, type: Date, render: "before"}, (member) => {
+ before: (date) => ( new Filter((_data) => `Account created before <t:${Math.round(date.getTime() / 1000)}:D>`, {date: date, type: Date, render: "before"}, (member) => {
return member.user.createdTimestamp < date.getTime();
}))
},
is: {
render: "is",
- human: () => ( new Filter((data) => "Member is a human", {human: true, render: "human"}, (member) => { return !member.bot; }))
+ human: () => ( new Filter((_data) => "Member is a human", {human: true, render: "human"}, (member) => { return !member.bot; }))
},
username: {
render: "Username",
- includes: (name) => ( new Filter((data) => `Nickname includes "${name}"`, {nickname: name, type: String, render: "includes"}, (member) => {
+ includes: (name) => ( new Filter((_data) => `Nickname includes "${name}"`, {nickname: name, type: String, render: "includes"}, (member) => {
return member.user.name.includes(name);})),
- startsWith: (name) => ( new Filter((data) => `Nickname starts with "${name}"`, {nickname: name, type: String, render: "starts with"}, (member) => {
+ startsWith: (name) => ( new Filter((_data) => `Nickname starts with "${name}"`, {nickname: name, type: String, render: "starts with"}, (member) => {
return member.user.name.startsWith(name);})),
- endsWith: (name) => ( new Filter((data) => `Nickname ends with "${name}"`, {nickname: name, type: String, render: "ends with"}, (member) => {
+ endsWith: (name) => ( new Filter((_data) => `Nickname ends with "${name}"`, {nickname: name, type: String, render: "ends with"}, (member) => {
return member.user.name.endsWith(name);}))
}
}
};
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
const filters: Filter[] = [
filterList.member.has.role("959901346000154674"),
@@ -135,9 +135,10 @@
]});
break;
}
+ return;
};
-const check = async (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = async (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the *Manage Roles* permission";
diff --git a/src/Unfinished/categorisationTest.ts b/src/Unfinished/categorisationTest.ts
index 4d0d50a..4ba582d 100644
--- a/src/Unfinished/categorisationTest.ts
+++ b/src/Unfinished/categorisationTest.ts
@@ -11,7 +11,7 @@
.setName("categorise")
.setDescription("Categorises your servers channels");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+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});
@@ -40,8 +40,8 @@
let m;
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;
+ let channel: string | GuildChannel;
+ 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] = [];
@@ -89,7 +89,7 @@
console.log(categorised);
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index 6fd73ac..9a8e80a 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -1,4 +1,4 @@
-import { Message, MessageButton } from "discord.js";
+import { MessageButton } from "discord.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import { MessageActionRow, MessageSelectMenu } from "discord.js";
import getEmojiByName from "../utils/getEmojiByName.js";
@@ -73,7 +73,7 @@
});
}
let component;
- try { component = await (m as Message).awaitMessageComponent({time: 300000});
+ try { component = await m.awaitMessageComponent({time: 300000});
} catch (e) { return; }
component.deferUpdate();
let rolesToAdd = [];
@@ -113,7 +113,7 @@
});
let component;
try {
- component = await (m as Message).awaitMessageComponent({time: 300000});
+ component = await m.awaitMessageComponent({time: 300000});
} catch (e) {
return;
}
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index 6c8d42c..f724728 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -74,7 +74,7 @@
], ephemeral: true, fetchReply: true, components: splitFormattedTicketTypes});
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({time: 300000});
+ component = await m.awaitMessageComponent({time: 300000});
} catch (e) {
return;
}
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index 3419763..e5c017f 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -7,8 +7,9 @@
const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
const config = await client.database.guilds.read(interaction.guild.id);
- let thread = false; let threadChannel;
- if (interaction.channel instanceof Discord.ThreadChannel) thread = true; threadChannel = interaction.channel as Discord.ThreadChannel;
+ let thread = false;
+ if (interaction.channel instanceof Discord.ThreadChannel) thread = true;
+ const threadChannel = interaction.channel as Discord.ThreadChannel;
const channel = (interaction.channel as Discord.TextChannel);
if (!channel.parent || config.tickets.category !== channel.parent.id || (thread ? (threadChannel.parent.parent.id !== config.tickets.category) : false)) {
return interaction.reply({embeds: [new EmojiEmbed()
diff --git a/src/api/index.ts b/src/api/index.ts
index 1750509..b94bbe0 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -3,7 +3,6 @@
import bodyParser from "body-parser";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import structuredClone from "@ungap/structured-clone";
-import client from "../utils/client.js";
const jsonParser = bodyParser.json();
@@ -89,7 +88,6 @@
app.post("/rolemenu/:code", jsonParser, async function (req, res) {
const code = req.params.code;
const secret = req.body.secret;
- const data = req.body.data;
if (secret === client.config.verifySecret) {
const guild = await client.guilds.fetch(client.roleMenu[code].guild);
if (!guild) { return res.status(404); }
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 57db408..a55dcfa 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -1,6 +1,5 @@
import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -14,7 +13,7 @@
.addUserOption(option => option.setName("user").setDescription("The user to ban").setRequired(true))
.addNumberOption(option => option.setName("delete").setDescription("The days of messages to delete | Default: 0").setMinValue(0).setMaxValue(7).setRequired(false));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
const { renderUser } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -121,7 +120,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
const apply = (interaction.options.getMember("user") as GuildMember);
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index 482af5b..68b3ce7 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -1,7 +1,6 @@
import { HistorySchema } from "../../utils/database";
import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import client from "../../utils/client.js";
@@ -199,7 +198,7 @@
}
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
let m;
const member = (interaction.options.getMember("user")) as Discord.GuildMember;
await interaction.reply({embeds: [new EmojiEmbed()
@@ -273,7 +272,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
return true;
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index b9b1b2a..23785c3 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -1,7 +1,6 @@
import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import humanizeDuration from "humanize-duration";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -13,7 +12,7 @@
.setDescription("Kicks a user from the server")
.addUserOption(option => option.setName("user").setDescription("The user to kick").setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -120,7 +119,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
const apply = (interaction.options.getMember("user") as GuildMember);
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 183c487..1e9a812 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,7 +1,6 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -20,7 +19,7 @@
.addIntegerOption(option => option.setName("minutes").setDescription("The number of minutes to mute the user for | Default: 0").setMinValue(0).setMaxValue(59).setRequired(false))
.addIntegerOption(option => option.setName("seconds").setDescription("The number of seconds to mute the user for | Default: 0").setMinValue(0).setMaxValue(59).setRequired(false));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
const user = interaction.options.getMember("user") as GuildMember;
const time = {
@@ -85,10 +84,10 @@
.setStyle("DANGER")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
])
- ], ephemeral: true, fetchReply: true});
+ ], ephemeral: true, fetchReply: true}) as Message;
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
+ component = await m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch { return; }
component.deferUpdate();
if (component.customId === "cancel") return interaction.editReply({embeds: [new EmojiEmbed()
@@ -244,7 +243,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
const apply = (interaction.options.getMember("user") as GuildMember);
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 9cc8a7c..06fab47 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -1,10 +1,8 @@
-import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
+import { CommandInteraction, GuildMember } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
-import { create, areTicketsEnabled } from "../../actions/createModActionTicket.js";
import client from "../../utils/client.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -14,7 +12,7 @@
.addUserOption(option => option.setName("user").setDescription("The user to change").setRequired(true))
.addStringOption(option => option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser } = client.logger;
// TODO:[Modals] Replace this with a modal
let notify = true;
@@ -113,7 +111,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
const apply = (interaction.options.getMember("user") as GuildMember);
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index 13e688b..c554ee7 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -1,6 +1,5 @@
import Discord, { CommandInteraction, GuildChannel, GuildMember, TextChannel } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -20,7 +19,7 @@
.addUserOption(option => option.setName("user").setDescription("The user to purge messages from").setRequired(false))
.addStringOption(option => option.setName("reason").setDescription("The reason for the purge").setRequired(false));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const user = interaction.options.getMember("user") as GuildMember ?? null;
const channel = (interaction.channel as GuildChannel);
if (!(["GUILD_TEXT", "GUILD_NEWS", "GUILD_NEWS_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_PRIVATE_THREAD"].includes(channel.type.toString()))) {
@@ -97,10 +96,10 @@
.setEmoji(getEmojiByName("CONTROL.TICK", "id"))
])
]
- });
+ }) as Discord.Message;
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
+ component = m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch (e) { break; }
component.deferUpdate();
if (component.customId === "done") break;
@@ -174,10 +173,10 @@
.setLabel("Download transcript")
.setStyle("SUCCESS")
.setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
- ])]});
+ ])]}) as Discord.Message;
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
+ component = await m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch { return; }
if (component && component.customId === "download") {
interaction.editReply({embeds: [new EmojiEmbed()
@@ -273,10 +272,10 @@
.setLabel("Download transcript")
.setStyle("SUCCESS")
.setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
- ])]});
+ ])]}) as Discord.Message;
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
+ component = await m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch { return; }
if (component && component.customId === "download") {
interaction.editReply({embeds: [new EmojiEmbed()
@@ -304,7 +303,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
// Check if nucleus has the manage_messages permission
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 951dc53..7e8b8a2 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -1,7 +1,6 @@
import humanizeDuration from "humanize-duration";
import { CommandInteraction, GuildMember, TextChannel } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import keyValueList from "../../utils/generateKeyValueList.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -19,7 +18,7 @@
["1 hour", "3600"], ["2 hours", "7200"], ["6 hours", "21600"]
]));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
let time = parseInt(interaction.options.getString("time") ?? "0");
if (time === 0 && (interaction.channel as TextChannel).rateLimitPerUser === 0) { time = 10; }
const confirmation = await new confirmationMessage(interaction)
@@ -59,7 +58,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
// Check if Nucleus can set the slowmode
if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the *Manage Channels* permission";
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index 88ba531..d0dc9bb 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -1,6 +1,5 @@
import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -14,7 +13,7 @@
.addUserOption(option => option.setName("user").setDescription("The user to softban").setRequired(true))
.addIntegerOption(option => option.setName("delete").setDescription("The days of messages to delete | Default: 0").setMinValue(0).setMaxValue(7).setRequired(false));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -98,7 +97,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
const apply = (interaction.options.getMember("user") as GuildMember);
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index faf1f08..88301eb 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -1,6 +1,5 @@
import { CommandInteraction, GuildMember, User } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -12,7 +11,7 @@
.setDescription("Unbans a user")
.addStringOption(option => option.setName("user").setDescription("The user to unban (Username or ID)").setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const bans = await interaction.guild.bans.fetch();
const user = interaction.options.getString("user");
let resolved = bans.find(ban => ban.user.id === user);
@@ -88,7 +87,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
// Check if Nucleus can unban members
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index e00c16d..d4e0d75 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -1,6 +1,5 @@
import { CommandInteraction, GuildMember } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -12,7 +11,7 @@
.setDescription("Unmutes a user")
.addUserOption(option => option.setName("user").setDescription("The user to unmute").setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -106,7 +105,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
const apply = (interaction.options.getMember("user") as GuildMember);
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index a5bf5ea..ca52787 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -1,7 +1,6 @@
import Discord, { CategoryChannel, CommandInteraction, GuildMember, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
-import { WrappedCheck } from "jshaiku";
import getEmojiByName from "../../utils/getEmojiByName.js";
import pageIndicator from "../../utils/createPageIndicator.js";
@@ -11,7 +10,7 @@
.setDescription("View the server as a specific member")
.addUserOption(option => option.setName("member").setDescription("The member to view as").setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
let channels = [];
let m;
interaction.guild.channels.cache.forEach(channel => {
@@ -96,7 +95,7 @@
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
return true;
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 0648f66..34ad3c3 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,6 +1,5 @@
import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -13,7 +12,7 @@
.setDescription("Warns a user")
.addUserOption(option => option.setName("user").setDescription("The user to warn").setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { log, NucleusColors, renderUser, entry } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -131,10 +130,10 @@
.setStyle(canSeeChannel ? "SECONDARY" : "PRIMARY")
])
]
- });
+ }) as Discord.Message;
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
+ component = await m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch (e) {
return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("PUNISH.WARN.GREEN")
@@ -196,13 +195,12 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
const apply = (interaction.options.getMember("user") as GuildMember);
if (member === null || me === null || apply === null) throw "That member is not in the server";
const memberPos = member.roles ? member.roles.highest.position : 0;
- const mePos = me.roles ? me.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow warning bots
if (member.user.bot) throw "I cannot warn bots";
diff --git a/src/commands/nucleus/guide.ts b/src/commands/nucleus/guide.ts
index 507730b..3141f9f 100644
--- a/src/commands/nucleus/guide.ts
+++ b/src/commands/nucleus/guide.ts
@@ -1,8 +1,4 @@
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
-import getEmojiByName from "../../utils/getEmojiByName.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import guide from "../../reflex/guide.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -15,7 +11,7 @@
guide(interaction.guild, interaction);
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
diff --git a/src/commands/nucleus/invite.ts b/src/commands/nucleus/invite.ts
index 5a1ea59..ebc3c34 100644
--- a/src/commands/nucleus/invite.ts
+++ b/src/commands/nucleus/invite.ts
@@ -1,6 +1,5 @@
import { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -9,7 +8,7 @@
.setName("invite")
.setDescription("Invites Nucleus to your server");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Invite")
.setDescription("You can invite Nucleus to your server by clicking the button below")
@@ -22,7 +21,7 @@
])], ephemeral: true});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts
index c153e19..91e8363 100644
--- a/src/commands/nucleus/ping.ts
+++ b/src/commands/nucleus/ping.ts
@@ -2,7 +2,6 @@
import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
-import { WrappedCheck } from "jshaiku";
import client from "../../utils/client.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -10,7 +9,7 @@
.setName("ping")
.setDescription("Gets the bot's ping time");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
// WEBSOCKET | Nucleus -> Discord
// EDITING | Nucleus -> discord -> nucleus | edit time / 2
const initial = new Date().getTime();
@@ -28,7 +27,7 @@
]});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index c8c0f76..9ad2c16 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -1,6 +1,5 @@
-import { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -8,7 +7,7 @@
.setName("premium")
.setDescription("Information about Nucleus Premium");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Premium")
.setDescription(
@@ -22,7 +21,7 @@
], ephemeral: true});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 98b87be..2558997 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -1,6 +1,5 @@
import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -9,7 +8,7 @@
.setName("stats")
.setDescription("Gets the bot's stats");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
interaction.reply({
embeds: [new EmojiEmbed()
.setTitle("Stats")
@@ -24,7 +23,7 @@
});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = () => {
return true;
};
diff --git a/src/commands/nucleus/suggest.ts b/src/commands/nucleus/suggest.ts
index 238e7d5..a6657d8 100644
--- a/src/commands/nucleus/suggest.ts
+++ b/src/commands/nucleus/suggest.ts
@@ -11,7 +11,7 @@
.setDescription("Sends a suggestion to the developers")
.addStringOption(option => option.setName("suggestion").setDescription("The suggestion to send").setRequired(true));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
const { renderUser } = client.logger;
const suggestion = interaction.options.getString("suggestion");
const confirmation = await new confirmationMessage(interaction)
@@ -49,7 +49,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index ca56fcd..8fb6b40 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -2,7 +2,6 @@
import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import { SelectMenuOption, SlashCommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
-import { testLink, testMalware, testNSFW } from "../reflex/scanners.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import getEmojiByName from "../utils/getEmojiByName.js";
import createPageIndicator from "../utils/createPageIndicator.js";
@@ -26,7 +25,7 @@
setComponents(components: MessageActionRow[]) { this.components = components; return this; }
}
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
const pages = [
new Embed()
.setEmbed(new EmojiEmbed()
@@ -73,8 +72,7 @@
new MessageButton().setLabel("Clear all data").setCustomId("clear-all-data").setStyle("DANGER")
])])
] : []);
- 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;
@@ -166,7 +164,7 @@
});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index d2b05e9..b54ee1e 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -18,7 +18,7 @@
]));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser, renderRole } = client.logger;
const action = interaction.options.getString("action");
// TODO:[Modals] Replace this with a modal
@@ -65,7 +65,7 @@
}
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = (interaction.member as GuildMember);
const me = (interaction.guild.me as GuildMember);
const apply = (interaction.options.getMember("user") as GuildMember);
diff --git a/src/commands/rolemenu.ts b/src/commands/rolemenu.ts
index 1a5f297..dd3cb34 100644
--- a/src/commands/rolemenu.ts
+++ b/src/commands/rolemenu.ts
@@ -7,11 +7,11 @@
.setName("rolemenu")
.setDescription("Lets you choose from sets of roles to apply to yourself");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
await roleMenu(interaction);
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/server/about.ts b/src/commands/server/about.ts
index b70d0a6..c0a2ede 100644
--- a/src/commands/server/about.ts
+++ b/src/commands/server/about.ts
@@ -1,4 +1,4 @@
-import Discord, { CommandInteraction, Guild, MessageActionRow, MessageButton } from "discord.js";
+import { CommandInteraction, Guild } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -10,7 +10,7 @@
.setName("about")
.setDescription("Shows info about the server");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
const guild = interaction.guild as Guild;
const { renderUser, renderDelta } = client.logger;
interaction.reply({embeds: [new EmojiEmbed()
@@ -41,7 +41,7 @@
], ephemeral: true});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/settings/commands.ts b/src/commands/settings/commands.ts
index 7b6b309..845e001 100644
--- a/src/commands/settings/commands.ts
+++ b/src/commands/settings/commands.ts
@@ -15,7 +15,7 @@
.setDescription("Links and text shown to a user after a moderator action is performed")
.addRoleOption(o => o.setName("role").setDescription("The role given when a member is muted"));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
let m;
let clicked = "";
@@ -117,7 +117,7 @@
});
let out;
try {
- out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => true);
+ out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (_) => true);
} catch (e) { continue; }
if (out.fields) {
const buttonText = out.fields.getTextInputValue("name");
@@ -133,7 +133,7 @@
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
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/filters.ts b/src/commands/settings/filters.ts
index d35d210..7ee5b8d 100644
--- a/src/commands/settings/filters.ts
+++ b/src/commands/settings/filters.ts
@@ -1,24 +1,16 @@
-import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
+import Discord, { CommandInteraction } 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";
-import generateKeyValueList from "../../utils/generateKeyValueList.js";
-import { ChannelType } from "discord-api-types";
-import getEmojiByName from "../../utils/getEmojiByName.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("filter")
.setDescription("Setting for message filters");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
-
+const callback = async (_interaction: CommandInteraction): Promise<void> => {
+ console.log("Filters");
};
-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;
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index edd1c61..cb96567 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -16,9 +16,8 @@
ChannelType.GuildNews, ChannelType.GuildText
]).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}) as Discord.Message;
if (interaction.options.getChannel("channel")) {
let channel;
try {
@@ -141,7 +140,7 @@
])]});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
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/logs/channel.ts b/src/commands/settings/logs/channel.ts
index da0d156..4d4a392 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -16,9 +16,8 @@
ChannelType.GuildNews, ChannelType.GuildText
]));
-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}) as Discord.Message;
if (interaction.options.getChannel("channel")) {
let channel;
try {
@@ -136,7 +135,7 @@
])]});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
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/logs/events.ts b/src/commands/settings/logs/events.ts
index 88386c4..110c70e 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -35,7 +35,7 @@
.setName("events")
.setDescription("Sets what events should be logged");
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
let m;
while (true) {
@@ -96,9 +96,10 @@
.setStatus("Success")
.setEmoji("CHANNEL.TEXT.CREATE")
]});
+ return;
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
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/stats.ts b/src/commands/settings/stats.ts
index 4d61496..5a1affd 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageSelectMenu } from "discord.js";
+import Discord, { CommandInteraction, Message, MessageActionRow, MessageSelectMenu } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -16,10 +16,9 @@
.addChannelOption(option => option.setName("channel").setDescription("The channel to modify"))
.addStringOption(option => option.setName("name").setDescription("The new channel name | Enter any text or use the extra variables like {memberCount}").setAutocomplete(true));
-const callback = async (interaction: CommandInteraction): Promise<any> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
singleNotify("statsChannelDeleted", interaction.guild.id, true);
- let m;
- m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+ const m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true}) as Message;
let config = await client.database.guilds.read(interaction.guild.id);
if (interaction.options.getString("name")) {
let channel;
@@ -140,10 +139,10 @@
await client.database.guilds.write(interaction.guild.id, null, toRemove.map(k => `stats.${k}`));
}
}
- await interaction.editReply({embeds: [m.embeds[0].setFooter({text: "Message closed"})], components: []});
+ await interaction.editReply({embeds: [(m.embeds[0] as Discord.MessageEmbed).setFooter({text: "Message closed"})], components: []});
};
-const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = (interaction.member as Discord.GuildMember);
if (!member.permissions.has("MANAGE_CHANNELS")) throw "You must have the *Manage Channels* permission to use this command";
return true;
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 31df394..f9df71c 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -2,7 +2,7 @@
import getEmojiByName from "../../utils/getEmojiByName.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import Discord, { CommandInteraction, GuildChannel, Interaction, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, MessageSelectMenu, Role, SelectMenuInteraction, TextInputComponent } from "discord.js";
+import Discord, { CommandInteraction, GuildChannel, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, MessageSelectMenu, Role, SelectMenuInteraction, TextInputComponent } from "discord.js";
import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { ChannelType } from "discord-api-types";
import client from "../../utils/client.js";
@@ -21,14 +21,13 @@
.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<void | unknown> => {
- let m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+ let m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true}) as Message;
const options = {
enabled: interaction.options.getString("enabled") as string | boolean,
category: interaction.options.getChannel("category"),
maxtickets: interaction.options.getNumber("maxticketsperuser"),
supportping: interaction.options.getRole("supportrole")
};
- console.log(m);
if (options.enabled !== null || options.category || options.maxtickets || options.supportping) {
options.enabled = options.enabled === "yes" ? true : false;
if (options.category) {
@@ -198,10 +197,10 @@
.setStyle("PRIMARY")
.setCustomId("send")
])]
- });
+ }) as Message;
let i: MessageComponentInteraction;
try {
- i = await (m as Message).awaitMessageComponent({ time: 300000 });
+ i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { break; }
i.deferUpdate();
if ((i.component as MessageActionRowComponent).customId === "clearCategory") {
@@ -261,7 +260,7 @@
]});
let i: MessageComponentInteraction;
try {
- i = await (m as Message).awaitMessageComponent({time: 300000});
+ i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break; }
if ((i.component as MessageActionRowComponent).customId === "template") {
i.deferUpdate();
@@ -350,7 +349,7 @@
await interaction.editReply({ embeds: [embed.setFooter({ text: "Message closed" })], components: [] });
};
-async function manageTypes(interaction: Interaction, data: GuildConfig["tickets"], m: Message) {
+async function manageTypes(interaction: CommandInteraction, data: GuildConfig["tickets"], m: Message) {
while (true) {
if (data.useCustom) {
const customTypes = data.customTypes;
@@ -374,7 +373,10 @@
.setPlaceholder("Select types to remove")
.setMaxValues(customTypes.length)
.setMinValues(1)
- .addOptions(customTypes.map((t) => new SelectMenuOption().setLabel(t).setValue(t)))
+ .addOptions(customTypes.map((t) => ({
+ label: t,
+ value: t
+ })))
])
] : []).concat([
new MessageActionRow().addComponents([
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index d846511..4efd68c 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -1,9 +1,9 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, MessageSelectMenu, Role, SelectMenuInteraction, TextInputComponent } from "discord.js";
+import Discord, { CommandInteraction, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, MessageEmbed, 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 { Embed, SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import client from "../../utils/client.js";
import { modalInteractionCollector } from "../../utils/dualCollector.js";
@@ -14,7 +14,7 @@
.addRoleOption(option => option.setName("role").setDescription("The role to give after verifying").setRequired(false));
const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
- const m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+ const m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true}) as Message;
if (interaction.options.getRole("role")) {
let role: Role;
try {
@@ -109,7 +109,7 @@
])]});
let i: MessageComponentInteraction;
try {
- i = await (m as Message).awaitMessageComponent({time: 300000});
+ i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break; }
i.deferUpdate();
if ((i.component as MessageActionRowComponent).customId === "clear") {
@@ -157,7 +157,7 @@
]});
let i: MessageComponentInteraction;
try {
- i = await (m as Message).awaitMessageComponent({time: 300000});
+ i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break; }
if ((i.component as MessageActionRowComponent).customId === "template") {
i.deferUpdate();
@@ -239,7 +239,7 @@
break;
}
}
- await interaction.editReply({embeds: [(m.embeds[0] as Embed).setFooter({text: "Message closed"})], components: []});
+ await interaction.editReply({embeds: [(m.embeds[0] as MessageEmbed).setFooter({text: "Message closed"})], components: []});
};
const check = (interaction: CommandInteraction) => {
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index d7cfd04..b9cdddf 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -13,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<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void> => {
const name = interaction.options.getString("name");
const value = interaction.options.getString("value") || "";
const newname = interaction.options.getString("newname") || "";
diff --git a/src/commands/tags/list.ts b/src/commands/tags/list.ts
index accdd94..1a6c22c 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -52,7 +52,7 @@
.setStatus("Success")
).setTitle(`Page ${pages.length + 1}`).setPageId(pages.length));
}
- const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+ const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true}) as Message;
let page = 0;
let selectPaneOpen = false;
while (true) {
@@ -88,7 +88,7 @@
});
let i: MessageComponentInteraction;
try {
- i = await (m as Message).awaitMessageComponent({time: 300000 });
+ i = await m.awaitMessageComponent({time: 300000 });
} catch (e) { break; }
i.deferUpdate();
if ((i.component as MessageActionRowComponent).customId === "left") {
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 4835cd1..ede84b3 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -157,7 +157,7 @@
.setThumbnail(member.user.displayAvatarURL({dynamic: true}))
).setTitle("Key Permissions").setDescription("Key permissions the user has").setPageId(2)
];
- const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+ const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true}) as Message;
let page = 0;
let breakReason = "";
while (true) {
@@ -208,7 +208,7 @@
});
let i: MessageComponentInteraction;
try {
- i = await (m as Message).awaitMessageComponent({time: 300000});
+ i = await m.awaitMessageComponent({time: 300000});
} catch { breakReason = "Message timed out"; break; }
i.deferUpdate();
if ((i.component as MessageActionRowComponent).customId === "left") {
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 48733fc..4720032 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -123,10 +123,11 @@
currentRoleIndex === data.track.length - 1 || currentRoleIndex <= -1
) || !allowed[currentRoleIndex])
])
- ])});
+ ])
+ }) as Message;
let component;
try {
- component = await (m as Message).awaitMessageComponent({time: 300000});
+ component = await m.awaitMessageComponent({time: 300000});
} catch (e) {
return;
}
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index a615fae..fd58d12 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -1,4 +1,4 @@
-import Discord, { CommandInteraction, MessageActionRow, Message, MessageButton, TextInputComponent } from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
import { modalInteractionCollector } from "./dualCollector.js";
import EmojiEmbed from "./generateEmojiEmbed.js";
import getEmojiByName from "./getEmojiByName.js";
@@ -106,7 +106,7 @@
} catch { return { cancelled: true }; }
let component;
try {
- component = await (m as Message).awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 300000});
+ component = await m.awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 300000});
} catch (e) {
return { success: false, components: this.customButtons };
}
diff --git a/src/utils/dualCollector.ts b/src/utils/dualCollector.ts
index c785d0a..11df0ce 100644
--- a/src/utils/dualCollector.ts
+++ b/src/utils/dualCollector.ts
@@ -1,4 +1,4 @@
-import Discord from "discord.js";
+import Discord, { Interaction } from "discord.js";
import client from "./client.js";
export default async function (m, interactionFilter, messageFilter) {
@@ -24,14 +24,14 @@
let out;
try {
out = await new Promise((resolve, _reject) => {
- const int = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 300000})
- .on("collect", (m) => { resolve(m); });
+ const int = m.createMessageComponentCollector({filter: (m: Interaction) => interactionFilter(m), time: 300000})
+ .on("collect", (m: Interaction) => { resolve(m); });
const mod = new Discord.InteractionCollector(
client, {
- filter: (m) => modalFilter(m),
+ filter: (m: Interaction) => modalFilter(m),
time: 300000
})
- .on("collect", async (m) => {
+ .on("collect", async (m: Interaction) => {
int.stop();
(m as Discord.ModalSubmitInteraction).deferUpdate();
resolve((m as Discord.ModalSubmitInteraction)); });
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index cde178f..df46ca8 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -1,4 +1,4 @@
-import { Agenda } from "agenda/es.js";
+import { Agenda } from "@hokify/agenda";
import client from "./client.js";
import * as fs from "fs";
import * as path from "path";
@@ -10,18 +10,18 @@
constructor() {
this.agenda = new Agenda({db: {address: config.mongoUrl + "Nucleus", collection: "eventScheduler"}});
- this.agenda.define("unmuteRole", async (job: Agenda.job) => {
+ this.agenda.define("unmuteRole", async (job) => {
const guild = await client.guilds.fetch(job.attrs.data.guild);
const user = await guild.members.fetch(job.attrs.data.user);
const role = await guild.roles.fetch(job.attrs.data.role);
await user.roles.remove(role);
await job.remove();
});
- this.agenda.define("deleteFile", async (job: Agenda.job) => {
+ this.agenda.define("deleteFile", async (job) => {
fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), client._error);
await job.remove();
});
- this.agenda.define("naturalUnmute", async (job: Agenda.job) => {
+ this.agenda.define("naturalUnmute", async (job) => {
const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
const guild = await client.guilds.fetch(job.attrs.data.guild);
const user = await guild.members.fetch(job.attrs.data.user);
diff --git a/src/utils/generateEmojiEmbed.ts b/src/utils/generateEmojiEmbed.ts
index 7587db7..65e11fa 100644
--- a/src/utils/generateEmojiEmbed.ts
+++ b/src/utils/generateEmojiEmbed.ts
@@ -8,23 +8,24 @@
};
class EmojiEmbed extends MessageEmbed {
- _title: string;
- _emoji: string;
+ _title = "";
+ _emoji: string | null = null;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// This *is* meant to be an accessor rather than a property
- get title() {
+ override get title() {
+ if (!this._emoji) return this._title;
return `${getEmojiByName(this._emoji)} ${this._title}`;
}
- set title(title: string) {
+ override set title(title: string) {
this._title = title;
}
- setTitle(title: string) { this._title = title; return this; }
+ override setTitle(title: string) { this._title = title; return this; }
setEmoji(emoji: string) { this._emoji = emoji; return this; }
- setStatus(color: string) { this.setColor(colors[color]); return this; }
+ setStatus(color: "Danger" | "Warning" | "Success") { this.setColor(colors[color]); return this; }
}
export default EmojiEmbed;
\ No newline at end of file
diff --git a/src/utils/generateKeyValueList.ts b/src/utils/generateKeyValueList.ts
index ecb9780..a093ab7 100644
--- a/src/utils/generateKeyValueList.ts
+++ b/src/utils/generateKeyValueList.ts
@@ -7,7 +7,7 @@
export function capitalize(s: string) {
s = s.replace(/([A-Z])/g, " $1");
s = s.split(" ").map(word => {
- return forceCaps.includes(word.toUpperCase()) ? word.toUpperCase() : word[0]
+ return forceCaps.includes(word.toUpperCase()) ? word.toUpperCase() : (word[0] ?? "")
.toUpperCase() + word.slice(1)
.toLowerCase()
.replace("discord", "Discord");
@@ -16,10 +16,11 @@
}
export function toCapitals(s: string) {
+ if (s[0] === undefined) return "";
return s[0].toUpperCase() + s.slice(1).toLowerCase();
}
-function keyValueList(data) {
+function keyValueList(data: Record<string, string>) {
let out = "";
Object.entries(data).map(([key, value]) => {
out += `**${capitalize(key)}:** ${value}\n`;
diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts
index 63b2042..c0a43cb 100644
--- a/src/utils/getEmojiByName.ts
+++ b/src/utils/getEmojiByName.ts
@@ -1,10 +1,21 @@
import emojis from "../config/emojis.json" assert {type: "json"};
+interface EmojisIndex {
+ [key: string]: string | EmojisIndex | EmojisIndex[];
+}
+
function getEmojiByName(name: string, format?: string): string {
const split = name.split(".");
- let id = emojis;
+ let id: string | EmojisIndex | EmojisIndex[] | undefined = emojis;
split.forEach(part => {
- id = id[part];
+ if (typeof id === "string" || id === undefined) {
+ throw new Error(`Emoji ${name} not found`);
+ }
+ if (Array.isArray(id)) {
+ id = id[parseInt(part)];
+ } else {
+ id = id[part];
+ }
});
if ( format === "id" ) {
if (id === undefined) return "0";
diff --git a/src/utils/log.ts b/src/utils/log.ts
index 34b24c6..f9f751e 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -21,11 +21,11 @@
t = Math.floor(t /= 1000);
return `<t:${t}:R> (<t:${t}:D> at <t:${t}:T>)`;
}
- renderNumberDelta(num1, num2) {
+ renderNumberDelta(num1: number, num2: number) {
const delta = num2 - num1;
return `${num1} -> ${num2} (${delta > 0 ? "+" : ""}${delta})`;
}
- entry(value, displayValue) {
+ entry(value: string, displayValue: string) {
return { value: value, displayValue: displayValue };
}
renderChannel(channel: Discord.GuildChannel | Discord.ThreadChannel) {
@@ -45,7 +45,7 @@
};
- async getAuditLog(guild: Discord.Guild, event): Promise<Discord.GuildAuditLogsEntry[]>{
+ async getAuditLog(guild: Discord.Guild, event: Discord.GuildAuditLogsResolvable): Promise<Discord.GuildAuditLogsEntry[]>{
await wait(250);
const auditLog = await guild.fetchAuditLogs({type: event});
return auditLog as unknown as Discord.GuildAuditLogsEntry[];
@@ -60,9 +60,9 @@
}
if (config.logging.logs.channel) {
const channel = await client.channels.fetch(config.logging.logs.channel) as Discord.TextChannel;
- const description = {};
+ const description: Record<string, string> = {};
Object.entries(log.list).map(entry => {
- const key = entry[0];
+ const key: string = entry[0];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const value: any = entry[1];
if(value.displayValue) {
diff --git a/src/utils/singleNotify.ts b/src/utils/singleNotify.ts
index 44bb2d0..7339129 100644
--- a/src/utils/singleNotify.ts
+++ b/src/utils/singleNotify.ts
@@ -1,13 +1,15 @@
import client from "./client.js";
import EmojiEmbed from "./generateEmojiEmbed.js";
+import { Record as ImmutableRecord } from "immutable";
-const severities = {
+const severitiesType = ImmutableRecord({
"Critical": "Danger",
"Warning": "Warning",
"Info": "Success"
-};
+} as Record<string, "Danger" | "Warning" | "Success">);
+const severities = severitiesType();
-export default async function(type: string, guild: string, message: string | true, severity?: string) {
+export default async function(type: string, guild: string, message: string | true, severity: "Critical" | "Warning" | "Info" = "Info") {
const data = await client.database.guilds.read(guild);
if (message === true) {
return await client.database.guilds.write(guild, {[`singleEventNotifications.${type}`]: false});
@@ -20,7 +22,7 @@
await channel.send({embeds: [new EmojiEmbed()
.setTitle(`${severity} notification`)
.setDescription(message)
- .setStatus(severities[severity])
+ .setStatus(severities.get(severity))
.setEmoji("CONTROL.BLOCKCROSS")
]});
} catch (err) {