diff options
Diffstat (limited to 'src/commands/info')
-rw-r--r-- | src/commands/info/botInfo.ts | 4 | ||||
-rw-r--r-- | src/commands/info/color.ts | 4 | ||||
-rw-r--r-- | src/commands/info/guildInfo.ts | 6 | ||||
-rw-r--r-- | src/commands/info/help.ts | 70 | ||||
-rw-r--r-- | src/commands/info/links.ts | 6 | ||||
-rw-r--r-- | src/commands/info/ping.ts | 4 | ||||
-rw-r--r-- | src/commands/info/snowflake.ts | 12 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 20 |
8 files changed, 58 insertions, 68 deletions
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 25b860c..f284e0f 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -49,7 +49,7 @@ export default class BotInfoCommand extends BushCommand { if (repoUrl.includes('.git')) repoUrl = repoUrl.substring(0, repoUrl.length - 4); const embed = new EmbedBuilder() .setTitle('Bot Info:') - .addFields([ + .addFields( { name: '**Uptime**', value: humanizeDuration(this.client.uptime!, 2), inline: true }, { name: '**Memory Usage**', @@ -79,7 +79,7 @@ export default class BotInfoCommand extends BushCommand { inline: true }, { name: '**Developers**', value: developers, inline: true } - ]) + ) .setTimestamp() .setColor(colors.default); await message.util.reply({ embeds: [embed] }); diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 84c4b3c..7286c5c 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -63,12 +63,12 @@ export default class ColorCommand extends BushCommand { } const embed = new EmbedBuilder() - .addFields([ + .addFields( { name: '» Hexadecimal', value: color.toHexString() }, { name: '» Decimal', value: `${parseInt(color.toHex(), 16)}` }, { name: '» HSL', value: this.removePrefixAndParenthesis(color.toHslString()) }, { name: '» RGB', value: this.removePrefixAndParenthesis(color.toRgbString()) } - ]) + ) .setColor(parseInt(color.toHex(), 16)); return await message.util.reply({ embeds: [embed] }); diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 060a439..dd5704f 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -168,7 +168,7 @@ export default class GuildInfoCommand extends BushCommand { ); } - embed.addFields([{ name: '» About', value: guildAbout.join('\n') }]); + embed.addFields({ name: '» About', value: guildAbout.join('\n') }); } private generateStatsField(embed: EmbedBuilder, guild: Guild | GuildPreview) { @@ -213,7 +213,7 @@ export default class GuildInfoCommand extends BushCommand { `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${StickerTierMap[guild.premiumTier]}` ); - embed.addFields([{ name: '» Stats', value: guildStats.join('\n') }]); + embed.addFields({ name: '» Stats', value: guildStats.join('\n') }); } private generateSecurityField(embed: EmbedBuilder, guild: Guild | GuildPreview) { @@ -228,7 +228,7 @@ export default class GuildInfoCommand extends BushCommand { `**2FA Required:** ${guild.mfaLevel === GuildMFALevel.Elevated ? 'True' : 'False'}` ); - embed.addFields([{ name: '» Security', value: guildSecurity.join('\n') }]); + embed.addFields({ name: '» Security', value: guildSecurity.join('\n') }); } } diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 1a19969..ec079e7 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -103,7 +103,7 @@ export default class HelpCommand extends BushCommand { .replace(/'(S)/g, (letter) => letter.toLowerCase()); const categoryCommands = categoryFilter.filter((cmd) => cmd.aliases.length > 0).map((cmd) => `\`${cmd.aliases[0]}\``); if (categoryCommands.length > 0) { - embed.addFields([{ name: `${categoryNice}`, value: `${categoryCommands.join(' ')}` }]); + embed.addFields({ name: `${categoryNice}`, value: `${categoryCommands.join(' ')}` }); } } return message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined }); @@ -129,34 +129,28 @@ export default class HelpCommand extends BushCommand { private addCommandUsage(embed: EmbedBuilder, command: BushCommand) { if (command.usage?.length) { - embed.addFields([ - { - name: `» Usage${command.usage.length > 1 ? 's' : ''}`, - value: command.usage.map((u) => `\`${u}\``).join('\n') - } - ]); + embed.addFields({ + name: `» Usage${command.usage.length > 1 ? 's' : ''}`, + value: command.usage.map((u) => `\`${u}\``).join('\n') + }); } } private addCommandExamples(embed: EmbedBuilder, command: BushCommand) { if (command.examples?.length) { - embed.addFields([ - { - name: `» Example${command.examples.length > 1 ? 's' : ''}`, - value: command.examples.map((u) => `\`${u}\``).join('\n') - } - ]); + embed.addFields({ + name: `» Example${command.examples.length > 1 ? 's' : ''}`, + value: command.examples.map((u) => `\`${u}\``).join('\n') + }); } } private addCommandAliases(embed: EmbedBuilder, command: BushCommand) { if (command.aliases?.length > 1) - embed.addFields([ - { - name: '» Aliases', - value: `\`${command.aliases.join('` `')}\`` - } - ]); + embed.addFields({ + name: '» Aliases', + value: `\`${command.aliases.join('` `')}\`` + }); } private addCommandArguments(embed: EmbedBuilder, command: BushCommand, isOwner = false, isSuperUser = false) { @@ -167,26 +161,24 @@ export default class HelpCommand extends BushCommand { return true; }); if (args.length) { - embed.addFields([ - { - name: '» Arguments', - value: args - .map((a) => { - let ret = stripIndent` + embed.addFields({ + name: '» Arguments', + value: args + .map((a) => { + let ret = stripIndent` \`${format(a.name, !!a.optional)}\` ⠀‣ **Desc**: ${a.description} ⠀‣ **Type**: ${typeof a.type !== 'function' ? a.type : '[no readable type]'}`; - if (a.flag?.length) ret += `\n⠀‣ **Flags**: ${a.flag.map((f) => `"${f}"`).join(', ')}`; - ret += `\n⠀‣ **Kind**: ${a.only ?? 'text & slash'}`; - if (a.only !== 'slash') ret += `\n⠀‣ **Match**: ${a.match}`; - if (a.only !== 'text') ret += `\n⠀‣ **Autocomplete**: ${a.autocomplete}`; + if (a.flag?.length) ret += `\n⠀‣ **Flags**: ${a.flag.map((f) => `"${f}"`).join(', ')}`; + ret += `\n⠀‣ **Kind**: ${a.only ?? 'text & slash'}`; + if (a.only !== 'slash') ret += `\n⠀‣ **Match**: ${a.match}`; + if (a.only !== 'text') ret += `\n⠀‣ **Autocomplete**: ${a.autocomplete}`; - return ret; - }) - .join('\n') - } - ]); + return ret; + }) + .join('\n') + }); } } @@ -213,7 +205,7 @@ export default class HelpCommand extends BushCommand { .map((g) => format.inlineCode(this.client.guilds.cache.find((g1) => g1.id === g)?.name ?? 'Unknown')) .join(' ')}` ); - if (restrictions.length) embed.addFields([{ name: '» Restrictions', value: restrictions.join('\n') }]); + if (restrictions.length) embed.addFields({ name: '» Restrictions', value: restrictions.join('\n') }); } } @@ -221,15 +213,15 @@ export default class HelpCommand extends BushCommand { const row = new ActionRowBuilder<ButtonBuilder>(); if (!this.client.config.isDevelopment && !this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { - row.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })]); + row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })); } if (!this.client.guilds.cache.get(this.client.config.supportGuild.id)?.members.cache.has(message.author.id)) { - row.addComponents([ + row.addComponents( new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: this.client.config.supportGuild.invite }) - ]); + ); } if (packageDotJSON?.repository) - row.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })]); + row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })); else void message.channel?.send('Error importing package.json, please report this to my developer.'); return row; diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts index 23aa411..3671c6c 100644 --- a/src/commands/info/links.ts +++ b/src/commands/info/links.ts @@ -22,12 +22,12 @@ export default class LinksCommand extends BushCommand { public override async exec(message: CommandMessage | SlashMessage) { const buttonRow = new ActionRowBuilder<ButtonBuilder>(); if (!this.client.config.isDevelopment || message.author.isOwner()) { - buttonRow.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })]); + buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })); } - buttonRow.addComponents([ + buttonRow.addComponents( new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: this.client.config.supportGuild.invite }), new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }) - ]); + ); return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] }); } } diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 060b1f6..484c010 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -34,10 +34,10 @@ export default class PingCommand extends BushCommand { const apiLatency = format.codeBlock(`${Math.round(message.client.ws.ping)}ms`); const embed = new EmbedBuilder() .setTitle('Pong! 🏓') - .addFields([ + .addFields( { name: 'Bot Latency', value: botLatency, inline: true }, { name: 'API Latency', value: apiLatency, inline: true } - ]) + ) .setFooter({ text: message.author.username, iconURL: message.author.displayAvatarURL() }) .setColor(colors.default) .setTimestamp(); diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index dba1378..f30330a 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -70,7 +70,7 @@ export default class SnowflakeCommand extends BushCommand { ); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(channel.name)} \`[Channel]\``); } - snowflakeEmbed.addFields([{ name: '» Channel Info', value: channelInfo.join('\n') }]); + snowflakeEmbed.addFields({ name: '» Channel Info', value: channelInfo.join('\n') }); } // Guild @@ -81,7 +81,7 @@ export default class SnowflakeCommand extends BushCommand { **Owner:** ${escapeMarkdown(this.client.users.cache.get(guild.ownerId)?.tag ?? '¯\\_(ツ)_/¯')} (${guild.ownerId}) **Members:** ${guild.memberCount?.toLocaleString()}`; if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048 })!); - snowflakeEmbed.addFields([{ name: '» Server Info', value: guildInfo }]); + snowflakeEmbed.addFields({ name: '» Server Info', value: guildInfo }); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(guild.name)} \`[Server]\``); } @@ -92,7 +92,7 @@ export default class SnowflakeCommand extends BushCommand { const userInfo = stripIndent` **Name:** <@${user.id}> (${escapeMarkdown(user.tag)})`; if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048 })!); - snowflakeEmbed.addFields([{ name: '» User Info', value: userInfo }]); + snowflakeEmbed.addFields({ name: '» User Info', value: userInfo }); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(user.tag)} \`[User]\``); } @@ -103,7 +103,7 @@ export default class SnowflakeCommand extends BushCommand { **Name:** ${escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} **Animated:** ${emoji.animated}`; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); - snowflakeEmbed.addFields([{ name: '» Emoji Info', value: emojiInfo }]); + snowflakeEmbed.addFields({ name: '» Emoji Info', value: emojiInfo }); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} \`[Emoji]\``); } @@ -118,7 +118,7 @@ export default class SnowflakeCommand extends BushCommand { **Position:** ${role.position} **Hex Color:** ${role.hexColor}`; if (role.color) snowflakeEmbed.setColor(role.color); - snowflakeEmbed.addFields([{ name: '» Role Info', value: roleInfo }]); + snowflakeEmbed.addFields({ name: '» Role Info', value: roleInfo }); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(role.name)} \`[Role]\``); } @@ -130,7 +130,7 @@ export default class SnowflakeCommand extends BushCommand { **Worker ID:** ${deconstructedSnowflake.workerId} **Process ID:** ${deconstructedSnowflake.processId} **Increment:** ${deconstructedSnowflake.increment}`; - snowflakeEmbed.addFields([{ name: '» Snowflake Info', value: snowflakeInfo }]); + snowflakeEmbed.addFields({ name: '» Snowflake Info', value: snowflakeInfo }); return await message.util.reply({ embeds: [snowflakeEmbed] }); } diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 73a0422..3479ea3 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -145,7 +145,7 @@ export default class UserInfoCommand extends BushCommand { if (pronouns && typeof pronouns === 'string' && pronouns !== 'Unspecified') generalInfo.push(`**Pronouns:** ${pronouns}`); - embed.addFields([{ name: title, value: generalInfo.join('\n') }]); + embed.addFields({ name: title, value: generalInfo.join('\n') }); } public static generateServerInfoField(embed: EmbedBuilder, member?: GuildMember | undefined, title = '» Server Information') { @@ -170,7 +170,7 @@ export default class UserInfoCommand extends BushCommand { ) serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${escapeMarkdown(member?.nickname)}`); - if (serverUserInfo.length) embed.addFields([{ name: title, value: serverUserInfo.join('\n') }]); + if (serverUserInfo.length) embed.addFields({ name: title, value: serverUserInfo.join('\n') }); } public static generatePresenceField(embed: EmbedBuilder, member?: GuildMember | undefined, title = '» Presence') { @@ -198,7 +198,7 @@ export default class UserInfoCommand extends BushCommand { if (activitiesNames.length) presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${oxford(activitiesNames, 'and', '')}`); if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${escapeMarkdown(customStatus)}`); - embed.addFields([{ name: title, value: presenceInfo.join('\n') }]); + embed.addFields({ name: title, value: presenceInfo.join('\n') }); enum statusEmojis { online = '787550449435803658', @@ -223,12 +223,10 @@ export default class UserInfoCommand extends BushCommand { .map((role) => `${role}`); const joined = roles.join(', '); - embed.addFields([ - { - name: `» Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, - value: joined.length > 1024 ? 'Too Many Roles to Display' + '...' : joined - } - ]); + embed.addFields({ + name: `» Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, + value: joined.length > 1024 ? 'Too Many Roles to Display' + '...' : joined + }); } public static generatePermissionsField( @@ -250,7 +248,7 @@ export default class UserInfoCommand extends BushCommand { }); } - if (perms.length) embed.addFields([{ name: title, value: perms.join(' ') }]); + if (perms.length) embed.addFields({ name: title, value: perms.join(' ') }); } public static async generateBotField(embed: EmbedBuilder, user: User, title = '» Bot Information') { @@ -290,6 +288,6 @@ export default class UserInfoCommand extends BushCommand { ); } - if (botInfo.length) embed.addFields([{ name: title, value: botInfo.join('\n') }]); + if (botInfo.length) embed.addFields({ name: title, value: botInfo.join('\n') }); } } |