diff --git a/scripts/setup-files.js b/scripts/setup-files.js index 3a6c56cc..c82be649 100644 --- a/scripts/setup-files.js +++ b/scripts/setup-files.js @@ -15,6 +15,6 @@ oldPaths.forEach((path) => { if (fs.existsSync(newPath)) { console.warn(`File '${newPath}' already exists.`); } else { - fs.copyFileSync(newPath, path, fs.constants.COPYFILE_EXCL); + fs.copyFileSync(path, newPath, fs.constants.COPYFILE_EXCL); } }); diff --git a/src/@types/Command.d.ts b/src/@types/Command.d.ts index 4a61f96c..153ccdd0 100644 --- a/src/@types/Command.d.ts +++ b/src/@types/Command.d.ts @@ -7,6 +7,5 @@ declare interface Command { type ExecuteCommand = ( bot: import('@classes/Bot').default, interaction: import('discord.js').ChatInputCommandInteraction, - // TODO: use never[] below and force implementations to define types explicitly (use spread?) - args: any[] + args: unknown[] ) => Promise; diff --git a/src/commands/blacklist.ts b/src/commands/blacklist.ts index 6a0ac062..487f61da 100644 --- a/src/commands/blacklist.ts +++ b/src/commands/blacklist.ts @@ -52,7 +52,7 @@ export default { }, run: async (bot, interaction, args) => { const type = interaction.options.getSubcommand() as 'add' | 'remove'; - const mojangProfile = await fetchMojangProfile(args[0]); + const mojangProfile = await fetchMojangProfile(args[0] as string); const blacklist = _blacklist as BlacklistEntry[]; if (isFetchError(mojangProfile)) { @@ -75,8 +75,8 @@ export default { } if (type === 'add') { - const endDate = args[1]; - const reason = args[2]; + const endDate = args[1] as string; + const reason = args[2] as string; const embed = new EmbedBuilder() .setAuthor({ name: 'Blacklist', @@ -108,7 +108,6 @@ export default { messageId: blacklistMessage.id, }); } else { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const blacklistEntry = blacklist.find((user) => user.uuid === mojangProfile.id)!; blacklist.splice(blacklist.indexOf(blacklistEntry)); diff --git a/src/commands/kick.ts b/src/commands/kick.ts index fbb6fb26..008c2931 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -20,8 +20,8 @@ export default { ], }, run: async (bot, interaction, args) => { - const user: string = args[0]; - const reason: string = args[1]; + const user = args[0] as string; + const reason = args[1] as string; const embed = new EmbedBuilder(); try { diff --git a/src/commands/toggleMute.ts b/src/commands/toggleMute.ts index 1f966f9b..f83b9a0f 100644 --- a/src/commands/toggleMute.ts +++ b/src/commands/toggleMute.ts @@ -42,8 +42,8 @@ export default { }, run: async (bot, interaction, args) => { const type = interaction.options.getSubcommand() as 'mute' | 'unmute'; - const user: string = args[0]; - const duration: string = args[1]; + const user = args[0] as string; + const duration = args[1] as string; const embed = new EmbedBuilder(); try { diff --git a/src/events/discord/interactionCreate.ts b/src/events/discord/interactionCreate.ts index 2e13b9b4..53fe0b34 100644 --- a/src/events/discord/interactionCreate.ts +++ b/src/events/discord/interactionCreate.ts @@ -28,7 +28,7 @@ export default { return; } - const args: any[] = []; + const args: unknown[] = []; interaction.options.data.forEach((option) => { if (option.value) args.push(option.value); diff --git a/src/events/discord/message.ts b/src/events/discord/message.ts index 54d49909..3833a81c 100644 --- a/src/events/discord/message.ts +++ b/src/events/discord/message.ts @@ -5,7 +5,6 @@ import emojis from '@util/emojis'; const whitelist = ['ass', 'bitch', 'cock', 'dick', 'fuck']; const dataset = new DataSet<{ originalWord: string }>() .addAll(englishDataset) - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion .removePhrasesIf((phrase) => whitelist.includes(phrase.metadata!.originalWord)); const profanityMatcher = new RegExpMatcher({ diff --git a/src/events/mineflayer/chat/joinRequest.ts b/src/events/mineflayer/chat/joinRequest.ts index c03a9ca0..e1a64b0a 100644 --- a/src/events/mineflayer/chat/joinRequest.ts +++ b/src/events/mineflayer/chat/joinRequest.ts @@ -12,7 +12,6 @@ export default { const playerProfile = await fetchHypixelPlayerProfile(playerName); if (!isFetchError(playerProfile)) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const networkLevel = Math.sqrt(2 * playerProfile.networkExp! + 30625) / 50 - 2.5; if (networkLevel < parseFloat(process.env.MINIMUM_NETWORK_LEVEL)) { diff --git a/src/events/mineflayer/chat/whisper.ts b/src/events/mineflayer/chat/whisper.ts index dfbe1aa5..1b5b6aeb 100644 --- a/src/events/mineflayer/chat/whisper.ts +++ b/src/events/mineflayer/chat/whisper.ts @@ -27,10 +27,10 @@ export default { (guildMember) => guildMember.uuid === mojangProfile.id ); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const gexp = Object.values(member!.expHistory).reduce( (previous, current) => previous + current ); + bot.executeCommand( `/w ${playerName} ${target}'s total weekly gexp: ${gexp.toLocaleString()}` );