diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-24 18:29:57 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-24 18:29:57 -0400 |
commit | 9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c (patch) | |
tree | 4b95a06ff6991207ab8b8e93f0bca26e24a97f80 /src/commands/info | |
parent | 6b8115ab1ec94d4330019fc7a93e094d9d64c48e (diff) | |
download | tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.tar.gz tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.tar.bz2 tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.zip |
fix: breaking changes
Diffstat (limited to 'src/commands/info')
-rw-r--r-- | src/commands/info/botInfo.ts | 58 | ||||
-rw-r--r-- | src/commands/info/color.ts | 10 | ||||
-rw-r--r-- | src/commands/info/guildInfo.ts | 8 | ||||
-rw-r--r-- | src/commands/info/help.ts | 34 | ||||
-rw-r--r-- | src/commands/info/links.ts | 6 | ||||
-rw-r--r-- | src/commands/info/ping.ts | 17 | ||||
-rw-r--r-- | src/commands/info/snowflake.ts | 15 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 20 |
8 files changed, 90 insertions, 78 deletions
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 1ea54f3..3338824 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -41,34 +41,36 @@ 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({ name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true }) - .addFields({ - name: '**Memory Usage**', - value: `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), { - binary: true - })}\nHeap: ${prettyBytes(process.memoryUsage().heapUsed, { binary: true })}/${prettyBytes( - process.memoryUsage().heapTotal, - { binary: true } - )}`, - inline: true - }) - .addFields({ name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true }) - .addFields({ name: '**Platform**', value: Platform[process.platform], inline: true }) - .addFields({ name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true }) - .addFields({ name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true }) - .addFields({ name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true }) - .addFields({ name: '**Discord.js Version**', value: discordJSVersion, inline: true }) - .addFields({ name: '**Node.js Version**', value: process.version.slice(1), inline: true }) - .addFields({ name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true }) - .addFields({ name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true }) - .addFields({ name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true }) - .addFields({ name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true }) - .addFields({ - name: '**Current Commit**', - value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, - inline: true - }) - .addFields({ name: '**Developers**', value: developers, inline: true }) + .addFields([ + { name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true }, + { + name: '**Memory Usage**', + value: `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), { + binary: true + })}\nHeap: ${prettyBytes(process.memoryUsage().heapUsed, { binary: true })}/${prettyBytes( + process.memoryUsage().heapTotal, + { binary: true } + )}`, + inline: true + }, + { name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true }, + { name: '**Platform**', value: Platform[process.platform], inline: true }, + { name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true }, + { name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true }, + { name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true }, + { name: '**Discord.js Version**', value: discordJSVersion, inline: true }, + { name: '**Node.js Version**', value: process.version.slice(1), inline: true }, + { name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true }, + { name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true }, + { name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true }, + { name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true }, + { + name: '**Current Commit**', + value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, + inline: true + }, + { name: '**Developers**', value: developers, inline: true } + ]) .setTimestamp() .setColor(util.colors.default); await message.util.reply({ embeds: [embed] }); diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index cc4fcc3..a74c3f3 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -76,10 +76,12 @@ export default class ColorCommand extends BushCommand { } const embed = new EmbedBuilder() - .addFields({ name: '» Hexadecimal', value: color.toHexString() }) - .addFields({ name: '» Decimal', value: `${parseInt(color.toHex(), 16)}` }) - .addFields({ name: '» HSL', value: this.removePrefixAndParenthesis(color.toHslString()) }) - .addFields({ name: '» RGB', value: this.removePrefixAndParenthesis(color.toRgbString()) }) + .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 4049250..59a1001 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -135,7 +135,7 @@ export default class GuildInfoCommand extends BushCommand { ); if (guild.premiumSubscriptionCount) guildAbout.push(`**Boosts:** Level ${guild.premiumTier} with ${guild.premiumSubscriptionCount ?? 0} boosts`); - if (guild.me?.permissions.has(PermissionFlagsBits.ManageGuild) && guild.vanityURLCode) { + if (guild.members.me?.permissions.has(PermissionFlagsBits.ManageGuild) && guild.vanityURLCode) { const vanityInfo: Vanity = await guild.fetchVanityData(); guildAbout.push(`**Vanity URL:** discord.gg/${vanityInfo.code}`, `**Vanity Uses:** ${vanityInfo.uses?.toLocaleString()}`); } @@ -155,7 +155,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) { @@ -191,7 +191,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) { @@ -206,7 +206,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 93979ac..7a30e64 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -87,7 +87,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 await message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined }); @@ -98,18 +98,22 @@ export default class HelpCommand extends BushCommand { .setTitle(`${command.id} Command`) .setDescription(`${command.description ?? '*This command does not have a description.*'}`); 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') + } + ]); } 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') + } + ]); } - if (command.aliases?.length > 1) embed.addFields({ name: '» Aliases', value: `\`${command.aliases.join('` `')}\`` }); + if (command.aliases?.length > 1) embed.addFields([{ name: '» Aliases', value: `\`${command.aliases.join('` `')}\`` }]); if ( command.ownerOnly || command.superUserOnly || @@ -132,7 +136,7 @@ export default class HelpCommand extends BushCommand { .map((g) => util.format.inlineCode(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') }]); } const params = { embeds: [embed], components: row.components.length ? [row] : undefined }; @@ -143,15 +147,15 @@ export default class HelpCommand extends BushCommand { const row = new ActionRowBuilder<ButtonBuilder>(); if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { - row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); + row.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })]); } if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) { - row.addComponents( + row.addComponents([ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: 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 1cb6de0..91b62ca 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: BushMessage | BushSlashMessage) { const buttonRow = new ActionRowBuilder<ButtonBuilder>(); if (!client.config.isDevelopment || message.author.isOwner()) { - buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); + buttonRow.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })]); } - buttonRow.addComponents( + buttonRow.addComponents([ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: 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 04ceedd..086a77a 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -22,8 +22,10 @@ export default class PingCommand extends BushCommand { const apiLatency = `${'```'}\n ${Math.round(message.client.ws.ping)}ms ${'```'}`; const embed = new EmbedBuilder() .setTitle('Pong! 🏓') - .addFields({ name: 'Bot Latency', value: botLatency, inline: true }) - .addFields({ name: 'API Latency', value: apiLatency, inline: true }) + .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(util.colors.default) .setTimestamp(); @@ -41,12 +43,11 @@ export default class PingCommand extends BushCommand { const apiLatency = `${'```'}\n ${Math.round(client.ws.ping)}ms ${'```'}`; const embed = new EmbedBuilder() .setTitle('Pong! 🏓') - .addFields({ name: 'Bot Latency', value: botLatency, inline: true }) - .addFields({ name: 'API Latency', value: apiLatency, inline: true }) - .setFooter({ - text: message.interaction.user.username, - iconURL: message.interaction.user.displayAvatarURL() - }) + .addFields([ + { name: 'Bot Latency', value: botLatency, inline: true }, + { name: 'API Latency', value: apiLatency, inline: true } + ]) + .setFooter({ text: message.interaction.user.username, iconURL: message.interaction.user.displayAvatarURL() }) .setColor(util.colors.default) .setTimestamp(); await message.interaction.editReply({ diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index 71ae80d..933b1ac 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -1,6 +1,7 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import { ApplicationCommandOptionType, + ChannelType, EmbedBuilder, PermissionFlagsBits, SnowflakeUtil, @@ -42,7 +43,7 @@ export default class SnowflakeCommand extends BushCommand { // Channel if (client.channels.cache.has(snowflake)) { const channel = client.channels.resolve(snowflake)!; - const channelInfo = [`**Type:** ${BushChannelType[channel.type]}`]; + const channelInfo = [`**Type:** ${BushChannelType[channel.type] ?? ChannelType[channel.type]}`]; if (channel.isDM()) { channelInfo.push( `**Recipient:** ${util.discord.escapeMarkdown(channel.recipient?.tag ?? '¯\\_(ツ)_/¯')} (${ @@ -66,7 +67,7 @@ export default class SnowflakeCommand extends BushCommand { ); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(channel.name)} \`[Channel]\``); } - snowflakeEmbed.addFields({ name: '» Channel Info', value: channelInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Channel Info', value: channelInfo.join('\n') }]); } // Guild @@ -80,7 +81,7 @@ export default class SnowflakeCommand extends BushCommand { `**Members:** ${guild.memberCount?.toLocaleString()}` ]; if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048 })!); - snowflakeEmbed.addFields({ name: '» Server Info', value: guildInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Server Info', value: guildInfo.join('\n') }]); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(guild.name)} \`[Server]\``); } @@ -90,7 +91,7 @@ export default class SnowflakeCommand extends BushCommand { const user: User = (client.users.cache.get(snowflake) ?? fetchedUser)!; const userInfo = [`**Name:** <@${user.id}> (${util.discord.escapeMarkdown(user.tag)})`]; if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048 })!); - snowflakeEmbed.addFields({ name: '» User Info', value: userInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» User Info', value: userInfo.join('\n') }]); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(user.tag)} \`[User]\``); } @@ -102,7 +103,7 @@ export default class SnowflakeCommand extends BushCommand { `**Animated:** ${emoji.animated}` ]; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); - snowflakeEmbed.addFields({ name: '» Emoji Info', value: emojiInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Emoji Info', value: emojiInfo.join('\n') }]); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} \`[Emoji]\``); } @@ -118,7 +119,7 @@ export default class SnowflakeCommand extends BushCommand { `**Hex Color:** ${role.hexColor}` ]; if (role.color) snowflakeEmbed.setColor(role.color); - snowflakeEmbed.addFields({ name: '» Role Info', value: roleInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Role Info', value: roleInfo.join('\n') }]); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(role.name)} \`[Role]\``); } @@ -131,7 +132,7 @@ export default class SnowflakeCommand extends BushCommand { `**Process ID:** ${deconstructedSnowflake.processId}`, `**Increment:** ${deconstructedSnowflake.increment}` ]; - snowflakeEmbed.addFields({ name: '» Snowflake Info', value: snowflakeInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Snowflake Info', value: snowflakeInfo.join('\n') }]); return await message.util.reply({ embeds: [snowflakeEmbed] }); } diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 0d6c891..5f4a1bd 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -135,7 +135,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( @@ -164,7 +164,7 @@ export default class UserInfoCommand extends BushCommand { ) serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${util.discord.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?: BushGuildMember | undefined, title = '» Presence') { @@ -192,7 +192,7 @@ export default class UserInfoCommand extends BushCommand { if (activitiesNames.length) presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${util.oxford(activitiesNames, 'and', '')}`); if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${util.discord.escapeMarkdown(customStatus)}`); - embed.addFields({ name: title, value: presenceInfo.join('\n') }); + embed.addFields([{ name: title, value: presenceInfo.join('\n') }]); enum statusEmojis { online = '787550449435803658', @@ -217,10 +217,12 @@ 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( @@ -242,7 +244,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: BushUser, title = '» Bot Information') { @@ -280,6 +282,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') }]); } } |