diff options
115 files changed, 548 insertions, 184 deletions
diff --git a/.yarn/sdks/typescript/package.json b/.yarn/sdks/typescript/package.json index f564d3a..ea85e13 100644 --- a/.yarn/sdks/typescript/package.json +++ b/.yarn/sdks/typescript/package.json @@ -1,6 +1,6 @@ { "name": "typescript", - "version": "4.2.4-sdk", + "version": "4.3.5-sdk", "main": "./lib/typescript.js", "type": "commonjs" } diff --git a/package.json b/package.json index 9954aa7..ce38925 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "prettier": "^2.3.2", "rimraf": "^3.0.2", "source-map-support": "^0.5.19", - "typescript": "4.2.4" + "typescript": "^4.3.5" }, "dependencies": { "@discordjs/voice": "^0.4.0", diff --git a/src/commands/_fake-command/ironmoon.ts b/src/commands/_fake-command/ironmoon.ts index 500b384..8ca1f5b 100644 --- a/src/commands/_fake-command/ironmoon.ts +++ b/src/commands/_fake-command/ironmoon.ts @@ -8,13 +8,13 @@ export default class IronmoonCommand extends BushCommand { completelyHide: true }); } - public condition(message: BushMessage): boolean { + public override condition(message: BushMessage): boolean { return false; if (message.content.toLowerCase().includes('ironmoon')) return true; else return false; } - public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { return await message.util.reply('Your message included the word ironmoon.'); } } diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index 851e2ed..a13f07a 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -50,7 +50,7 @@ export default class ChannelPermissionsCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage, { target, diff --git a/src/commands/config/autoPublishChannel.ts b/src/commands/config/autoPublishChannel.ts index 8fa987b..3381dc2 100644 --- a/src/commands/config/autoPublishChannel.ts +++ b/src/commands/config/autoPublishChannel.ts @@ -38,7 +38,7 @@ export default class AutoPublishChannelCommand extends BushCommand { }); } - public async exec(message: BushMessage, { channel }: { channel: Channel }): Promise<unknown> { + public override async exec(message: BushMessage, { channel }: { channel: Channel }): Promise<unknown> { const autoPublishChannels = await message.guild.getSetting('autoPublishChannels'); const newValue = util.addOrRemoveFromArray( autoPublishChannels.includes(channel.id) ? 'remove' : 'add', diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index 150a1b7..78b0446 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -60,7 +60,7 @@ export default class BlacklistCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, args: { action: 'blacklist' | 'unblacklist'; target: Channel | User | string; global: boolean } ): Promise<unknown> { diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index 5d2e4dd..a9318a5 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -59,7 +59,7 @@ export default class DisableCommand extends BushCommand { blacklistedCommands = ['eval', 'disable']; - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, args: { action: 'enable' | 'disable'; command: BushCommand | string; global: boolean } ): Promise<unknown> { diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts index b6e8a81..dee5322 100644 --- a/src/commands/config/muteRole.ts +++ b/src/commands/config/muteRole.ts @@ -37,7 +37,7 @@ export default class MuteRoleCommand extends BushCommand { }); } - async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<void> { + override async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<void> { await message.guild.setSetting('muteRole', args.role.id); await message.util.send({ content: `${util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`, diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts index 9c1ce92..9f80633 100644 --- a/src/commands/config/prefix.ts +++ b/src/commands/config/prefix.ts @@ -36,7 +36,7 @@ export default class PrefixCommand extends BushCommand { }); } - async exec(message: BushMessage | BushSlashMessage, args: { prefix?: string }): Promise<unknown> { + override async exec(message: BushMessage | BushSlashMessage, args: { prefix?: string }): Promise<unknown> { const oldPrefix = await message.guild.getSetting('prefix'); await message.guild.setSetting('prefix', args.prefix ?? client.config.prefix); if (args.prefix) { diff --git a/src/commands/config/punishmentFooter.ts b/src/commands/config/punishmentFooter.ts index eeac6c1..d8daf77 100644 --- a/src/commands/config/punishmentFooter.ts +++ b/src/commands/config/punishmentFooter.ts @@ -38,7 +38,7 @@ export default class PunishmentFooterCommand extends BushCommand { }); } - async exec(message: BushMessage | BushSlashMessage, args: { ending: string }): Promise<unknown> { + override async exec(message: BushMessage | BushSlashMessage, args: { ending: string }): Promise<unknown> { await message.guild.setSetting('punishmentEnding', args.ending || null); if (args.ending) return await message.util.send({ diff --git a/src/commands/config/welcomeChannel.ts b/src/commands/config/welcomeChannel.ts index 3db9e74..a662802 100644 --- a/src/commands/config/welcomeChannel.ts +++ b/src/commands/config/welcomeChannel.ts @@ -36,7 +36,7 @@ export default class WelcomeChannelCommand extends BushCommand { userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } - public async exec(message: BushMessage | BushSlashMessage, args: { channel: Channel }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { channel: Channel }): Promise<unknown> { const oldChannel = await message.guild.getSetting('welcomeChannel'); await message.guild.setSetting('welcomeChannel', args.channel.id ?? undefined); if (args.channel) { diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts index 35c57db..949e04e 100644 --- a/src/commands/dev/__template.ts +++ b/src/commands/dev/__template.ts @@ -55,7 +55,7 @@ export default class TemplateCommand extends BushCommand { userPermissions: ['SEND_MESSAGES'] }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { return await message.util.reply(`${util.emojis.error} Do not use the template command.`); } } diff --git a/src/commands/dev/_testDB.ts b/src/commands/dev/_testDB.ts new file mode 100644 index 0000000..e1fddb4 --- /dev/null +++ b/src/commands/dev/_testDB.ts @@ -0,0 +1,25 @@ +// import { BushCommand, BushSlashMessage, Global } from '@lib'; +// import { Message } from 'discord.js'; +// import { inspect } from 'util'; + +// export default class TestDurationCommand extends BushCommand { +// public constructor() { +// super('db', { +// aliases: ['db'], +// category: 'dev', +// description: { +// content: '', +// usage: '', +// examples: [''] +// }, +// slash: false, +// hidden: true, +// ownerOnly: true, +// completelyHide: true +// }); +// } + +// override async exec(message: Message | BushSlashMessage): Promise<unknown> { +// return await message.util.reply(await util.codeblock(inspect((await Global.findOne()).environment), 2000, 'js')); +// } +// } diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index dbdfc4b..1475173 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -43,7 +43,7 @@ export default class EvalCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, args: { sel_depth: number; diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index de12e34..4f11a81 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -31,7 +31,7 @@ export default class ReloadCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage /* { fast }: { fast: boolean } */): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage /* { fast }: { fast: boolean } */): Promise<unknown> { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts index 0776f1b..f0a7cbf 100644 --- a/src/commands/dev/say.ts +++ b/src/commands/dev/say.ts @@ -26,7 +26,7 @@ export default class SayCommand extends BushCommand { }); } - public async exec(message: BushMessage, { say }: { say: string }): Promise<unknown> { + public override async exec(message: BushMessage, { say }: { say: string }): Promise<unknown> { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); @@ -34,7 +34,7 @@ export default class SayCommand extends BushCommand { await message.util.send({ content: say, allowedMentions: AllowedMentions.none() }); } - public async execSlash(message: AkairoMessage, { content }: { content: string }): Promise<unknown> { + public override async execSlash(message: AkairoMessage, { content }: { content: string }): Promise<unknown> { if (!client.config.owners.includes(message.author.id)) { return await message.interaction.reply({ content: `${util.emojis.error} Only my developers can run this command.`, diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index 7b147b9..d8799f5 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -17,7 +17,7 @@ export default class ServersCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { const maxLength = 10; const guilds = [...client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).values()]; const chunkedGuilds: Guild[][] = []; diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts index 4d08345..6603fcf 100644 --- a/src/commands/dev/setLevel.ts +++ b/src/commands/dev/setLevel.ts @@ -48,7 +48,10 @@ export default class SetLevelCommand extends BushCommand { }); } - async exec(message: BushMessage | BushSlashMessage, { user, level }: { user: User; level: number }): Promise<unknown> { + override async exec( + message: BushMessage | BushSlashMessage, + { user, level }: { user: User; level: number } + ): Promise<unknown> { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index b8c8379..7f048c0 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -36,7 +36,7 @@ export default class ShCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage, { command }: { command: string }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, { command }: { command: string }): Promise<unknown> { if (!client.config.owners.includes(message.author.id)) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); const input = clean(command); diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts index eade861..22fa53f 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -37,7 +37,10 @@ export default class SuperUserCommand extends BushCommand { }; return { action, user }; } - public async exec(message: BushMessage | BushSlashMessage, args: { action: 'add' | 'remove'; user: User }): Promise<unknown> { + public override async exec( + message: BushMessage | BushSlashMessage, + args: { action: 'add' | 'remove'; user: User } + ): Promise<unknown> { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 6b49dce..0029a3a 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -30,7 +30,7 @@ export default class TestCommand extends BushCommand { } // eslint-disable-next-line require-await - public async exec(message: BushMessage, args: { feature: string }): Promise<unknown> { + public override async exec(message: BushMessage, args: { feature: string }): Promise<unknown> { const responses = [ 'Yes master.', 'Test it your self bitch, I am hungry.', diff --git a/src/commands/fun/coinflip.ts b/src/commands/fun/coinflip.ts index 68484bb..e0892b7 100644 --- a/src/commands/fun/coinflip.ts +++ b/src/commands/fun/coinflip.ts @@ -14,7 +14,7 @@ export default class CoinFlipCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<void> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<void> { const random = Math.random(); let result: string; const fall = message.author.id === '322862723090219008' ? 0.1 : 0.001; diff --git a/src/commands/fun/dice.ts b/src/commands/fun/dice.ts index 46b159b..241f1d2 100644 --- a/src/commands/fun/dice.ts +++ b/src/commands/fun/dice.ts @@ -15,7 +15,7 @@ export default class EightBallCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { const responses = ['1', '2', '3', '4', '5', '6']; const answer = responses[Math.floor(Math.random() * responses.length)]; return await message.util.reply(`You rolled a **${answer}**.`); diff --git a/src/commands/fun/eightBall.ts b/src/commands/fun/eightBall.ts index 7b7d39c..efaaff5 100644 --- a/src/commands/fun/eightBall.ts +++ b/src/commands/fun/eightBall.ts @@ -35,7 +35,7 @@ export default class EightBallCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<void> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<void> { const responses = [ 'It is certain', 'Without a doubt', diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts index 2b46e34..2bec1e9 100644 --- a/src/commands/fun/minesweeper.ts +++ b/src/commands/fun/minesweeper.ts @@ -91,7 +91,7 @@ export default class MinesweeperCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, { rows, diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index eefdc02..37d2256 100644 --- a/src/commands/info/avatar.ts +++ b/src/commands/info/avatar.ts @@ -35,7 +35,7 @@ export default class AvatarCommand extends BushCommand { }); } - async exec(message: BushMessage | BushSlashMessage, { user }: { user: User }): Promise<void> { + override async exec(message: BushMessage | BushSlashMessage, { user }: { user: User }): Promise<void> { user = user ?? message.author; const embed = new MessageEmbed() diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index e47984b..c89c356 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -17,7 +17,7 @@ export default class BotInfoCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<void> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<void> { const developers = (await util.mapIDs(client.config.owners)).map((u) => u?.tag).join('\n'); const currentCommit = (await util.shell('git rev-parse HEAD')).stdout.replace('\n', ''); let repoUrl = (await util.shell('git remote get-url origin')).stdout.replace('\n', ''); diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index e995d79..7ceb37f 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -40,7 +40,7 @@ export default class ColorCommand extends BushCommand { return color.substr(4, color.length - 5); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, args: { color: string | BushRole | BushGuildMember } ): Promise<unknown> { diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 6ce4d76..2cdf3d5 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -36,7 +36,10 @@ export default class GuildInfoCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage, args: { guild: Guild | bigint | GuildPreview }): Promise<unknown> { + public override async exec( + message: BushMessage | BushSlashMessage, + args: { guild: Guild | bigint | GuildPreview } + ): Promise<unknown> { if (!args?.guild && !message.guild) { return await message.util.reply( `${util.emojis.error} You must either provide an server to provide info about or run this command in a server.` diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 458b7d0..691051c 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -43,7 +43,7 @@ export default class HelpCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, args: { command: BushCommand | string; showHidden?: boolean } ): Promise<unknown> { diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index 598cd14..582494c 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -17,7 +17,7 @@ export default class IconCommand extends BushCommand { }); } - async exec(message: BushMessage | BushSlashMessage): Promise<void> { + override async exec(message: BushMessage | BushSlashMessage): Promise<void> { const embed = new MessageEmbed() .setTimestamp() .setColor(util.colors.default) diff --git a/src/commands/info/invite.ts b/src/commands/info/invite.ts index a2128b3..384c59e 100644 --- a/src/commands/info/invite.ts +++ b/src/commands/info/invite.ts @@ -18,7 +18,7 @@ export default class InviteCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { if (client.config.isDevelopment) return await message.util.reply(`${util.emojis.error} The dev bot cannot be invited.`); const ButtonRow = new MessageActionRow().addComponents( new MessageButton({ diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 550c3c7..5f2220c 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -17,7 +17,7 @@ export default class PingCommand extends BushCommand { }); } - public async exec(message: BushMessage): Promise<void> { + public override async exec(message: BushMessage): Promise<void> { const sentMessage = (await message.util.send('Pong!')) as Message; const timestamp: number = message.editedTimestamp ? message.editedTimestamp : message.createdTimestamp; const botLatency = `${'```'}\n ${Math.round(sentMessage.createdTimestamp - timestamp)}ms ${'```'}`; @@ -35,7 +35,7 @@ export default class PingCommand extends BushCommand { }); } - public async execSlash(message: BushSlashMessage): Promise<void> { + public override async execSlash(message: BushSlashMessage): Promise<void> { const timestamp1 = message.interaction.createdTimestamp; await message.interaction.reply('Pong!'); const timestamp2 = await message.interaction.fetchReply().then((m) => (m as Message).createdTimestamp); diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index 82ee04f..6f2b074 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -60,7 +60,7 @@ export default class PronounsCommand extends BushCommand { slash: true }); } - async exec(message: Message | BushSlashMessage, args: { user?: User }): Promise<unknown> { + override async exec(message: Message | BushSlashMessage, args: { user?: User }): Promise<unknown> { const user = args.user || message.author; const author = user.id === message.author.id; try { diff --git a/src/commands/info/snowflakeInfo.ts b/src/commands/info/snowflakeInfo.ts index b6b9e16..f293219 100644 --- a/src/commands/info/snowflakeInfo.ts +++ b/src/commands/info/snowflakeInfo.ts @@ -52,7 +52,7 @@ export default class SnowflakeInfoCommand extends BushCommand { ] }); } - public async exec(message: BushMessage | BushSlashMessage, args: { snowflake: bigint }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { snowflake: bigint }): Promise<unknown> { const snowflake = `${args.snowflake}` as Snowflake; const snowflakeEmbed = new MessageEmbed().setTitle('Unknown :snowflake:').setColor(util.colors.default); diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index cecf5ec..d9922d0 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -40,7 +40,7 @@ export default class UserInfoCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage, args: { user: GuildMember }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { user: GuildMember }): Promise<unknown> { const user = args?.user || message.member; const emojis = []; const superUsers = client.cache.global.superUsers; diff --git a/src/commands/moderation/_lockdown.ts b/src/commands/moderation/_lockdown.ts index df5a9b4..374e8f1 100644 --- a/src/commands/moderation/_lockdown.ts +++ b/src/commands/moderation/_lockdown.ts @@ -31,7 +31,7 @@ export default class LockdownCommand extends BushCommand { userPermissions: ['SEND_MESSAGES'] }); } - public async exec(message: BushMessage | BushSlashMessage, { all }: { all: boolean }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, { all }: { all: boolean }): Promise<unknown> { return await message.util.reply('no'); if (!all) { if (!['GUILD_TEXT', 'GUILD_NEWS'].includes(message.channel.type)) diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 9239f2a..cfa3e31 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -80,7 +80,7 @@ export default class BanCommand extends BushCommand { userPermissions: ['BAN_MEMBERS'] }); } - async exec( + override async exec( message: BushMessage | BushSlashMessage, { user, diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index 5fd83b7..c425124 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -55,7 +55,7 @@ export default class KickCommand extends BushCommand { }); } - async exec( + override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason?: string; force: boolean } ): Promise<unknown> { diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 4850a4d..8f727a5 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -46,7 +46,7 @@ export default class ModlogCommand extends BushCommand { return modLog.join(`\n`); } - async exec(message: BushMessage | BushSlashMessage, { search }: { search: BushUser | string }): Promise<unknown> { + override async exec(message: BushMessage | BushSlashMessage, { search }: { search: BushUser | string }): Promise<unknown> { const foundUser = search instanceof User ? search : await util.resolveUserAsync(search); if (foundUser) { const logs = await ModLog.findAll({ diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 7f3edbb..df8e235 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -56,7 +56,7 @@ export default class MuteCommand extends BushCommand { userPermissions: ['MANAGE_MESSAGES'] }); } - async exec( + public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string }; force: boolean } ): Promise<unknown> { diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index de5e8ce..075b822 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -36,7 +36,7 @@ export default class RemoveReactionEmojiCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage, { messageToRemoveFrom, emoji }: { messageToRemoveFrom: BushMessage; emoji: Emoji | BigInt } ): Promise<unknown> { diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index bd8cf8d..1371ee8 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -90,7 +90,7 @@ export default class RoleCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, { action, user, role, duration }: { action: 'add' | 'remove'; user: BushGuildMember; role: BushRole; duration: number } ): Promise<unknown> { diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 441a0ac..fd3aec6 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -48,7 +48,7 @@ export default class SlowModeCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, { length, diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index 8aa9ef0..522c715 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -1,4 +1,4 @@ -import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib'; +import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, BushUser } from '@lib'; import { User } from 'discord.js'; export default class UnbanCommand extends BushCommand { @@ -51,9 +51,12 @@ export default class UnbanCommand extends BushCommand { userPermissions: ['BAN_MEMBERS'] }); } - async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: User; reason?: string }): Promise<unknown> { + override async exec( + message: BushMessage | BushSlashMessage, + { user, reason }: { user: BushUser; reason?: string } + ): Promise<unknown> { if (!(user instanceof User)) { - user = util.resolveUser(user, client.users.cache); + user = util.resolveUser(user, client.users.cache) as BushUser; } const responseCode = await message.guild.unban({ user, diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index 528317c..6cdb08b 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -50,7 +50,10 @@ export default class UnmuteCommand extends BushCommand { userPermissions: ['MANAGE_MESSAGES'] }); } - async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: BushUser; reason?: string }): Promise<unknown> { + override async exec( + message: BushMessage | BushSlashMessage, + { user, reason }: { user: BushUser; reason?: string } + ): Promise<unknown> { const error = util.emojis.error; const member = message.guild.members.cache.get(user.id) as BushGuildMember; const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'unmute'); diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index 3f9e9b5..1067033 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -54,7 +54,7 @@ export default class WarnCommand extends BushCommand { userPermissions: ['MANAGE_MESSAGES'] }); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason: string; force: boolean } ): Promise<unknown> { diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts index 7a021ed..eb1ab89 100644 --- a/src/commands/moulberry-bush/capePerms.ts +++ b/src/commands/moulberry-bush/capePerms.ts @@ -37,7 +37,7 @@ export default class CapePermissionsCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage, args: { ign: string }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { ign: string }): Promise<unknown> { interface Capeperms { success: boolean; perms: User[]; diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index 269c33f..4abc6ab 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -23,7 +23,7 @@ export default class GiveawayPingCommand extends BushCommand { }); } - public async exec(message: BushMessage): Promise<unknown> { + public override async exec(message: BushMessage): Promise<unknown> { if (!message.member.permissions.has('MANAGE_GUILD')) await message.util.reply(`${util.emojis.error} You are missing the \`manage server\` permission.`); diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts index 86ab985..fef4538 100644 --- a/src/commands/moulberry-bush/level.ts +++ b/src/commands/moulberry-bush/level.ts @@ -136,7 +136,7 @@ export default class LevelCommand extends BushCommand { } } - async exec(message: BushMessage | BushSlashMessage, { user }: { user?: BushUser }): Promise<void> { + override async exec(message: BushMessage | BushSlashMessage, { user }: { user?: BushUser }): Promise<void> { // await message.reply( // new MessageAttachment( // await this.getImage(user || message.author), diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 2ee02bd..e91420b 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,6 +1,6 @@ -import { GuildMember, MessageEmbed, TextChannel } from 'discord.js'; +import { GuildMember, MessageEmbed } from 'discord.js'; import moment from 'moment'; -import { AllowedMentions, BushCommand, BushMessage } from '../../lib'; +import { AllowedMentions, BushCommand, BushMessage, BushTextChannel } from '../../lib'; export default class ReportCommand extends BushCommand { public constructor() { @@ -55,7 +55,10 @@ export default class ReportCommand extends BushCommand { }); } - public async exec(message: BushMessage, { member, evidence }: { member: GuildMember; evidence: string }): Promise<unknown> { + public override async exec( + message: BushMessage, + { member, evidence }: { member: GuildMember; evidence: string } + ): Promise<unknown> { if (message.guild.id != client.consts.mappings.guilds.bush) return await message.util.reply(`${util.emojis.error} This command can only be run in Moulberry's bush.`); if (!member) return await message.util.reply(`${util.emojis.error} Choose someone to report`); @@ -103,7 +106,7 @@ export default class ReportCommand extends BushCommand { reportEmbed.addField('Attachment', message.attachments.first().url); } } - const reportChannel = <TextChannel>client.channels.cache.get('782972723654688848'); + const reportChannel = client.channels.cache.get('782972723654688848') as unknown as BushTextChannel; await reportChannel.send({ embeds: [reportEmbed] }).then(async (ReportMessage) => { try { await ReportMessage.react(util.emojis.success); diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 41dd8de..eb767a8 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -103,7 +103,7 @@ export default class RuleCommand extends BushCommand { }); } - public async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }): Promise<unknown> { + public override async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }): Promise<unknown> { const rulesEmbed = new MessageEmbed() .setColor('#ef3929') .setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true })) diff --git a/src/commands/skyblock-reborn/chooseColor.ts b/src/commands/skyblock-reborn/chooseColor.ts index 9b4b7c9..3814670 100644 --- a/src/commands/skyblock-reborn/chooseColor.ts +++ b/src/commands/skyblock-reborn/chooseColor.ts @@ -118,7 +118,10 @@ export default class ChooseColorCommand extends BushCommand { }); } - public async exec(message: BushMessage | BushSlashMessage, args: { color: Role | RoleResolvable }): Promise<unknown> { + public override async exec( + message: BushMessage | BushSlashMessage, + args: { color: Role | RoleResolvable } + ): Promise<unknown> { if (message.guild.id != client.consts.mappings.guilds.sbr) { return await message.util.reply(`${util.emojis.error} This command can only be run in Skyblock: Reborn.`); } diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts index cab23d8..3fb340d 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -88,7 +88,7 @@ export default class DecodeCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage | AkairoMessage, { from, to, data }: { from: BufferEncoding; to: BufferEncoding; data: string } ): Promise<unknown> { diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index fcf2da3..633a263 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -26,7 +26,7 @@ export default class HashCommand extends BushCommand { }); } - public async exec(message: BushMessage, { url }: { url: string }): Promise<void> { + public override async exec(message: BushMessage, { url }: { url: string }): Promise<void> { try { const req = await got.get(url); const rawHash = crypto.createHash('md5'); diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 38cd8ca..a68c01d 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -97,7 +97,7 @@ export default class PriceCommand extends BushCommand { }); } - public async exec(message: BushMessage, { item, strict }: { item: string; strict: boolean }): Promise<unknown> { + public override async exec(message: BushMessage, { item, strict }: { item: string; strict: boolean }): Promise<unknown> { const errors = new Array<string>(); const [bazaar, currentLowestBIN, averageLowestBIN, auctionAverages] = ( diff --git a/src/commands/utilities/serverStatus.ts b/src/commands/utilities/serverStatus.ts index b9d6136..02db638 100644 --- a/src/commands/utilities/serverStatus.ts +++ b/src/commands/utilities/serverStatus.ts @@ -19,7 +19,7 @@ export default class ServerStatusCommand extends BushCommand { }); } - public async exec(message: BushMessage): Promise<void> { + public override async exec(message: BushMessage): Promise<void> { const msgEmbed: MessageEmbed = new MessageEmbed() .setTitle('Server status') .setDescription(`Checking server:\n${util.emojis.loading}`) diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts index 02ca506..06856d9 100644 --- a/src/commands/utilities/uuid.ts +++ b/src/commands/utilities/uuid.ts @@ -29,7 +29,7 @@ export default class UuidCommand extends BushCommand { } // eslint-disable-next-line @typescript-eslint/no-explicit-any - public async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }): Promise<unknown> { + public override async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }): Promise<unknown> { if (!ign) return await message.util.reply(`${util.emojis.error} Please enter a valid ign.`); const readableIGN = ign.match[0]; try { diff --git a/src/commands/utilities/viewraw.ts b/src/commands/utilities/viewraw.ts index ca21b4b..46353ba 100644 --- a/src/commands/utilities/viewraw.ts +++ b/src/commands/utilities/viewraw.ts @@ -43,7 +43,7 @@ export default class ViewRawCommand extends BushCommand { }); } - public async exec( + public override async exec( message: BushMessage | BushSlashMessage, args: { message: Message | BigInt; channel: TextChannel | NewsChannel | DMChannel; json?: boolean } ): Promise<unknown> { diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts index 4bd81bb..a6c4665 100644 --- a/src/commands/utilities/whoHasRole.ts +++ b/src/commands/utilities/whoHasRole.ts @@ -36,7 +36,7 @@ export default class WhoHasRoleCommand extends BushCommand { userPermissions: ['SEND_MESSAGES'] }); } - public async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<unknown> { const roleMembers = args.role.members.map((member) => `${member.user} (${Util.escapeMarkdown(member.user.tag)})`); const chunkedRoleMembers = util.chunk(roleMembers, 30); diff --git a/src/inhibitors/blacklist/channelGlobalBlacklist.ts b/src/inhibitors/blacklist/channelGlobalBlacklist.ts index 28a2c5e..7a1d27d 100644 --- a/src/inhibitors/blacklist/channelGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/channelGlobalBlacklist.ts @@ -9,7 +9,7 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor { }); } - public exec(message: BushMessage | BushSlashMessage): boolean { + public override exec(message: BushMessage | BushSlashMessage): boolean { if (!message.author) return false; if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user.id === message.author.id) return false; diff --git a/src/inhibitors/blacklist/channelGuildBlacklist.ts b/src/inhibitors/blacklist/channelGuildBlacklist.ts index 7fa4ccf..be338fe 100644 --- a/src/inhibitors/blacklist/channelGuildBlacklist.ts +++ b/src/inhibitors/blacklist/channelGuildBlacklist.ts @@ -9,7 +9,7 @@ export default class ChannelGuildBlacklistInhibitor extends BushInhibitor { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { if (!message.author || !message.guild) return false; if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user.id === message.author.id) return false; diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts index 5a2123c..afaae9d 100644 --- a/src/inhibitors/blacklist/guildBlacklist.ts +++ b/src/inhibitors/blacklist/guildBlacklist.ts @@ -9,7 +9,7 @@ export default class GuildBlacklistInhibitor extends BushInhibitor { }); } - public exec(message: BushMessage | BushSlashMessage): boolean { + public override exec(message: BushMessage | BushSlashMessage): boolean { if (!message.guild) return false; if ( message.author && diff --git a/src/inhibitors/blacklist/userGlobalBlacklist.ts b/src/inhibitors/blacklist/userGlobalBlacklist.ts index d8964a4..1173d87 100644 --- a/src/inhibitors/blacklist/userGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/userGlobalBlacklist.ts @@ -9,7 +9,7 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor { }); } - public exec(message: BushMessage | BushSlashMessage): boolean { + public override exec(message: BushMessage | BushSlashMessage): boolean { if (!message.author) return false; if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user.id === message.author.id) return false; diff --git a/src/inhibitors/blacklist/userGuildBlacklist.ts b/src/inhibitors/blacklist/userGuildBlacklist.ts index 0bc6749..95ba17a 100644 --- a/src/inhibitors/blacklist/userGuildBlacklist.ts +++ b/src/inhibitors/blacklist/userGuildBlacklist.ts @@ -9,7 +9,7 @@ export default class UserGuildBlacklistInhibitor extends BushInhibitor { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { if (!message.author || !message.guild) return false; if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user.id === message.author.id) return false; diff --git a/src/inhibitors/commands/globalDisabledCommand.ts b/src/inhibitors/commands/globalDisabledCommand.ts index 2954393..4c85c3b 100644 --- a/src/inhibitors/commands/globalDisabledCommand.ts +++ b/src/inhibitors/commands/globalDisabledCommand.ts @@ -9,7 +9,7 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { }); } - public async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (message.author.isOwner()) return false; if (client.cache.global.disabledCommands?.includes(command?.id)) { client.console.debug(`disabledGlobalCommand blocked message.`); diff --git a/src/inhibitors/commands/guildDisabledCommand.ts b/src/inhibitors/commands/guildDisabledCommand.ts index d16bff7..b21e1ef 100644 --- a/src/inhibitors/commands/guildDisabledCommand.ts +++ b/src/inhibitors/commands/guildDisabledCommand.ts @@ -9,7 +9,7 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { }); } - public async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (!message.guild || !message.guild) return; if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands diff --git a/src/inhibitors/noCache.ts b/src/inhibitors/noCache.ts index d461076..6bb2001 100644 --- a/src/inhibitors/noCache.ts +++ b/src/inhibitors/noCache.ts @@ -9,7 +9,7 @@ export default class NoCacheInhibitor extends BushInhibitor { }); } - public async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { + public override async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { if (client.isOwner(message.author)) return false; for (const property in client.cache.global) { if (!client.cache.global[property]) { diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 7b270f6..4c2b940 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -34,12 +34,17 @@ import { BushConstants } from '../../utils/BushConstants'; import { BushLogger } from '../../utils/BushLogger'; import { Config } from '../../utils/Config'; import { BushApplicationCommand } from '../discord.js/BushApplicationCommand'; +import { BushBaseGuildEmojiManager } from '../discord.js/BushBaseGuildEmojiManager'; import { BushButtonInteraction } from '../discord.js/BushButtonInteraction'; import { BushCategoryChannel } from '../discord.js/BushCategoryChannel'; +import { BushChannel } from '../discord.js/BushChannel'; +import { BushChannelManager } from '../discord.js/BushChannelManager'; +import { BushClientUser } from '../discord.js/BushClientUser'; import { BushCommandInteraction } from '../discord.js/BushCommandInteraction'; import { BushDMChannel } from '../discord.js/BushDMChannel'; import { BushGuild } from '../discord.js/BushGuild'; import { BushGuildEmoji } from '../discord.js/BushGuildEmoji'; +import { BushGuildManager } from '../discord.js/BushGuildManager'; import { BushGuildMember } from '../discord.js/BushGuildMember'; import { BushMessage } from '../discord.js/BushMessage'; import { BushMessageReaction } from '../discord.js/BushMessageReaction'; @@ -53,6 +58,7 @@ import { BushTextChannel } from '../discord.js/BushTextChannel'; import { BushThreadChannel } from '../discord.js/BushThreadChannel'; import { BushThreadMember } from '../discord.js/BushThreadMember'; import { BushUser } from '../discord.js/BushUser'; +import { BushUserManager } from '../discord.js/BushUserManager'; import { BushVoiceChannel } from '../discord.js/BushVoiceChannel'; import { BushVoiceState } from '../discord.js/BushVoiceState'; import { BushClientUtil } from './BushClientUtil'; @@ -75,6 +81,8 @@ export type BushEmojiResolvable = Snowflake | BushGuildEmoji | BushReactionEmoji export type BushEmojiIdentifierResolvable = string | BushEmojiResolvable; export type BushThreadChannelResolvable = BushThreadChannel | Snowflake; export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflake; +export type BushGuildTextChannelResolvable = BushTextChannel | BushNewsChannel | Snowflake; +export type BushChannelResolvable = BushChannel | Snowflake; export interface BushFetchedThreads { threads: Collection<Snowflake, BushThreadChannel>; hasMore?: boolean; @@ -86,7 +94,9 @@ const rl = readline.createInterface({ terminal: false }); -export class BushClient extends AkairoClient { +type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B; + +export class BushClient<Ready extends boolean = boolean> extends AkairoClient { public static preStart(): void { Structures.extend('GuildEmoji', () => BushGuildEmoji); Structures.extend('DMChannel', () => BushDMChannel); @@ -110,6 +120,12 @@ export class BushClient extends AkairoClient { Structures.extend('SelectMenuInteraction', () => BushSelectMenuInteraction); } + public declare channels: BushChannelManager; + public declare readonly emojis: BushBaseGuildEmojiManager; + public declare guilds: BushGuildManager; + public declare user: If<Ready, BushClientUser>; + public declare users: BushUserManager; + public config: Config; public listenerHandler: BushListenerHandler; public inhibitorHandler: BushInhibitorHandler; @@ -289,17 +305,17 @@ export class BushClient extends AkairoClient { } /** Logs out, terminates the connection to Discord, and destroys the client. */ - public destroy(relogin = false): void | Promise<string> { + public override destroy(relogin = false): void | Promise<string> { super.destroy(); if (relogin) { return this.login(this.token); } } - public isOwner(user: BushUserResolvable): boolean { + public override isOwner(user: BushUserResolvable): boolean { return this.config.owners.includes(this.users.resolveId(user)); } - public isSuperUser(user: BushUserResolvable): boolean { + public override isSuperUser(user: BushUserResolvable): boolean { const userID = this.users.resolveId(user); return !!BushCache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID); } diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index aecc635..ac39611 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -521,7 +521,7 @@ export class BushClientUtil extends ClientUtil { /** Gets the channel configs as a TextChannel */ public async getConfigChannel(channel: 'log' | 'error' | 'dm'): Promise<TextChannel> { - return (await client.channels.fetch(client.config.channels[channel])) as TextChannel; + return (await client.channels.fetch(client.config.channels[channel])) as unknown as TextChannel; } /** diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 6616d1d..6dd5449 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -182,8 +182,8 @@ export class BushCommand extends Command { } } - public exec(message: BushMessage, args: any): any; - public exec(message: BushMessage | BushSlashMessage, args: any): any { + public override exec(message: BushMessage, args: any): any; + public override exec(message: BushMessage | BushSlashMessage, args: any): any { super.exec(message, args); } } diff --git a/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts index f16554c..7eca05b 100644 --- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts +++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts @@ -35,7 +35,7 @@ export class BushCommandHandler extends CommandHandler { super(client, options); } - public async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise<boolean> { + public override async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise<boolean> { if (command.ownerOnly) { const isOwner = client.isOwner(message.author); if (!isOwner) { diff --git a/src/lib/extensions/discord-akairo/BushInhibitor.ts b/src/lib/extensions/discord-akairo/BushInhibitor.ts index f924458..8a199fc 100644 --- a/src/lib/extensions/discord-akairo/BushInhibitor.ts +++ b/src/lib/extensions/discord-akairo/BushInhibitor.ts @@ -8,8 +8,8 @@ import { BushSlashMessage } from './BushSlashMessage'; export class BushInhibitor extends Inhibitor { public declare client: BushClient; - public exec(message: BushMessage, command: BushCommand): any; - public exec(message: BushMessage | BushSlashMessage, command: BushCommand): any { + public override exec(message: BushMessage, command: BushCommand): any; + public override exec(message: BushMessage | BushSlashMessage, command: BushCommand): any { return super.exec(message, command); } } diff --git a/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts b/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts new file mode 100644 index 0000000..165ea6e --- /dev/null +++ b/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts @@ -0,0 +1,9 @@ +import { Snowflake } from 'discord-api-types'; +import { CachedManager } from 'discord.js'; +import { BushClient, BushEmojiIdentifierResolvable, BushEmojiResolvable } from '../discord-akairo/BushClient'; +import { BushGuildEmoji } from './BushGuildEmoji'; + +export class BushBaseGuildEmojiManager extends CachedManager<Snowflake, BushGuildEmoji, BushEmojiResolvable> { + public constructor(client: BushClient, iterable?: Iterable<unknown>); + public resolveIdentifier(emoji: BushEmojiIdentifierResolvable): string | null; +} diff --git a/src/lib/extensions/discord.js/BushChannel.d.ts b/src/lib/extensions/discord.js/BushChannel.d.ts new file mode 100644 index 0000000..482dd9b --- /dev/null +++ b/src/lib/extensions/discord.js/BushChannel.d.ts @@ -0,0 +1,23 @@ +import { Snowflake } from 'discord-api-types'; +import { Channel, ChannelMention } from 'discord.js'; +import { ChannelTypes } from 'discord.js/typings/enums'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushDMChannel } from './BushDMChannel'; +import { BushNewsChannel } from './BushNewsChannel'; +import { BushTextChannel } from './BushTextChannel'; +import { BushThreadChannel } from './BushThreadChannel'; + +export class BushChannel extends Channel { + public constructor(client: BushClient, data?: unknown, immediatePatch?: boolean); + public readonly createdAt: Date; + public readonly createdTimestamp: number; + public deleted: boolean; + public id: Snowflake; + public readonly partial: false; + public type: keyof typeof ChannelTypes; + public delete(): Promise<BushChannel>; + public fetch(force?: boolean): Promise<BushChannel>; + public isText(): this is BushTextChannel | BushDMChannel | BushNewsChannel | BushThreadChannel; + public isThread(): this is BushThreadChannel; + public toString(): ChannelMention; +} diff --git a/src/lib/extensions/discord.js/BushChannelManager.d.ts b/src/lib/extensions/discord.js/BushChannelManager.d.ts new file mode 100644 index 0000000..1aa19c5 --- /dev/null +++ b/src/lib/extensions/discord.js/BushChannelManager.d.ts @@ -0,0 +1,9 @@ +import { Snowflake } from 'discord-api-types'; +import { CachedManager, Client, FetchChannelOptions } from 'discord.js'; +import { BushChannelResolvable } from '../discord-akairo/BushClient'; +import { BushChannel } from './BushChannel'; + +export class BushChannelManager extends CachedManager<Snowflake, BushChannel, BushChannelResolvable> { + public constructor(client: Client, iterable: Iterable<unknown>); + public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<BushChannel | null>; +} diff --git a/src/lib/extensions/discord.js/BushClientUser.d.ts b/src/lib/extensions/discord.js/BushClientUser.d.ts new file mode 100644 index 0000000..119f8ce --- /dev/null +++ b/src/lib/extensions/discord.js/BushClientUser.d.ts @@ -0,0 +1,23 @@ +import { + ActivityOptions, + Base64Resolvable, + BufferResolvable, + ClientUserEditData, + Presence, + PresenceData, + PresenceStatusData +} from 'discord.js'; +import { BushUser } from './BushUser'; + +export class BushClientUser extends BushUser { + public mfaEnabled: boolean; + public verified: boolean; + public edit(data: ClientUserEditData): Promise<this>; + public setActivity(options?: ActivityOptions): Presence; + public setActivity(name: string, options?: ActivityOptions): Presence; + public setAFK(afk: boolean, shardId?: number | number[]): Presence; + public setAvatar(avatar: BufferResolvable | Base64Resolvable): Promise<this>; + public setPresence(data: PresenceData): Presence; + public setStatus(status: PresenceStatusData, shardId?: number | number[]): Presence; + public setUsername(username: string): Promise<this>; +} diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index dd41dad..acfe5da 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -1,8 +1,10 @@ -import { Guild, User } from 'discord.js'; -import { BushGuildMember, ModLogType } from '../..'; +import { Guild } from 'discord.js'; import { Guild as GuildDB, GuildModel } from '../../models/Guild'; +import { ModLogType } from '../../models/ModLog'; import { BushClient, BushUserResolvable } from '../discord-akairo/BushClient'; +import { BushGuildMember } from './BushGuildMember'; import { BushGuildMemberManager } from './BushGuildMemberManager'; +import { BushUser } from './BushUser'; export class BushGuild extends Guild { public declare readonly client: BushClient; @@ -27,7 +29,7 @@ export class BushGuild extends Guild { } public async unban(options: { - user: BushUserResolvable | User; + user: BushUserResolvable | BushUser; reason?: string; moderator?: BushUserResolvable; }): Promise< diff --git a/src/lib/extensions/discord.js/BushGuildManager.d.ts b/src/lib/extensions/discord.js/BushGuildManager.d.ts new file mode 100644 index 0000000..5bfe706 --- /dev/null +++ b/src/lib/extensions/discord.js/BushGuildManager.d.ts @@ -0,0 +1,20 @@ +import { Snowflake } from 'discord-api-types'; +import { + CachedManager, + Collection, + FetchGuildOptions, + FetchGuildsOptions, + Guild, + GuildCreateOptions, + OAuth2Guild +} from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushGuildResolvable } from './BushCommandInteraction'; +import { BushGuild } from './BushGuild'; + +export class BushGuildManager extends CachedManager<Snowflake, BushGuild, BushGuildResolvable> { + public constructor(client: BushClient, iterable?: Iterable<unknown>); + public create(name: string, options?: GuildCreateOptions): Promise<Guild>; + public fetch(options: Snowflake | FetchGuildOptions): Promise<BushGuild>; + public fetch(options?: FetchGuildsOptions): Promise<Collection<Snowflake, OAuth2Guild>>; +} diff --git a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts index 96b99e5..7bdad83 100644 --- a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { + AddGuildMemberOptions, BanOptions, CachedManager, Collection, @@ -10,8 +11,7 @@ import { GuildPruneMembersOptions, GuildSearchMembersOptions, Snowflake, - User, - UserResolvable + User } from 'discord.js'; import { BushClient, BushGuildMemberResolvable, BushUserResolvable } from '../discord-akairo/BushClient'; import { BushGuild } from './BushGuild'; @@ -21,15 +21,20 @@ export class BushGuildMemberManager extends CachedManager<Snowflake, BushGuildMe public constructor(guild: BushGuild, iterable?: Iterable<unknown>); public declare readonly client: BushClient; public guild: BushGuild; + public add( + user: BushUserResolvable, + options: AddGuildMemberOptions & { fetchWhenExisting: false } + ): Promise<GuildMember | null>; + public add(user: BushUserResolvable, options: AddGuildMemberOptions): Promise<GuildMember>; public ban(user: BushUserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>; public edit(user: BushUserResolvable, data: GuildMemberEditData, reason?: string): Promise<void>; public fetch( - options: UserResolvable | FetchMemberOptions | (FetchMembersOptions & { user: UserResolvable }) + options: BushUserResolvable | FetchMemberOptions | (FetchMembersOptions & { user: BushUserResolvable }) ): Promise<GuildMember>; public fetch(options?: FetchMembersOptions): Promise<Collection<Snowflake, GuildMember>>; - public kick(user: UserResolvable, reason?: string): Promise<BushGuildMember | User | Snowflake>; + public kick(user: BushUserResolvable, reason?: string): Promise<BushGuildMember | User | Snowflake>; public prune(options: GuildPruneMembersOptions & { dry?: false; count: false }): Promise<null>; public prune(options?: GuildPruneMembersOptions): Promise<number>; public search(options: GuildSearchMembersOptions): Promise<Collection<Snowflake, GuildMember>>; - public unban(user: UserResolvable, reason?: string): Promise<User>; + public unban(user: BushUserResolvable, reason?: string): Promise<User>; } diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index 7971a6d..5638801 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -26,7 +26,7 @@ export class BushMessage extends Message { super(client, data, channel); // this.util = new BushCommandUtil(client.commandHandler, this); } - public fetch(force?: boolean): Promise<BushMessage> { + public override fetch(force?: boolean): Promise<BushMessage> { return super.fetch(force) as Promise<BushMessage>; } } diff --git a/src/lib/extensions/discord.js/BushUserManager.d.ts b/src/lib/extensions/discord.js/BushUserManager.d.ts new file mode 100644 index 0000000..176b449 --- /dev/null +++ b/src/lib/extensions/discord.js/BushUserManager.d.ts @@ -0,0 +1,9 @@ +import { Snowflake } from 'discord-api-types'; +import { BaseFetchOptions, CachedManager } from 'discord.js'; +import { BushClient, BushUserResolvable } from '../discord-akairo/BushClient'; +import { BushUser } from './BushUser'; + +export class BushUserManager extends CachedManager<Snowflake, BushUser, BushUserResolvable> { + public constructor(client: BushClient, iterable?: Iterable<unknown>); + public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<BushUser>; +} diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts index 9fcafbe..c204c9a 100644 --- a/src/lib/models/ActivePunishment.ts +++ b/src/lib/models/ActivePunishment.ts @@ -36,31 +36,58 @@ export class ActivePunishment /** * The ID of this punishment (no real use just for a primary key) */ - id: string; + public get id(): string { + return null; + } + public set id(value: string) {} + /** * The type of punishment. */ - type: ActivePunishmentType; + public get type(): ActivePunishmentType { + return null; + } + public set type(value: ActivePunishmentType) {} + /** * The user who is punished. */ - user: Snowflake; + public get user(): Snowflake { + return null; + } + public set user(value: Snowflake) {} + /** * The guild they are punished in. */ - guild: Snowflake; + public get guild(): Snowflake { + return null; + } + public set guild(value: Snowflake) {} + /** * Additional info about the punishment if applicable. The channel id for channel blocks and role for punishment roles. */ - extraInfo: Snowflake; + public get extraInfo(): Snowflake { + return null; + } + public set extraInfo(value: Snowflake) {} + /** * The date when this punishment expires (optional). */ - expires: Date | null; + public get expires(): Date | null { + return null; + } + public set expires(value: Date | null) {} + /** * The reference to the modlog entry. */ - modlog: string; + public get modlog(): string { + return null; + } + public set modlog(value: string) {} static initModel(sequelize: Sequelize): void { ActivePunishment.init( diff --git a/src/lib/models/BaseModel.ts b/src/lib/models/BaseModel.ts index fdbd706..340e0aa 100644 --- a/src/lib/models/BaseModel.ts +++ b/src/lib/models/BaseModel.ts @@ -1,6 +1,17 @@ import { Model } from 'sequelize'; export abstract class BaseModel<A, B> extends Model<A, B> { - public readonly createdAt: Date; - public readonly updatedAt: Date; + /** + * The date when the row was created. + */ + public get createdAt(): Date { + return null; + } + + /** + * The date when the row was last updated. + */ + public get updatedAt(): Date { + return null; + } } diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts index e37ef2b..80f11ca 100644 --- a/src/lib/models/Global.ts +++ b/src/lib/models/Global.ts @@ -24,27 +24,51 @@ export class Global extends BaseModel<GlobalModel, GlobalModelCreationAttributes /** * The bot's environment. */ - environment: 'production' | 'development' | 'beta'; + public get environment(): 'production' | 'development' | 'beta' { + return null; + } + public set environment(value: 'production' | 'development' | 'beta') {} + /** * Trusted users. */ - superUsers: Snowflake[]; + public get superUsers(): Snowflake[] { + return null; + } + public set superUsers(value: Snowflake[]) {} + /** * Globally disabled commands. */ - disabledCommands: string[]; + public get disabledCommands(): string[] { + return null; + } + public set disabledCommands(value: string[]) {} + /** * Globally blacklisted users. */ - blacklistedUsers: Snowflake[]; + public get blacklistedUsers(): Snowflake[] { + return null; + } + public set blacklistedUsers(value: Snowflake[]) {} + /** * Guilds blacklisted from using the bot. */ - blacklistedGuilds: Snowflake[]; + public get blacklistedGuilds(): Snowflake[] { + return null; + } + public set blacklistedGuilds(value: Snowflake[]) {} + /** * Channels where the bot is prevented from running. */ - blacklistedChannels: Snowflake[]; + public get blacklistedChannels(): Snowflake[] { + return null; + } + public set blacklistedChannels(value: Snowflake[]) {} + static initModel(sequelize: Sequelize): void { Global.init( { diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 7a0384c..aac4267 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -32,17 +32,93 @@ export interface GuildModelCreationAttributes { } export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> implements GuildModel { - id!: Snowflake; - prefix!: string; - autoPublishChannels: Snowflake[]; - blacklistedChannels: Snowflake[]; - blacklistedUsers: Snowflake[]; - welcomeChannel: Snowflake; - muteRole: Snowflake; - punishmentEnding: string; - disabledCommands: string[]; - lockdownChannels: Snowflake[]; - autoModPhases: string[]; + /** + * The ID of the guild + */ + public get id(): Snowflake { + return null; + } + public set id(value: Snowflake) {} + + /** + * The bot's prefix for the guild + */ + public get prefix(): string { + return null; + } + public set prefix(value: string) {} + + /** + * Channels that will have their messages automatically published + */ + public get autoPublishChannels(): Snowflake[] { + return null; + } + public set autoPublishChannels(value: Snowflake[]) {} + + /** + * Channels where the bot won't respond in. + */ + public get blacklistedChannels(): Snowflake[] { + return null; + } + public set blacklistedChannels(value: Snowflake[]) {} + + /** + * Users that the bot ignores in this guild + */ + public get blacklistedUsers(): Snowflake[] { + return null; + } + public set blacklistedUsers(value: Snowflake[]) {} + + /** + * The channels where the welcome messages are sent + */ + public get welcomeChannel(): Snowflake { + return null; + } + public set welcomeChannel(value: Snowflake) {} + + /** + * The role given out when muting someone + */ + public get muteRole(): Snowflake { + return null; + } + public set muteRole(value: Snowflake) {} + + /** + * The message that gets sent after someone gets a punishment dm + */ + public get punishmentEnding(): string { + return null; + } + public set punishmentEnding(value: string) {} + + /** + * Guild specific disabled commands + */ + public get disabledCommands(): string[] { + return null; + } + public set disabledCommands(value: string[]) {} + + /** + * Channels that should get locked down when the lockdown command gets used. + */ + public get lockdownChannels(): Snowflake[] { + return null; + } + public set lockdownChannels(value: Snowflake[]) {} + + /** + * Custom automod phases + */ + public get autoModPhases(): string[] { + return null; + } + public set autoModPhases(value: string[]) {} static initModel(sequelize: Sequelize, client: BushClient): void { Guild.init( diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts index 755b1c6..d8b98bf 100644 --- a/src/lib/models/Level.ts +++ b/src/lib/models/Level.ts @@ -18,16 +18,28 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> { /** * The user's id. */ - public user: Snowflake; + public get user(): Snowflake { + return null; + } + public set user(value: Snowflake) {} + /** * The guild where the user is gaining xp. */ - public guild: Snowflake; + public get guild(): Snowflake { + return null; + } + public set guild(value: Snowflake) {} + /** * The user's xp. */ - public xp: number; - get level(): number { + public get xp(): number { + return null; + } + public set xp(value: number) {} + + public get level(): number { return Level.convertXpToLevel(this.xp); } diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index 3375751..6933432 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -44,31 +44,58 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes /** * The primary key of the modlog entry. */ - id: string; + public get id(): string { + return null; + } + public set id(value: string) {} + /** * The type of punishment. */ - type: ModLogType; + public get type(): ModLogType { + return null; + } + public set type(value: ModLogType) {} + /** * The user being punished. */ - user: Snowflake; + public get user(): Snowflake { + return null; + } + public set user(value: Snowflake) {} + /** * The user carrying out the punishment. */ - moderator: Snowflake; + public get moderator(): Snowflake { + return null; + } + public set moderator(value: Snowflake) {} + /** * The reason the user is getting punished */ - reason: string | null; + public get reason(): string | null { + return null; + } + public set reason(value: string | null) {} + /** * The amount of time the user is getting punished for. */ - duration: number | null; + public get duration(): number | null { + return null; + } + public set duration(value: number | null) {} + /** * The guild the user is getting punished in. */ - guild: Snowflake; + public get guild(): Snowflake { + return null; + } + public set guild(value: Snowflake) {} static initModel(sequelize: Sequelize): void { ModLog.init( diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts index a3928e7..c71ecb7 100644 --- a/src/lib/models/StickyRole.ts +++ b/src/lib/models/StickyRole.ts @@ -14,9 +14,31 @@ export interface StickyRoleModelCreationAttributes { } export class StickyRole extends BaseModel<StickyRoleModel, StickyRoleModelCreationAttributes> implements StickyRoleModel { - user: Snowflake; - guild: Snowflake; - roles: Snowflake[]; + /** + * The id of the user the roles belongs to + */ + + public get user(): Snowflake { + return null; + } + public set user(value: Snowflake) {} + + /** + * The guild where this should happen + */ + public get guild(): Snowflake { + return null; + } + public set guild(value: Snowflake) {} + + /** + * The roles that the user should have returned + */ + public get roles(): Snowflake[] { + return null; + } + public set roles(value: Snowflake[]) {} + static initModel(sequelize: Sequelize): void { StickyRole.init( { diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts index b0d1786..17249a9 100644 --- a/src/listeners/client/interactionCreate.ts +++ b/src/listeners/client/interactionCreate.ts @@ -10,7 +10,7 @@ export default class InteractionCreateListener extends BushListener { }); } - async exec(...[interaction]: ClientEvents['interactionCreate']): Promise<unknown> { + public override async exec(...[interaction]: ClientEvents['interactionCreate']): Promise<unknown> { if (!interaction) return; if (interaction.isCommand()) { void client.console.info( diff --git a/src/listeners/client/ready.ts b/src/listeners/client/ready.ts index 449ec42..39e583b 100644 --- a/src/listeners/client/ready.ts +++ b/src/listeners/client/ready.ts @@ -9,7 +9,7 @@ export default class ReadyListener extends BushListener { }); } - public async exec(): Promise<void> { + public override async exec(): Promise<void> { const tag = `<<${client.user.tag}>>`, guildCount = `<<${client.guilds.cache.size.toLocaleString()}>>`, userCount = `<<${client.users.cache.size.toLocaleString()}>>`; diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 095ce58..5d6bcfb 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -8,7 +8,7 @@ export default class CommandBlockedListener extends BushListener { }); } - public async exec(...[message, command, reason]: BushCommandHandlerEvents['commandBlocked']): Promise<unknown> { + public override async exec(...[message, command, reason]: BushCommandHandlerEvents['commandBlocked']): Promise<unknown> { return await CommandBlockedListener.handleBlocked(message, command, reason); } diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 0525fe6..22ed0c6 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -9,7 +9,7 @@ export default class CommandErrorListener extends BushListener { }); } - public async exec(...[error, message, command]: BushCommandHandlerEvents['error']): Promise<unknown> { + public override async exec(...[error, message, command]: BushCommandHandlerEvents['error']): Promise<unknown> { return await CommandErrorListener.handleError(error, message, command); } diff --git a/src/listeners/commands/commandMissingPermissions.ts b/src/listeners/commands/commandMissingPermissions.ts index 70adcd1..fdca5d3 100644 --- a/src/listeners/commands/commandMissingPermissions.ts +++ b/src/listeners/commands/commandMissingPermissions.ts @@ -9,7 +9,9 @@ export default class CommandMissingPermissionsListener extends BushListener { }); } - public async exec(...[message, command, type, missing]: BushCommandHandlerEvents['missingPermissions']): Promise<unknown> { + public override async exec( + ...[message, command, type, missing]: BushCommandHandlerEvents['missingPermissions'] + ): Promise<unknown> { return await CommandMissingPermissionsListener.handleMissing(message, command, type, missing); } diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts index bccb500..8b9c7e1 100644 --- a/src/listeners/commands/commandStarted.ts +++ b/src/listeners/commands/commandStarted.ts @@ -8,7 +8,7 @@ export default class CommandStartedListener extends BushListener { category: 'commands' }); } - exec(...[message, command]: BushCommandHandlerEvents['commandStarted']): void { + public override exec(...[message, command]: BushCommandHandlerEvents['commandStarted']): void { void client.logger.info( 'Command', `The <<${command.id}>> command was used by <<${message.author.tag}>> in ${ diff --git a/src/listeners/commands/slashBlocked.ts b/src/listeners/commands/slashBlocked.ts index bdad2ea..851cb5e 100644 --- a/src/listeners/commands/slashBlocked.ts +++ b/src/listeners/commands/slashBlocked.ts @@ -10,7 +10,7 @@ export default class SlashBlockedListener extends BushListener { }); } - public async exec(...[message, command, reason]: BushCommandHandlerEvents['slashBlocked']): Promise<unknown> { + public override async exec(...[message, command, reason]: BushCommandHandlerEvents['slashBlocked']): Promise<unknown> { return await CommandBlockedListener.handleBlocked(message, command, reason); } } diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts index 67febfd..5ab195f 100644 --- a/src/listeners/commands/slashCommandError.ts +++ b/src/listeners/commands/slashCommandError.ts @@ -9,7 +9,7 @@ export default class SlashCommandErrorListener extends BushListener { category: 'commands' }); } - async exec(...[error, message, command]: BushCommandHandlerEvents['slashError']): Promise<void> { + public override async exec(...[error, message, command]: BushCommandHandlerEvents['slashError']): Promise<void> { return await CommandErrorListener.handleError(error, message, command); } } diff --git a/src/listeners/commands/slashMissingPermissions.ts b/src/listeners/commands/slashMissingPermissions.ts index 07c63e9..a01b1fa 100644 --- a/src/listeners/commands/slashMissingPermissions.ts +++ b/src/listeners/commands/slashMissingPermissions.ts @@ -10,7 +10,7 @@ export default class SlashMissingPermissionsListener extends BushListener { }); } - public async exec( + public override async exec( ...[message, command, type, missing]: BushCommandHandlerEvents['slashMissingPermissions'] ): Promise<unknown> { return await CommandMissingPermissionsListener.handleMissing(message, command, type, missing); diff --git a/src/listeners/commands/slashStarted.ts b/src/listeners/commands/slashStarted.ts index dbb0c0d..e64df54 100644 --- a/src/listeners/commands/slashStarted.ts +++ b/src/listeners/commands/slashStarted.ts @@ -8,7 +8,7 @@ export default class SlashStartedListener extends BushListener { category: 'commands' }); } - async exec(...[message, command]: BushCommandHandlerEvents['slashStarted']): Promise<unknown> { + public override async exec(...[message, command]: BushCommandHandlerEvents['slashStarted']): Promise<unknown> { return void client.logger.info( 'SlashCommand', `The <<${command.id}>> command was used by <<${message.author.tag}>> in ${ diff --git a/src/listeners/guild/syncUnban.ts b/src/listeners/guild/syncUnban.ts index 00f260c..b1e4fd9 100644 --- a/src/listeners/guild/syncUnban.ts +++ b/src/listeners/guild/syncUnban.ts @@ -9,7 +9,7 @@ export default class SyncUnbanListener extends BushListener { }); } - public async exec(...[ban]: ClientEvents['guildBanRemove']): Promise<void> { + public override async exec(...[ban]: ClientEvents['guildBanRemove']): Promise<void> { const bans = await ActivePunishment.findAll({ where: { user: ban.user.id, diff --git a/src/listeners/message/autoPublisher.ts b/src/listeners/message/autoPublisher.ts index 3941371..a1d61f7 100644 --- a/src/listeners/message/autoPublisher.ts +++ b/src/listeners/message/autoPublisher.ts @@ -10,7 +10,7 @@ export default class autoPublisherListener extends BushListener { }); } - public async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { + public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { if (!message.guild) return; const autoPublishChannels = await message.guild.getSetting('autoPublishChannels'); if (autoPublishChannels) { diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts index c2db29a..af9bb10 100644 --- a/src/listeners/message/automodCreate.ts +++ b/src/listeners/message/automodCreate.ts @@ -13,7 +13,7 @@ export default class AutomodMessageCreateListener extends BushListener { }); } - async exec(...[message]: BushClientEvents['messageCreate']): Promise<unknown> { + public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<unknown> { return await AutomodMessageCreateListener.automod(message); } diff --git a/src/listeners/message/automodUpdate.ts b/src/listeners/message/automodUpdate.ts index 7b9e01a..2dd86a2 100644 --- a/src/listeners/message/automodUpdate.ts +++ b/src/listeners/message/automodUpdate.ts @@ -12,7 +12,7 @@ export default class AutomodMessageUpdateListener extends BushListener { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - async exec(...[_, newMessage]: BushClientEvents['messageUpdate']): Promise<unknown> { + public override async exec(...[_, newMessage]: BushClientEvents['messageUpdate']): Promise<unknown> { const fullMessage = newMessage.partial ? await newMessage.fetch() : (newMessage as BushMessage); return await AutomodMessageCreateListener.automod(fullMessage); } diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts index 93ed7b7..741b508 100644 --- a/src/listeners/message/blacklistedFile.ts +++ b/src/listeners/message/blacklistedFile.ts @@ -65,7 +65,7 @@ export default class BlacklistedFileListener extends BushListener { }); } - public async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { + public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { const guildWhitelist = [ client.consts.mappings.guilds.bush, client.consts.mappings.guilds.tree, diff --git a/src/listeners/message/booster.ts b/src/listeners/message/booster.ts index a042ad1..e57b8ea 100644 --- a/src/listeners/message/booster.ts +++ b/src/listeners/message/booster.ts @@ -10,7 +10,7 @@ export default class BoosterMessageListener extends BushListener { }); } - public async exec(...[message]: BushClientEvents['messageCreate']): Promise<unknown> { + public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<unknown> { if (message.type === 'USER_PREMIUM_GUILD_SUBSCRIPTION' && message.guild.id === this.client.consts.mappings.guilds.bush) { return await message.react('<:nitroboost:785160348885975062>').catch(() => { void this.client.console.warn('BoosterMessage', `Failed to react to <<${message.id}>>.`); diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index 3dc84ab..55180b1 100644 --- a/src/listeners/message/directMessage.ts +++ b/src/listeners/message/directMessage.ts @@ -11,7 +11,7 @@ export default class DirectMessageListener extends BushListener { }); } - public async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { + public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { if (message.channel.type === 'DM') { if (!(message.author.id == this.client.user.id) && message.author.bot) return; const dmLogEmbed = new MessageEmbed().setTimestamp().setFooter(`User ID • ${message.author.id}`); diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts index e8edfcf..db4be4b 100644 --- a/src/listeners/message/level.ts +++ b/src/listeners/message/level.ts @@ -11,7 +11,7 @@ export default class LevelListener extends BushListener { category: 'message' }); } - async exec(...[message]: BushCommandHandlerEvents['messageInvalid']): Promise<void> { + public override async exec(...[message]: BushCommandHandlerEvents['messageInvalid']): Promise<void> { if (message.author.bot) return; if (!message.author) return; if (!message.guild) return; diff --git a/src/listeners/message/verbose.ts b/src/listeners/message/verbose.ts index 45bf1de..632a22f 100644 --- a/src/listeners/message/verbose.ts +++ b/src/listeners/message/verbose.ts @@ -10,7 +10,7 @@ export default class MessageVerboseListener extends BushListener { }); } - public exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { + public override exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { if (message.channel?.type === 'DM') return; void this.client.console.verbose( 'Message', diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts index 6d548ba..4b3a6bd 100644 --- a/src/listeners/other/consoleListener.ts +++ b/src/listeners/other/consoleListener.ts @@ -12,7 +12,7 @@ export default class ConsoleListener extends BushListener { }); } - public async exec(line: string): Promise<void> { + public override async exec(line: string): Promise<void> { if (line.startsWith('eval ') || line.startsWith('ev ')) { const sh = promisify(exec), bot = client, diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts index e0a62c0..f2623c6 100644 --- a/src/listeners/other/promiseRejection.ts +++ b/src/listeners/other/promiseRejection.ts @@ -8,7 +8,7 @@ export default class PromiseRejectionListener extends BushListener { }); } - public async exec(error: Error): Promise<void> { + public override async exec(error: Error): Promise<void> { void client.console.error('PromiseRejection', `An unhanded promise rejection occurred:\n${error?.stack || error}`, false); void client.console.channelError({ embeds: [ diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts index f1714f7..76afab9 100644 --- a/src/listeners/other/uncaughtException.ts +++ b/src/listeners/other/uncaughtException.ts @@ -8,7 +8,7 @@ export default class UncaughtExceptionListener extends BushListener { }); } - public async exec(error: Error): Promise<void> { + public override async exec(error: Error): Promise<void> { void client.console.error('uncaughtException', `An uncaught exception occurred:\n${error?.stack || error}`, false); void client.console.channelError({ embeds: [ diff --git a/src/tasks/removeExpiredPunishements.ts b/src/tasks/removeExpiredPunishements.ts index fc3708d..3d7528b 100644 --- a/src/tasks/removeExpiredPunishements.ts +++ b/src/tasks/removeExpiredPunishements.ts @@ -1,4 +1,4 @@ -import { BushGuild, BushGuildMember, BushTask } from '@lib'; +import { BushGuild, BushTask } from '@lib'; import { Op } from 'sequelize'; import { ActivePunishment, ActivePunishmentType } from '../lib/models/ActivePunishment'; @@ -9,7 +9,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask { runOnStart: true }); } - async exec(): Promise<void> { + public override async exec(): Promise<void> { const expiredEntries = await ActivePunishment.findAll({ where: { [Op.and]: [ @@ -29,7 +29,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask { for (const entry of expiredEntries) { const guild = client.guilds.cache.get(entry.guild) as BushGuild; - const member = guild.members.cache.get(entry.user) as BushGuildMember; + const member = guild.members.cache.get(entry.user); if (!guild) { await entry.destroy(); diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index 9ca7926..95ceca1 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -11,7 +11,7 @@ export class UpdateCacheTask extends BushTask { runOnStart: false // done in preinit task }); } - public async exec(): Promise<void> { + public override async exec(): Promise<void> { await UpdateCacheTask.updateGlobalCache(client); await UpdateCacheTask.updateGuildCache(client); void client.logger.verbose(`UpdateCache`, `Updated cache.`); diff --git a/tsconfig.json b/tsconfig.json index b063dad..5368567 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ "experimentalDecorators": true, "emitDecoratorMetadata": true, "resolveJsonModule": true, + "noImplicitOverride": true, "baseUrl": "./", "paths": { "src/*": ["./src/*"], @@ -61,10 +61,10 @@ __metadata: languageName: node linkType: hard -"@discordjs/collection@npm:^0.2.0": - version: 0.2.0 - resolution: "@discordjs/collection@npm:0.2.0" - checksum: 4f9fc995ca81eb981aa9a8c081f46da831db9cea69727f3f6a6b7690c30d237eb64b758c1fc3f3510a403cb55dce8aa618133a43391f241b218ac817abe1780b +"@discordjs/collection@npm:^0.2.1": + version: 0.2.1 + resolution: "@discordjs/collection@npm:0.2.1" + checksum: e68d4bbf83b03bc18c7648d0f5c5669d1f1a394596bc2fcbb907284cff65657b28dbf165a1b8ccae20b6bc0726bc8a0a276d8adba8f9413502bb19d61b98598f languageName: node linkType: hard @@ -825,7 +825,7 @@ __metadata: sequelize: ^6.5.0 source-map-support: ^0.5.19 tinycolor2: ^1.4.2 - typescript: 4.2.4 + typescript: ^4.3.5 uuid: ^8.3.2 languageName: unknown linkType: soft @@ -1335,8 +1335,8 @@ __metadata: discord-akairo@NotEnoughUpdates/discord-akairo: version: 8.2.2 - resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=c2618f883533b95741fdffc920f07728385be973" - checksum: dd754c904e6f872664a74609f0521d5949ca2503ae4dde5972808928f240b3ca981751f2d2e98c30fd6c62ce13959d633e3f7e7e02771cb05507a6cf46548ee3 + resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=746c4137954c8582a6616c3c1672340661391dbf" + checksum: 563932ada8d9ddc85e2e954289bb7cab3c7dcbddf0a22b52d02b26d4ecf0ddc7e172c4316b405d85cf006185518e0442c6273b880666069bdf5961b9f251c91b languageName: node linkType: hard @@ -1363,10 +1363,10 @@ discord-akairo@NotEnoughUpdates/discord-akairo: discord.js@NotEnoughUpdates/discord.js: version: 13.0.0-dev - resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=c453840a652e054e92d521106a1dec1255990511" + resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=9db7fcc931d5cd1ef57fa5ee61e5fc2072dc1822" dependencies: "@discordjs/builders": ^0.2.0 - "@discordjs/collection": ^0.2.0 + "@discordjs/collection": ^0.2.1 "@discordjs/form-data": ^3.0.1 "@sapphire/async-queue": ^1.1.4 "@types/ws": ^7.4.5 @@ -1374,7 +1374,7 @@ discord.js@NotEnoughUpdates/discord.js: discord-api-types: ^0.21.0 node-fetch: ^2.6.1 ws: ^7.5.1 - checksum: 67f91118eb0d8ed90017dfb096377555c6df5bc2be1d7af70caaf02b3ddaffd10965da2454a887363e5f00a3d9c9ebb1d8a6d638c6946f7592d99dd217a50e21 + checksum: 638680bfa8c5e3dd6fd0c22d68bddf190211e4c0e18cf833e68a51a84e9a9419b52616ae146e95546e750cd8a4243c813e54ec6df16777ecb1e36e1e8071a6f1 languageName: node linkType: hard @@ -4015,16 +4015,6 @@ resolve@^1.19.0: languageName: node linkType: hard -typescript@4.2.4: - version: 4.2.4 - resolution: "typescript@npm:4.2.4" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 89c397df192f239359ad798b96d8e8d552e12c0c189ac5676cec4c20c410d6eec636b8e59a88f2aef0a56d961a9678d99c400099be9b7cae2f7b062eb4b7b171 - languageName: node - linkType: hard - "typescript@^3.9.5, typescript@^3.9.7": version: 3.9.10 resolution: "typescript@npm:3.9.10" @@ -4035,13 +4025,13 @@ typescript@4.2.4: languageName: node linkType: hard -"typescript@patch:typescript@4.2.4#~builtin<compat/typescript>": - version: 4.2.4 - resolution: "typescript@patch:typescript@npm%3A4.2.4#~builtin<compat/typescript>::version=4.2.4&hash=d8b4e7" +typescript@^4.3.5: + version: 4.3.5 + resolution: "typescript@npm:4.3.5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 3d8ac56cd91f6f60e69aff212cb3601c8affd8dd7b3fac115b836b7d59ab8c7b21778635f07971cbcb6035019df1abefe3047c1d46f3d42d087ceb0552af0206 + checksum: bab033b5e2b0790dd35b77fd005df976ef80b8d84fd2c6e63cc31808151875beae9216e5a315fe7068e8499905c3c354248fe83272cdfc13b7705635f0c66c97 languageName: node linkType: hard @@ -4055,6 +4045,16 @@ typescript@4.2.4: languageName: node linkType: hard +"typescript@patch:typescript@^4.3.5#~builtin<compat/typescript>": + version: 4.3.5 + resolution: "typescript@patch:typescript@npm%3A4.3.5#~builtin<compat/typescript>::version=4.3.5&hash=d8b4e7" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: bc2c4fdf0f1557fdafe4ef74848c72ebd9c8c60829568248f869121aea2bb20e16649a252431d0acb185ec118143be22bed73d08f64379557810d82756afedde + languageName: node + linkType: hard + "underscore@npm:^1.13.1": version: 1.13.1 resolution: "underscore@npm:1.13.1" |