diff options
Diffstat (limited to 'src/commands')
25 files changed, 90 insertions, 91 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index 00d37c3..c397855 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -78,7 +78,7 @@ export default class ChannelPermissionsCommand extends BushCommand { { reason: 'Changing overwrites for mass channel channel perms command' } ); } catch (e) { - this.client.console.debug(e.stack); + client.console.debug(e.stack); failedChannels.push(channel); } } diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index 33bff35..8093d83 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -69,16 +69,16 @@ export default class BlacklistCommand extends BushCommand { const global = args.global && message.author.isOwner(); const target = typeof args.target === 'string' - ? (await Argument.cast('channel', this.client.commandHandler.resolver, message as BushMessage, args.target)) ?? - (await Argument.cast('user', this.client.commandHandler.resolver, message as BushMessage, args.target)) + ? (await Argument.cast('channel', client.commandHandler.resolver, message as BushMessage, args.target)) ?? + (await Argument.cast('user', client.commandHandler.resolver, message as BushMessage, args.target)) : args.target; if (!target) return await message.util.reply(`${util.emojis.error} Choose a valid channel or user.`); const targetID = target.id; if (global) { if (action === 'toggle') { - const blacklistedUsers = (await Global.findByPk(this.client.config.environment)).blacklistedUsers; - const blacklistedChannels = (await Global.findByPk(this.client.config.environment)).blacklistedChannels; + const blacklistedUsers = (await Global.findByPk(client.config.environment)).blacklistedUsers; + const blacklistedChannels = (await Global.findByPk(client.config.environment)).blacklistedChannels; action = blacklistedUsers.includes(targetID) || blacklistedChannels.includes(targetID) ? 'unblacklist' : 'blacklist'; } const success = await util diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index 27e7311..41ca8a4 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -72,7 +72,7 @@ export default class DisableCommand extends BushCommand { if (global) { if (action === 'toggle') { - const disabledCommands = (await Global.findByPk(this.client.config.environment)).disabledCommands; + const disabledCommands = (await Global.findByPk(client.config.environment)).disabledCommands; action = disabledCommands.includes(commandID) ? 'disable' : 'enable'; } const success = await util diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts index 26ae5c4..9c1ce92 100644 --- a/src/commands/config/prefix.ts +++ b/src/commands/config/prefix.ts @@ -38,7 +38,7 @@ export default class PrefixCommand extends BushCommand { async exec(message: BushMessage | BushSlashMessage, args: { prefix?: string }): Promise<unknown> { const oldPrefix = await message.guild.getSetting('prefix'); - await message.guild.setSetting('prefix', args.prefix ?? this.client.config.prefix); + await message.guild.setSetting('prefix', args.prefix ?? client.config.prefix); if (args.prefix) { return await message.util.send({ content: `${util.emojis.success} changed the server's prefix ${oldPrefix ? `from \`${oldPrefix}\`` : ''} to \`${ @@ -48,7 +48,7 @@ export default class PrefixCommand extends BushCommand { }); } else { return await message.util.send({ - content: `${util.emojis.success} reset the server's prefix to \`${this.client.config.prefix}\`.`, + content: `${util.emojis.success} reset the server's prefix to \`${client.config.prefix}\`.`, allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 3966499..abdf2b9 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -80,13 +80,13 @@ export default class EvalCommand extends BushCommand { const sh = promisify(exec), me = message.member, member = message.member, - bot = this.client, + bot = client, guild = message.guild, channel = message.channel, - config = this.client.config, + config = client.config, members = message.guild?.members, roles = message.guild?.roles, - client = this.client, + client = client, emojis = util.emojis, colors = util.colors, util = util, diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index c930118..2be67fa 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -39,12 +39,12 @@ export default class ReloadCommand extends BushCommand { try { const s = new Date(); output = await util.shell(`yarn build-${fast ? 'esbuild' : 'tsc'}`); - this.client.commandHandler.reloadAll(); - this.client.listenerHandler.reloadAll(); - this.client.inhibitorHandler.reloadAll(); + client.commandHandler.reloadAll(); + client.listenerHandler.reloadAll(); + client.inhibitorHandler.reloadAll(); return message.util.send(`🔁 Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`); } catch (e) { - if (output) await this.client.logger.error('reloadCommand', output); + if (output) await client.logger.error('reloadCommand', output); return message.util.send(`An error occurred while reloading:\n${await util.codeblock(e?.stack || e, 2048 - 34, 'js')}`); } } diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts index 62ec96a..5042be4 100644 --- a/src/commands/dev/say.ts +++ b/src/commands/dev/say.ts @@ -37,7 +37,7 @@ export default class SayCommand extends BushCommand { } public async execSlash(message: AkairoMessage, { content }: { content: string }): Promise<unknown> { - if (!this.client.config.owners.includes(message.author.id)) { + if (!client.config.owners.includes(message.author.id)) { return await message.interaction.reply({ content: `${util.emojis.error} Only my developers can run this command.`, ephemeral: true diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index c1bfdb7..dc4562c 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -19,7 +19,7 @@ export default class ServersCommand extends BushCommand { public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { const maxLength = 10; - const guilds = this.client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).array(); + const guilds = client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).array(); const chunkedGuilds: Guild[][] = []; const embeds: MessageEmbed[] = []; @@ -30,14 +30,14 @@ export default class ServersCommand extends BushCommand { chunkedGuilds.forEach((c: Guild[]) => { const embed = new MessageEmbed(); c.forEach((g: Guild) => { - const owner = this.client.users.cache.get(g.ownerId)?.tag; + const owner = client.users.cache.get(g.ownerId)?.tag; embed .addField( `**${g.name}**`, `**ID:** ${g.id}\n**Owner:** ${owner ? owner : g.ownerId}\n**Members:** ${g.memberCount.toLocaleString()}`, false ) - .setTitle(`Server List [${this.client.guilds.cache.size}]`) + .setTitle(`Server List [${client.guilds.cache.size}]`) .setColor(util.colors.default); }); embeds.push(embed); diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index acbbfdc..ed1dfd7 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -38,7 +38,7 @@ export default class ShCommand extends BushCommand { } public async exec(message: BushMessage | BushSlashMessage, { command }: { command: string }): Promise<unknown> { - if (!this.client.config.owners.includes(message.author.id)) + 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 cc1519f..9071a8d 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -43,7 +43,7 @@ export default class SuperUserCommand extends BushCommand { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); - const superUsers = (await Global.findByPk(this.client.config.environment)).superUsers; + const superUsers = (await Global.findByPk(client.config.environment)).superUsers; let success; if (args.action === 'add') { if (superUsers.includes(args.user.id)) { diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index f7edda2..3a27be0 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -128,7 +128,7 @@ export default class TestCommand extends BushCommand { return await message.util.reply({ content: 'this is content', components: ButtonRows, embeds }); } else if (['delete slash commands'].includes(args?.feature?.toLowerCase())) { // let guildCommandCount = 0; - // this.client.guilds.cache.forEach(guild => + // client.guilds.cache.forEach(guild => // guild.commands.fetch().then(commands => { // commands.forEach(async command => { // await command.delete(); @@ -138,7 +138,7 @@ export default class TestCommand extends BushCommand { // ); const guildCommands = await message.guild.commands.fetch(); guildCommands.forEach(async (command) => await command.delete()); - const globalCommands = await this.client.application.commands.fetch(); + const globalCommands = await client.application.commands.fetch(); globalCommands.forEach(async (command) => await command.delete()); return await message.util.reply( diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 29ed29a..e47984b 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -18,21 +18,21 @@ export default class BotInfoCommand extends BushCommand { } public async exec(message: BushMessage | BushSlashMessage): Promise<void> { - const developers = (await util.mapIDs(this.client.config.owners)).map((u) => u?.tag).join('\n'); + 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', ''); repoUrl = repoUrl.substring(0, repoUrl.length - 4); const embed = new MessageEmbed() .setTitle('Bot Info:') - .addField('**Uptime**', util.humanizeDuration(this.client.uptime), true) - .addField('**Servers**', this.client.guilds.cache.size.toLocaleString(), true) - .addField('**Users**', this.client.users.cache.size.toLocaleString(), true) + .addField('**Uptime**', util.humanizeDuration(client.uptime), true) + .addField('**Servers**', client.guilds.cache.size.toLocaleString(), true) + .addField('**Users**', client.users.cache.size.toLocaleString(), true) .addField('**Discord.js Version**', discordJSVersion, true) .addField('**Node.js Version**', process.version.slice(1), true) - .addField('**Commands**', this.client.commandHandler.modules.size.toLocaleString(), true) - .addField('**Listeners**', this.client.listenerHandler.modules.size.toLocaleString(), true) - .addField('**Inhibitors**', this.client.inhibitorHandler.modules.size.toLocaleString(), true) - .addField('**Tasks**', this.client.taskHandler.modules.size.toLocaleString(), true) + .addField('**Commands**', client.commandHandler.modules.size.toLocaleString(), true) + .addField('**Listeners**', client.listenerHandler.modules.size.toLocaleString(), true) + .addField('**Inhibitors**', client.inhibitorHandler.modules.size.toLocaleString(), true) + .addField('**Tasks**', client.taskHandler.modules.size.toLocaleString(), true) .addField('**Current Commit**', `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, true) .addField('**Developers**', developers, true) .setTimestamp() diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 2e541f3..e82a5fe 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -47,7 +47,7 @@ export default class GuildInfoCommand extends BushCommand { } let isPreview = false; if (['bigint', 'number', 'string'].includes(typeof args?.guild)) { - const preview = await this.client.fetchGuildPreview(`${args.guild}` as Snowflake).catch(() => {}); + const preview = await client.fetchGuildPreview(`${args.guild}` as Snowflake).catch(() => {}); if (preview) { args.guild = preview; isPreview = true; @@ -60,31 +60,31 @@ export default class GuildInfoCommand extends BushCommand { const guildAbout: string[] = []; // const guildSecurity = []; if (['516977525906341928', '784597260465995796', '717176538717749358', '767448775450820639'].includes(guild.id)) - emojis.push(this.client.consts.mappings.otherEmojis.BUSH_VERIFIED); + emojis.push(client.consts.mappings.otherEmojis.BUSH_VERIFIED); if (!isPreview && guild instanceof Guild) { - if (guild.premiumTier) emojis.push(this.client.consts.mappings.otherEmojis['BOOST_' + guild.premiumTier]); + if (guild.premiumTier) emojis.push(client.consts.mappings.otherEmojis['BOOST_' + guild.premiumTier]); await guild.fetch(); const channelTypes = [ - `${this.client.consts.mappings.otherEmojis.TEXT} ${guild.channels.cache + `${client.consts.mappings.otherEmojis.TEXT} ${guild.channels.cache .filter((channel) => channel.type === 'GUILD_TEXT') .size.toLocaleString()}`, - `${this.client.consts.mappings.otherEmojis.NEWS} ${guild.channels.cache + `${client.consts.mappings.otherEmojis.NEWS} ${guild.channels.cache .filter((channel) => channel.type === 'GUILD_NEWS') .size.toLocaleString()}`, - `${this.client.consts.mappings.otherEmojis.VOICE} ${guild.channels.cache + `${client.consts.mappings.otherEmojis.VOICE} ${guild.channels.cache .filter((channel) => channel.type === 'GUILD_VOICE') .size.toLocaleString()}`, - `${this.client.consts.mappings.otherEmojis.STAGE} ${guild.channels.cache + `${client.consts.mappings.otherEmojis.STAGE} ${guild.channels.cache .filter((channel) => channel.type === 'GUILD_STAGE_VOICE') .size.toLocaleString()}`, - `${this.client.consts.mappings.otherEmojis.STORE} ${guild.channels.cache + `${client.consts.mappings.otherEmojis.STORE} ${guild.channels.cache .filter((channel) => channel.type === 'GUILD_STORE') .size.toLocaleString()}`, - `${this.client.consts.mappings.otherEmojis.CATEGORY} ${guild.channels.cache + `${client.consts.mappings.otherEmojis.CATEGORY} ${guild.channels.cache .filter((channel) => channel.type === 'GUILD_CATEGORY') .size.toLocaleString()}`, - `${this.client.consts.mappings.otherEmojis.THREAD} ${guild.channels.cache + `${client.consts.mappings.otherEmojis.THREAD} ${guild.channels.cache .filter((channel) => ['GUILD_NEWS_THREAD', 'GUILD_PUBLIC_THREAD', 'GUILD_PRIVATE_THREAD', 'GUILD_STAGE_VOICE'].includes(channel.type) ) @@ -125,8 +125,8 @@ export default class GuildInfoCommand extends BushCommand { } const guildFeatures = guild.features.sort((a, b) => { - const aWeight = this.client.consts.mappings.features[a]?.weight; - const bWeight = this.client.consts.mappings.features[b]?.weight; + const aWeight = client.consts.mappings.features[a]?.weight; + const bWeight = client.consts.mappings.features[b]?.weight; if (aWeight != undefined && bWeight != undefined) { return aWeight - bWeight; @@ -138,10 +138,10 @@ export default class GuildInfoCommand extends BushCommand { }); if (guildFeatures.length) { guildFeatures.forEach((feature) => { - if (this.client.consts.mappings.features[feature]?.emoji) { - emojis.push(`${this.client.consts.mappings.features[feature].emoji}`); - } else if (this.client.consts.mappings.features[feature]?.name) { - emojis.push(`\`${this.client.consts.mappings.features[feature].name}\``); + if (client.consts.mappings.features[feature]?.emoji) { + emojis.push(`${client.consts.mappings.features[feature].emoji}`); + } else if (client.consts.mappings.features[feature]?.name) { + emojis.push(`\`${client.consts.mappings.features[feature].name}\``); } else { emojis.push(`\`${feature}\``); } diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index a644755..458b7d0 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -47,24 +47,24 @@ export default class HelpCommand extends BushCommand { message: BushMessage | BushSlashMessage, args: { command: BushCommand | string; showHidden?: boolean } ): Promise<unknown> { - const prefix = this.client.config.isDevelopment ? 'dev ' : message.util.parsed.prefix; + const prefix = client.config.isDevelopment ? 'dev ' : message.util.parsed.prefix; const row = new MessageActionRow(); - if (!this.client.config.isDevelopment && !this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { + if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { row.addComponents( new MessageButton({ style: 'LINK', label: 'Invite Me', - url: `https://discord.com/api/oauth2/authorize?client_id=${this.client.user.id}&permissions=2147483647&scope=bot%20applications.commands` + url: `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=2147483647&scope=bot%20applications.commands` }) ); } - if (!this.client.guilds.cache.get(this.client.config.supportGuild.id).members.cache.has(message.author.id)) { + if (!client.guilds.cache.get(client.config.supportGuild.id).members.cache.has(message.author.id)) { row.addComponents( new MessageButton({ style: 'LINK', label: 'Support Server', - url: this.client.config.supportGuild.invite + url: client.config.supportGuild.invite }) ); } @@ -76,11 +76,11 @@ export default class HelpCommand extends BushCommand { }) ); - const isOwner = this.client.isOwner(message.author); - const isSuperUser = this.client.isSuperUser(message.author); + const isOwner = client.isOwner(message.author); + const isSuperUser = client.isSuperUser(message.author); const command = args.command ? typeof args.command === 'string' - ? this.client.commandHandler.modules.get(args.command) || null + ? client.commandHandler.modules.get(args.command) || null : args.command : null; if (!isOwner) args.showHidden = false; diff --git a/src/commands/info/invite.ts b/src/commands/info/invite.ts index 1f65cdc..a2128b3 100644 --- a/src/commands/info/invite.ts +++ b/src/commands/info/invite.ts @@ -19,13 +19,12 @@ export default class InviteCommand extends BushCommand { } public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { - if (this.client.config.isDevelopment) - return await message.util.reply(`${util.emojis.error} The dev bot cannot be invited.`); + 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({ style: 'LINK', label: 'Invite Me', - url: `https://discord.com/api/oauth2/authorize?client_id=${this.client.user.id}&permissions=2147483647&scope=bot%20applications.commands` + url: `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=2147483647&scope=bot%20applications.commands` }) ); return await message.util.reply({ content: 'You can invite me here:', components: [ButtonRow] }); diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 36f3bc7..550c3c7 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -40,7 +40,7 @@ export default class PingCommand extends BushCommand { await message.interaction.reply('Pong!'); const timestamp2 = await message.interaction.fetchReply().then((m) => (m as Message).createdTimestamp); const botLatency = `${'```'}\n ${Math.round(timestamp2 - timestamp1)}ms ${'```'}`; - const apiLatency = `${'```'}\n ${Math.round(this.client.ws.ping)}ms ${'```'}`; + const apiLatency = `${'```'}\n ${Math.round(client.ws.ping)}ms ${'```'}`; const embed = new MessageEmbed() .setTitle('Pong! 🏓') .addField('Bot Latency', botLatency, true) diff --git a/src/commands/info/snowflakeInfo.ts b/src/commands/info/snowflakeInfo.ts index b32245c..b6b9e16 100644 --- a/src/commands/info/snowflakeInfo.ts +++ b/src/commands/info/snowflakeInfo.ts @@ -57,8 +57,8 @@ export default class SnowflakeInfoCommand extends BushCommand { const snowflakeEmbed = new MessageEmbed().setTitle('Unknown :snowflake:').setColor(util.colors.default); // Channel - if (this.client.channels.cache.has(snowflake)) { - const channel: Channel = this.client.channels.cache.get(snowflake); + if (client.channels.cache.has(snowflake)) { + const channel: Channel = client.channels.cache.get(snowflake); const channelInfo = [`**Type:** ${channel.type}`]; if (['dm', 'group'].includes(channel.type)) { const _channel = channel as DMChannel; @@ -88,11 +88,11 @@ export default class SnowflakeInfoCommand extends BushCommand { } // Guild - else if (this.client.guilds.cache.has(snowflake)) { - const guild: Guild = this.client.guilds.cache.get(snowflake); + else if (client.guilds.cache.has(snowflake)) { + const guild: Guild = client.guilds.cache.get(snowflake); const guildInfo = [ `**Name:** ${guild.name}`, - `**Owner:** ${this.client.users.cache.get(guild.ownerId)?.tag || '¯\\_(ツ)_/¯'} (${guild.ownerId})`, + `**Owner:** ${client.users.cache.get(guild.ownerId)?.tag || '¯\\_(ツ)_/¯'} (${guild.ownerId})`, `**Members:** ${guild.memberCount?.toLocaleString()}` ]; snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048, dynamic: true })); @@ -101,8 +101,8 @@ export default class SnowflakeInfoCommand extends BushCommand { } // User - else if (this.client.users.cache.has(snowflake)) { - const user: User = this.client.users.cache.get(snowflake); + else if (client.users.cache.has(snowflake)) { + const user: User = client.users.cache.get(snowflake); const userInfo = [`**Name:** <@${user.id}> (${user.tag})`]; snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048, dynamic: true })); snowflakeEmbed.addField('» User Info', userInfo.join('\n')); @@ -110,8 +110,8 @@ export default class SnowflakeInfoCommand extends BushCommand { } // Emoji - else if (this.client.emojis.cache.has(snowflake)) { - const emoji: Emoji = this.client.emojis.cache.get(snowflake); + else if (client.emojis.cache.has(snowflake)) { + const emoji: Emoji = client.emojis.cache.get(snowflake); const emojiInfo = [`**Name:** ${emoji.name}`, `**Animated:** ${emoji.animated}`]; snowflakeEmbed.setThumbnail(emoji.url); snowflakeEmbed.addField('» Emoji Info', emojiInfo.join('\n')); diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 5cfc6f0..87235a9 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -44,7 +44,7 @@ export default class UserInfoCommand extends BushCommand { public async exec(message: BushMessage | BushSlashMessage, args: { user: GuildMember }): Promise<unknown> { const user = args?.user || message.member; const emojis = []; - const superUsers = this.client.cache.global.superUsers; + const superUsers = client.cache.global.superUsers; const userEmbed: MessageEmbed = new MessageEmbed() .setTitle(user.user.tag) @@ -52,13 +52,13 @@ export default class UserInfoCommand extends BushCommand { .setTimestamp(); // Flags - if (this.client.config.owners.includes(user.id)) emojis.push(this.client.consts.mappings.otherEmojis.DEVELOPER); - if (superUsers.includes(user.id)) emojis.push(this.client.consts.mappings.otherEmojis.SUPERUSER); + if (client.config.owners.includes(user.id)) emojis.push(client.consts.mappings.otherEmojis.DEVELOPER); + if (superUsers.includes(user.id)) emojis.push(client.consts.mappings.otherEmojis.SUPERUSER); const flags = user.user.flags?.toArray(); if (flags) { flags.forEach((f) => { - if (this.client.consts.mappings.userFlags[f]) { - emojis.push(this.client.consts.mappings.userFlags[f]); + if (client.consts.mappings.userFlags[f]) { + emojis.push(client.consts.mappings.userFlags[f]); } else emojis.push(f); }); } @@ -66,16 +66,16 @@ export default class UserInfoCommand extends BushCommand { // Since discord bald I just guess if someone has nitro if ( Number(user.user.discriminator) < 10 || - this.client.consts.mappings.maybeNitroDiscrims.includes(user.user.discriminator) || + client.consts.mappings.maybeNitroDiscrims.includes(user.user.discriminator) || user.user.displayAvatarURL({ dynamic: true })?.endsWith('.gif') || user.user.flags?.toArray().includes('PARTNERED_SERVER_OWNER') ) { - emojis.push(this.client.consts.mappings.otherEmojis.NITRO); + emojis.push(client.consts.mappings.otherEmojis.NITRO); } - if (message.guild.ownerId == user.id) emojis.push(this.client.consts.mappings.otherEmojis.OWNER); - else if (user.permissions.has('ADMINISTRATOR')) emojis.push(this.client.consts.mappings.otherEmojis.ADMIN); - if (user.premiumSinceTimestamp) emojis.push(this.client.consts.mappings.otherEmojis.BOOSTER); + if (message.guild.ownerId == user.id) emojis.push(client.consts.mappings.otherEmojis.OWNER); + else if (user.permissions.has('ADMINISTRATOR')) emojis.push(client.consts.mappings.otherEmojis.ADMIN); + if (user.premiumSinceTimestamp) emojis.push(client.consts.mappings.otherEmojis.BOOSTER); const createdAt = user.user.createdAt.toLocaleString(), createdAtDelta = moment(moment(user.user.createdAt).diff(moment())).toLocaleString(), @@ -100,11 +100,11 @@ export default class UserInfoCommand extends BushCommand { ); if (premiumSince) serverUserInfo.push(`**Boosting Since:** ${premiumSince} (${premiumSinceDelta} ago)`); if (user.displayHexColor) serverUserInfo.push(`**Display Color:** ${user.displayHexColor}`); - if (user.id == '322862723090219008' && message.guild.id == this.client.consts.mappings.guilds.bush) + if (user.id == '322862723090219008' && message.guild.id == client.consts.mappings.guilds.bush) serverUserInfo.push(`**General Deletions:** 2`); if ( ['384620942577369088', '496409778822709251'].includes(user.id) && - message.guild.id == this.client.consts.mappings.guilds.bush + message.guild.id == client.consts.mappings.guilds.bush ) serverUserInfo.push(`**General Deletions:** 1`); if (user.nickname) serverUserInfo.push(`**Nickname** ${user.nickname}`); @@ -141,8 +141,8 @@ export default class UserInfoCommand extends BushCommand { perms.push('`Administrator`'); } else { user.permissions.toArray(true).forEach((permission) => { - if (this.client.consts.mappings.permissions[permission]?.important) { - perms.push(`\`${this.client.consts.mappings.permissions[permission].name}\``); + if (client.consts.mappings.permissions[permission]?.important) { + perms.push(`\`${client.consts.mappings.permissions[permission].name}\``); } }); } diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 27a0ffc..3736165 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -105,7 +105,7 @@ export default class BanCommand extends BushCommand { if (reason) { time = typeof reason === 'string' - ? await Argument.cast('duration', this.client.commandHandler.resolver, message as BushMessage, reason) + ? await Argument.cast('duration', client.commandHandler.resolver, message as BushMessage, reason) : reason.duration; } const parsedReason = reason.contentWithoutTime; diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 0b10ee1..779f60d 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -75,7 +75,7 @@ export default class MuteCommand extends BushCommand { if (reason) { time = typeof reason === 'string' - ? await Argument.cast('duration', this.client.commandHandler.resolver, message as BushMessage, reason) + ? await Argument.cast('duration', client.commandHandler.resolver, message as BushMessage, reason) : reason.duration; } const parsedReason = reason.contentWithoutTime; diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index 63fb3a2..fe8724d 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -95,7 +95,7 @@ export default class RoleCommand extends BushCommand { { action, user, role, duration }: { action: 'add' | 'remove'; user: BushGuildMember; role: BushRole; duration: number } ): Promise<unknown> { if (!message.member.permissions.has('MANAGE_ROLES')) { - const mappings = this.client.consts.mappings; + const mappings = client.consts.mappings; let mappedRole: { name: string; id: string }; for (let i = 0; i < mappings.roleMap.length; i++) { const a = mappings.roleMap[i]; diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 019e545..f9ffbab 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -61,7 +61,7 @@ export default class SlowModeCommand extends BushCommand { if (length) { length = typeof length === 'string' && !['off', 'none', 'disable'].includes(length) - ? await Argument.cast('duration', this.client.commandHandler.resolver, message as BushMessage, length) + ? await Argument.cast('duration', client.commandHandler.resolver, message as BushMessage, length) : length; } diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index 26878d9..8aa9ef0 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -53,7 +53,7 @@ export default class UnbanCommand extends BushCommand { } async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: User; reason?: string }): Promise<unknown> { if (!(user instanceof User)) { - user = util.resolveUser(user, this.client.users.cache); + user = util.resolveUser(user, client.users.cache); } const responseCode = await message.guild.unban({ user, diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 11ef269..64dcdff 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -58,7 +58,7 @@ export default class ReportCommand extends BushCommand { } public async exec(message: BushMessage, { member, evidence }: { member: GuildMember; evidence: string }): Promise<unknown> { - if (message.guild.id != this.client.consts.mappings.guilds.bush) + 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`); if (member.user.id === '322862723090219008') @@ -105,13 +105,13 @@ export default class ReportCommand extends BushCommand { reportEmbed.addField('Attachment', message.attachments.first().url); } } - const reportChannel = <TextChannel>this.client.channels.cache.get('782972723654688848'); + const reportChannel = <TextChannel>client.channels.cache.get('782972723654688848'); await reportChannel.send({ embeds: [reportEmbed] }).then(async (ReportMessage) => { try { await ReportMessage.react(util.emojis.success); await ReportMessage.react(util.emojis.error); } catch { - this.client.console.warn('ReportCommand', 'Could not react to report message.'); + client.console.warn('ReportCommand', 'Could not react to report message.'); } }); return await message.util.reply('Successfully made a report.'); diff --git a/src/commands/skyblock-reborn/chooseColorCommand.ts b/src/commands/skyblock-reborn/chooseColorCommand.ts index f80d2ae..344fa60 100644 --- a/src/commands/skyblock-reborn/chooseColorCommand.ts +++ b/src/commands/skyblock-reborn/chooseColorCommand.ts @@ -120,7 +120,7 @@ export default class ChooseColorCommand extends BushCommand { } public async exec(message: BushMessage | BushSlashMessage, args: { color: Role | RoleResolvable }): Promise<unknown> { - if (message.guild.id != this.client.consts.mappings.guilds.sbr) { + 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.`); } const allowedRoles: Snowflake[] = [ |