diff options
Diffstat (limited to 'src/commands')
25 files changed, 249 insertions, 206 deletions
diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts index a701998..cc5e7b4 100644 --- a/src/commands/admin/roleAll.ts +++ b/src/commands/admin/roleAll.ts @@ -43,7 +43,7 @@ export default class RoleAllCommand extends BushCommand { return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`); if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); - if (args.role.comparePositionTo(message.guild.me!.roles.highest) >= 0 && !args.role) { + if (args.role.comparePositionTo(message.guild.members.me!.roles.highest) >= 0 && !args.role) { return await message.util.reply(`${util.emojis.error} I cannot assign a role higher or equal to my highest role.`); } diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index c1dd142..e203d12 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -316,10 +316,10 @@ export default class ConfigCommand extends BushCommand { const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n'); settingsEmbed.setDescription(desc); - const selMenu = new ActionRowBuilder<SelectMenuBuilder>().addComponents( + const selMenu = new ActionRowBuilder<SelectMenuBuilder>().addComponents([ new SelectMenuBuilder() .addOptions( - ...settingsArr.map((s) => + settingsArr.map((s) => new UnsafeSelectMenuOptionBuilder() .setLabel(guildSettingsObj[s].name) .setValue(s) @@ -330,7 +330,7 @@ export default class ConfigCommand extends BushCommand { .setMaxValues(1) .setMinValues(1) .setCustomId('command_settingsSel') - ); + ]); return { embeds: [settingsEmbed], components: [selMenu] }; } else { settingsEmbed.setTitle(guildSettingsObj[setting].name); @@ -363,9 +363,9 @@ export default class ConfigCommand extends BushCommand { : '[No Value Set]'; }; - const components = new ActionRowBuilder<ButtonBuilder>().addComponents( + const components = new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' }) - ); + ]); settingsEmbed.setDescription( `${Formatters.italic(guildSettingsObj[setting].description)}\n\n**Type:** ${guildSettingsObj[setting].type}` ); @@ -375,10 +375,12 @@ export default class ConfigCommand extends BushCommand { message.util.isSlash ? snakeCase(setting) : setting } ${guildSettingsObj[setting].type.includes('-array') ? 'add/remove' : 'set'} <value>" to set this setting.` }); - settingsEmbed.addFields({ - name: 'value', - value: (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]' - }); + settingsEmbed.addFields([ + { + name: 'value', + value: (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]' + } + ]); return { embeds: [settingsEmbed], components: [components] }; } } diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index 5218bcf..2eee0fe 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -84,7 +84,7 @@ export default class FeaturesCommand extends BushCommand { } public generateComponents(guildFeatures: GuildFeatures[], disable: boolean) { - return new ActionRowBuilder<SelectMenuBuilder>().addComponents( + return new ActionRowBuilder<SelectMenuBuilder>().addComponents([ new SelectMenuBuilder({ customId: 'command_selectFeature', disabled: disable, @@ -98,6 +98,6 @@ export default class FeaturesCommand extends BushCommand { description: guildFeaturesObj[f].description })) }) - ); + ]); } } diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index a32aa8e..0f53198 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -260,8 +260,8 @@ export default class EvalCommand extends BushCommand { embed.setTimestamp(); - if (inputTS) embed.addFields({ name: ':inbox_tray: Input (typescript)', value: inputTS }); - embed.addFields({ name: `:inbox_tray: Input${inputTS ? ' (transpiled javascript)' : ''}`, value: inputJS }); + if (inputTS) embed.addFields([{ name: ':inbox_tray: Input (typescript)', value: inputTS }]); + embed.addFields([{ name: `:inbox_tray: Input${inputTS ? ' (transpiled javascript)' : ''}`, value: inputJS }]); const output = await this.codeblock(rawResult, 'js', { depth: selDepth ?? 0, @@ -276,10 +276,10 @@ export default class EvalCommand extends BushCommand { embed .setTitle(`${emojis[err ? 'errorFull' : 'successFull']} ${err ? 'Uns' : 'S'}uccessfully Evaluated Expression`) .setColor(colors[err ? 'error' : 'success']) - .addFields({ name: `:outbox_tray: ${err ? 'Error' : 'Output'}`, value: output }); + .addFields([{ name: `:outbox_tray: ${err ? 'Error' : 'Output'}`, value: output }]); - if (!err && methods) embed.addFields({ name: ':wrench: Methods', value: methods }); - if (!err && proto) embed.addFields({ name: ':gear: Proto', value: proto }); + if (!err && methods) embed.addFields([{ name: ':wrench: Methods', value: methods }]); + if (!err && proto) embed.addFields([{ name: ':gear: Proto', value: proto }]); if (!silent || message.util.isSlashMessage(message)) { await message.util.reply({ content: null, embeds: [embed] }); diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index 046d9ab..d25b790 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -67,12 +67,16 @@ export default class JavascriptCommand extends BushCommand { }); embed.setTitle(`${util.emojis.successFull} Successfully Evaluated Expression`).setColor(util.colors.success); - embed.addFields({ name: '๐ฅ Input', value: input }); - embed.addFields({ name: '๐ค Output', value: output }); + embed.addFields([ + { name: '๐ฅ Input', value: input }, + { name: '๐ค Output', value: output } + ]); } catch (e) { embed.setTitle(`${util.emojis.errorFull} Unable to Evaluate Expression`).setColor(util.colors.error); - embed.addFields({ name: '๐ฅ Input', value: input }); - embed.addFields({ name: '๐ค Error', value: await util.inspectCleanRedactCodeblock(e, 'js') }); + embed.addFields([ + { name: '๐ฅ Input', value: input }, + { name: '๐ค Error', value: await util.inspectCleanRedactCodeblock(e, 'js') } + ]); } embed.setTimestamp().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined }); diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index f3fe86b..be6a015 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -50,8 +50,10 @@ export default class ShCommand extends BushCommand { .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp() .setTitle('Shell Command') - .addFields({ name: '๐ฅ Input', value: await util.codeblock(input, 1024, 'sh', true) }) - .addFields({ name: 'Running', value: util.emojis.loading }); + .addFields([ + { name: '๐ฅ Input', value: await util.codeblock(input, 1024, 'sh', true) }, + { name: 'Running', value: util.emojis.loading } + ]); await message.util.reply({ embeds: [embed] }); @@ -72,15 +74,15 @@ export default class ShCommand extends BushCommand { .setColor(util.colors.success) .spliceFields(1, 1); - if (stdout) embed.addFields({ name: '๐ค stdout', value: await util.codeblock(stdout, 1024, 'json', true) }); - if (stderr) embed.addFields({ name: '๐ค stderr', value: await util.codeblock(stderr, 1024, 'json', true) }); + if (stdout) embed.addFields([{ name: '๐ค stdout', value: await util.codeblock(stdout, 1024, 'json', true) }]); + if (stderr) embed.addFields([{ name: '๐ค stderr', value: await util.codeblock(stderr, 1024, 'json', true) }]); } catch (e) { embed .setTitle(`${util.emojis.errorFull} An error occurred while executing.`) .setColor(util.colors.error) .spliceFields(1, 1); - embed.addFields({ name: '๐ค Output', value: await util.codeblock(e?.stack, 1024, 'js', true) }); + embed.addFields([{ name: '๐ค Output', value: await util.codeblock(e?.stack, 1024, 'js', true) }]); } await message.util.edit({ embeds: [embed] }); } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index deca6f1..9365107 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -52,17 +52,17 @@ export default class TestCommand extends BushCommand { } if (['button', 'buttons'].includes(args?.feature?.toLowerCase())) { - const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( + const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }), new ButtonBuilder({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }), new ButtonBuilder({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }), new ButtonBuilder({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }), new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }) - ); + ]); return await message.util.reply({ content: 'buttons', components: [buttonRow] }); } else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) { const embed = new EmbedBuilder() - .addFields({ name: 'Field Name', value: 'Field Content' }) + .addFields([{ name: 'Field Name', value: 'Field Content' }]) .setAuthor({ name: 'Author', iconURL: 'https://www.w3schools.com/w3css/img_snowtops.jpg', url: 'https://google.com/' }) .setColor(message.member?.displayColor ?? util.colors.default) .setDescription('Description') @@ -75,9 +75,9 @@ export default class TestCommand extends BushCommand { ) .setTitle('Title'); - const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( + const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' }) - ); + ]); return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] }); } else if (['lots of buttons'].includes(args?.feature?.toLowerCase())) { const buttonRows: ActionRowBuilder<ButtonBuilder>[] = []; @@ -86,7 +86,7 @@ export default class TestCommand extends BushCommand { for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); const button = new ButtonBuilder({ style: ButtonStyle.Primary, customId: id, label: id }); - row.addComponents(button); + row.addComponents([button]); } buttonRows.push(row); } @@ -118,7 +118,7 @@ export default class TestCommand extends BushCommand { for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); const button = new ButtonBuilder({ style: ButtonStyle.Secondary, customId: id, label: id }); - row.addComponents(button); + row.addComponents([button]); } ButtonRows.push(row); } @@ -149,9 +149,9 @@ export default class TestCommand extends BushCommand { const m = await message.util.reply({ content: 'Click for modal', components: [ - new ActionRowBuilder<ButtonBuilder>().addComponents( + new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' }) - ) + ]) ] }); 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') }]); } } diff --git a/src/commands/leveling/levelRoles.ts b/src/commands/leveling/levelRoles.ts index 5ae9981..893e602 100644 --- a/src/commands/leveling/levelRoles.ts +++ b/src/commands/leveling/levelRoles.ts @@ -69,7 +69,7 @@ export default class LevelRolesCommand extends BushCommand { content: `${util.emojis.error} <@${args.role.id}> is higher or equal to your highest role.`, allowedMentions: AllowedMentions.none() }); - else if (args.role.comparePositionTo(message.guild.me!.roles.highest) >= 0) |
