diff options
| author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-01-25 23:47:40 -0500 |
|---|---|---|
| committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-01-25 23:47:40 -0500 |
| commit | 840cca672d681c36f980a06fb79a4e2c01bd69ac (patch) | |
| tree | 82c40a7fe3e1a2bc6367fed6e3d26b6c7dceb256 /src/commands | |
| parent | 6ca99336a416389dd2b0b8c4c6a7b2ef87bc9fef (diff) | |
| download | tanzanite-840cca672d681c36f980a06fb79a4e2c01bd69ac.tar.gz tanzanite-840cca672d681c36f980a06fb79a4e2c01bd69ac.tar.bz2 tanzanite-840cca672d681c36f980a06fb79a4e2c01bd69ac.zip | |
I love breaking changes!!!!
Diffstat (limited to 'src/commands')
40 files changed, 284 insertions, 219 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index f0d2c65..4f511cd 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; export default class ChannelPermissionsCommand extends BushCommand { public constructor() { @@ -89,9 +89,9 @@ export default class ChannelPermissionsCommand extends BushCommand { } const failure = failedChannels.map((c) => `<#${c.id}>`).join(' '); if (failure.length > 2000) { - const paginate: MessageEmbed[] = []; + const paginate: Embed[] = []; for (let i = 0; i < failure.length; i += 4000) { - paginate.push(new MessageEmbed().setDescription(failure.substring(i, Math.min(failure.length, i + 4000)))); + paginate.push(new Embed().setDescription(failure.substring(i, Math.min(failure.length, i + 4000)))); } const normalMessage = `Finished changing perms! Failed channels:`; return await ButtonPaginator.send(message, paginate, normalMessage); diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 41bdc04..42ff309 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -16,9 +16,10 @@ import { ButtonComponent, ButtonStyle, Channel, + Embed, Formatters, GuildMember, - MessageEmbed, + InteractionUpdateOptions, Permissions, Role, SelectMenuComponent, @@ -286,9 +287,9 @@ export default class ConfigCommand extends BushCommand { public async generateMessageOptions( message: BushMessage | BushSlashMessage, setting?: undefined | keyof typeof guildSettingsObj - ): Promise<MessageOptions> { + ): Promise<MessageOptions & InteractionUpdateOptions> { if (!message.guild) throw new Error('message.guild is null'); - const settingsEmbed = new MessageEmbed().setColor(util.colors.default); + const settingsEmbed = new Embed().setColor(util.colors.default); if (!setting) { settingsEmbed.setTitle(`${message.guild!.name}'s Settings`); const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n'); @@ -364,7 +365,10 @@ 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.addField('value', (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]'); + settingsEmbed.addField({ + 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 fdd6c1e..04c0425 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -9,7 +9,7 @@ import { import { ActionRow, ComponentType, - MessageEmbed, + Embed, Permissions, SelectMenuComponent, SelectMenuOption, @@ -35,7 +35,7 @@ export default class FeaturesCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`); - const featureEmbed = new MessageEmbed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default); + const featureEmbed = new Embed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default); const enabledFeatures = await message.guild!.getSetting('enabledFeatures'); this.generateDescription(guildFeaturesArr, enabledFeatures, featureEmbed); @@ -71,7 +71,7 @@ export default class FeaturesCommand extends BushCommand { }); } - public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: MessageEmbed): void { + public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: Embed): void { embed.setDescription( allFeatures .map( diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts index 5906623..4c9a20b 100644 --- a/src/commands/config/log.ts +++ b/src/commands/config/log.ts @@ -1,6 +1,6 @@ import { BushCommand, guildLogsArr, type ArgType, type BushMessage, type BushSlashMessage, type GuildLogType } from '#lib'; -import { type ArgumentOptions, type Flag } from 'discord-akairo'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ArgumentGeneratorReturn } from 'discord-akairo'; +import { ApplicationCommandOptionType, ChannelType, Permissions } from 'discord.js'; export default class LogCommand extends BushCommand { public constructor() { @@ -26,7 +26,13 @@ export default class LogCommand extends BushCommand { type: 'channel', prompt: 'What channel would you like these logs to be sent in?', slashType: ApplicationCommandOptionType.Channel, - channelTypes: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'], + channelTypes: [ + ChannelType.GuildText, + ChannelType.GuildNews, + ChannelType.GuildNewsThread, + ChannelType.GuildPublicThread, + ChannelType.GuildPrivateThread + ], only: 'slash' } ], @@ -36,7 +42,7 @@ export default class LogCommand extends BushCommand { }); } - public override *args(): IterableIterator<ArgumentOptions | Flag> { + public override *args(): ArgumentGeneratorReturn { const log_type = yield { id: 'log_type', type: guildLogsArr, diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 92b1117..c8541c6 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -25,13 +25,13 @@ import { CommandInteraction, ContextMenuCommandInteraction, DMChannel, + Embed, Emoji, Interaction, InteractionCollector, Message, MessageAttachment, MessageCollector, - MessageEmbed, ReactionCollector, SelectMenuComponent, Util @@ -194,7 +194,7 @@ export default class EvalCommand extends BushCommand { lang: isTypescript ? 'ts' : 'js' }; - const embed = new MessageEmbed(); + const embed = new Embed(); const badPhrases = ['delete', 'destroy']; if (badPhrases.some((p) => code[code.lang]!.includes(p)) && !args.sudo) { @@ -233,16 +233,22 @@ export default class EvalCommand extends BushCommand { : undefined; embed.setTitle(`${emojis.successFull} Successfully Evaluated Expression`).setColor(colors.success); - if (inputTS) embed.addField('๐ฅ Input (typescript)', inputTS).addField('๐ฅ Input (transpiled javascript)', inputJS); - else embed.addField('๐ฅ Input', inputJS); - embed.addField('๐ค Output', output); - if (methods) embed.addField('๐ง Methods', methods); - if (proto) embed.addField('โ๏ธ Proto', proto); + if (inputTS) + embed + .addField({ name: '๐ฅ Input (typescript)', value: inputTS }) + .addField({ name: '๐ฅ Input (transpiled javascript)', value: inputJS }); + else embed.addField({ name: '๐ฅ Input', value: inputJS }); + embed.addField({ name: '๐ค Output', value: output }); + if (methods) embed.addField({ name: '๐ง Methods', value: methods }); + if (proto) embed.addField({ name: 'โ๏ธ Proto', value: proto }); } catch (e) { embed.setTitle(`${emojis.errorFull} Unable to Evaluate Expression`).setColor(colors.error); - if (inputTS) embed.addField('๐ฅ Input (typescript)', inputTS).addField('๐ฅ Input (transpiled javascript)', inputJS); - else embed.addField('๐ฅ Input', inputJS); - embed.addField('๐ค Error', await util.inspectCleanRedactCodeblock(e, 'js')); + if (inputTS) + embed + .addField({ name: '๐ฅ Input (typescript)', value: inputTS }) + .addField({ name: '๐ฅ Input (transpiled javascript)', value: inputJS }); + else embed.addField({ name: '๐ฅ Input', value: inputJS }); + embed.addField({ 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/javascript.ts b/src/commands/dev/javascript.ts index 9d6a20b..3ede3e2 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -1,6 +1,6 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, MessageEmbed } from 'discord.js'; +import { ApplicationCommandOptionType, Embed } from 'discord.js'; import { VM } from 'vm2'; assert(VM); @@ -53,7 +53,7 @@ export default class JavascriptCommand extends BushCommand { await message.interaction.deferReply({ ephemeral: false }); } const code = args.code.replace(/[โโ]/g, '"').replace(/```*(?:js)?/g, ''); - const embed = new MessageEmbed(); + const embed = new Embed(); const input = await util.inspectCleanRedactCodeblock(code, 'js'); try { @@ -67,12 +67,12 @@ export default class JavascriptCommand extends BushCommand { }); embed.setTitle(`${util.emojis.successFull} Successfully Evaluated Expression`).setColor(util.colors.success); - embed.addField('๐ฅ Input', input); - embed.addField('๐ค Output', output); + embed.addField({ name: '๐ฅ Input', value: input }); + embed.addField({ name: '๐ค Output', value: output }); } catch (e) { embed.setTitle(`${util.emojis.errorFull} Unable to Evaluate Expression`).setColor(util.colors.error); - embed.addField('๐ฅ Input', input); - embed.addField('๐ค Error', await util.inspectCleanRedactCodeblock(e, 'js')); + embed.addField({ name: '๐ฅ Input', value: input }); + embed.addField({ 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/servers.ts b/src/commands/dev/servers.ts index 308d1db..173970b 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -1,5 +1,6 @@ import { BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib'; -import { type Guild, type MessageEmbedOptions } from 'discord.js'; +import { APIEmbed } from 'discord-api-types'; +import { type Guild } from 'discord.js'; export default class ServersCommand extends BushCommand { public constructor() { @@ -18,7 +19,7 @@ export default class ServersCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { const guilds = [...client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).values()]; const chunkedGuilds: Guild[][] = util.chunk(guilds, 10); - const embeds: MessageEmbedOptions[] = chunkedGuilds.map((chunk) => { + const embeds: APIEmbed[] = chunkedGuilds.map((chunk) => { return { title: `Server List [\`${guilds.length.toLocaleString()}\`]`, color: util.colors.default, @@ -30,7 +31,7 @@ export default class ServersCommand extends BushCommand { `**Members:** ${guild.memberCount.toLocaleString()}` ].join('\n') })) - } as MessageEmbedOptions; + } as APIEmbed; }); return await ButtonPaginator.send(message, embeds); diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index f74dedf..7d29df7 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -2,7 +2,7 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; import chalk from 'chalk'; import { exec } from 'child_process'; -import { ApplicationCommandOptionType, MessageEmbed, Util } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Util } from 'discord.js'; import { promisify } from 'util'; assert(chalk); @@ -45,13 +45,13 @@ export default class ShCommand extends BushCommand { return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); const input = clean(command); - const embed = new MessageEmbed() + const embed = new Embed() .setColor(util.colors.gray) .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp() .setTitle('Shell Command') - .addField('๐ฅ Input', await util.codeblock(input, 1024, 'sh', true)) - .addField('Running', util.emojis.loading); + .addField({ name: '๐ฅ Input', value: await util.codeblock(input, 1024, 'sh', true) }) + .addField({ name: 'Running', value: util.emojis.loading }); await message.util.reply({ embeds: [embed] }); @@ -72,15 +72,15 @@ export default class ShCommand extends BushCommand { .setColor(util.colors.success) .spliceFields(1, 1); - if (stdout) embed.addField('๐ค stdout', await util.codeblock(stdout, 1024, 'json', true)); - if (stderr) embed.addField('๐ค stderr', await util.codeblock(stderr, 1024, 'json', true)); + if (stdout) embed.addField({ name: '๐ค stdout', value: await util.codeblock(stdout, 1024, 'json', true) }); + if (stderr) embed.addField({ 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.addField('๐ค Output', await util.codeblock(e?.stack, 1024, 'js', true)); + embed.addField({ name: '๐ค Output', value: await util.codeblock(e?.stack, 1024, 'js', true) }); } await message.util.edit({ embeds: [embed] }); } diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts index f937ad4..9cdac4a 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -1,5 +1,6 @@ import { BushCommand, type ArgType, type BushMessage } from '#lib'; -import { type ArgumentOptions, type Flag } from 'discord-akairo'; +import { ArgumentGeneratorReturn } from 'discord-akairo'; +import { ArgumentTypeCasterReturn } from 'discord-akairo/dist/src/struct/commands/arguments/Argument'; export default class SuperUserCommand extends BushCommand { public constructor() { @@ -30,8 +31,8 @@ export default class SuperUserCommand extends BushCommand { }); } - override *args(): IterableIterator<ArgumentOptions | Flag> { - const action = yield { + override *args(): ArgumentGeneratorReturn { + const action: 'add' | 'remove' = yield { id: 'action', type: ['add', 'remove'], prompt: { @@ -40,7 +41,8 @@ export default class SuperUserCommand extends BushCommand { optional: false } }; - const user = yield { + + const user: ArgumentTypeCasterReturn<'user'> = yield { id: 'user', type: 'user', match: 'restContent', @@ -50,6 +52,7 @@ export default class SuperUserCommand extends BushCommand { optional: false } }; + return { action, user }; } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 63c1112..b53b2d8 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -4,7 +4,7 @@ import { ActionRowComponent, ButtonComponent, ButtonStyle, - MessageEmbed, + Embed, type ApplicationCommand, type Collection } from 'discord.js'; @@ -60,8 +60,8 @@ export default class TestCommand extends BushCommand { ); return await message.util.reply({ content: 'buttons', components: [ButtonRow] }); } else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) { - const embed = new MessageEmbed() - .addField('Field Name', 'Field Content') + const embed = new Embed() + .addField({ 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') @@ -93,7 +93,7 @@ export default class TestCommand extends BushCommand { } else if (['paginate'].includes(args?.feature?.toLowerCase())) { const embeds = []; for (let i = 1; i <= 5; i++) { - embeds.push(new MessageEmbed().setDescription(i.toString())); + embeds.push(new Embed().setDescription(i.toString())); } return await ButtonPaginator.send(message, embeds); } else if (['lots of embeds'].includes(args?.feature?.toLowerCase())) { diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index 58d8bca..1d1a27b 100644 --- a/src/commands/info/avatar.ts +++ b/src/commands/info/avatar.ts @@ -1,5 +1,5 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, GuildMember, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, GuildMember, Permissions } from 'discord.js'; export default class AvatarCommand extends BushCommand { constructor() { @@ -36,7 +36,7 @@ export default class AvatarCommand extends BushCommand { const guildAvatar = member?.avatarURL(params); - const embed = new MessageEmbed().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`); + const embed = new Embed().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`); guildAvatar ? embed.setImage(guildAvatar).setThumbnail(user.avatarURL(params) ?? defaultAvatar) : embed.setImage(user.avatarURL(params) ?? defaultAvatar); diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 3aea3cd..d899a95 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { MessageEmbed, Permissions, version as discordJSVersion } from 'discord.js'; +import { Embed, Permissions, version as discordJSVersion } from 'discord.js'; import * as os from 'os'; const { default: prettyBytes } = await import('pretty-bytes'); assert(prettyBytes); @@ -39,32 +39,36 @@ export default class BotInfoCommand extends BushCommand { 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', ''); if (repoUrl.includes('.git')) repoUrl = repoUrl.substring(0, repoUrl.length - 4); - const embed = new MessageEmbed() + const embed = new Embed() .setTitle('Bot Info:') - .addField('**Uptime**', util.humanizeDuration(client.uptime!, 2), true) - .addField( - '**Memory Usage**', - `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), { + .addField({ name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true }) + .addField({ + 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 } )}`, - true - ) - .addField('**CPU Usage**', `${client.stats.cpu}%`, true) - .addField('**Platform**', Platform[process.platform], true) - .addField('**Commands Used**', `${client.stats.commandsUsed.toLocaleString()}`, 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**', 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) + inline: true + }) + .addField({ name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true }) + .addField({ name: '**Platform**', value: Platform[process.platform], inline: true }) + .addField({ name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true }) + .addField({ name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true }) + .addField({ name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true }) + .addField({ name: '**Discord.js Version**', value: discordJSVersion, inline: true }) + .addField({ name: '**Node.js Version**', value: process.version.slice(1), inline: true }) + .addField({ name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true }) + .addField({ name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true }) + .addField({ name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true }) + .addField({ name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true }) + .addField({ + name: '**Current Commit**', + value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, + inline: true + }) + .addField({ 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 d385c53..0e1be81 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -9,7 +9,7 @@ import { type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions, Role } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions, Role } from 'discord.js'; import tinycolor from 'tinycolor2'; assert(tinycolor); @@ -74,12 +74,12 @@ export default class ColorCommand extends BushCommand { }); } - const embed = new MessageEmbed() - .addField('ยป Hexadecimal', color.toHexString()) - .addField('ยป Decimal', `${parseInt(color.toHex(), 16)}`) - .addField('ยป HSL', this.removePrefixAndParenthesis(color.toHslString())) - .addField('ยป RGB', this.removePrefixAndParenthesis(color.toRgbString())) - .setColor(color.toHex() as `#${string}`); + const embed = new Embed() + .addField({ name: 'ยป Hexadecimal', value: color.toHexString() }) + .addField({ name: 'ยป Decimal', value: `${parseInt(color.toHex(), 16)}` }) + .addField({ name: 'ยป HSL', value: this.removePrefixAndParenthesis(color.toHslString()) }) + .addField({ 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 afc5111..03f6441 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -3,11 +3,11 @@ import assert from 'assert'; import { GuildDefaultMessageNotifications, GuildExplicitContentFilter } from 'discord-api-types'; import { ApplicationCommandOptionType, + Embed, Guild, GuildMFALevel, GuildPremiumTier, GuildVerificationLevel, - MessageEmbed, Permissions, type BaseGuildVoiceChannel, type GuildPreview, @@ -74,7 +74,7 @@ export default class GuildInfoCommand extends BushCommand { if (verifiedGuilds.includes(guild.id as typeof verifiedGuilds[number])) emojis.push(otherEmojis.BushVerified); if (!isPreview && guild instanceof Guild) { - if (guild.premiumTier !== 'None') emojis.push(otherEmojis[`Boost${guild.premiumTier}`]); + if (guild.premiumTier !== GuildPremiumTier.None) emojis.push(otherEmojis[`BoostTier${guild.premiumTier}`]); await guild.fetch(); const channels = guild.channels.cache; @@ -124,14 +124,14 @@ export default class GuildInfoCommand extends BushCommand { `**Channels:** ${guild.channels.cache.size.toLocaleString()} / 500 (${channelTypes.join(', ')})`, // subtract 1 for @everyone role `**Roles:** ${((guild.roles.cache.size ?? 0) - 1).toLocaleString()} / 250`, - `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${(<any>EmojiTierMap)[guild.premiumTier]}`, - `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${(<any>StickerTierMap)[guild.premiumTier]}` + `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${EmojiTierMap[guild.premiumTier]}`, + `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${StickerTierMap[guild.premiumTier]}` ); guildSecurity.push( - `**Verification Level**: ${(<any>BushGuildVerificationLevel)[guild.verificationLevel]}`, - `**Explicit Content Filter:** ${(<any>BushGuildExplicitContentFilter)[guild.explicitContentFilter]}`, - `**Default Message Notifications:** ${(<any>BushGuildDefaultMessageNotifications)[guild.defaultMessageNotifications]}`, + `**Verification Level**: ${BushGuildVerificationLevel[guild.verificationLevel]}`, + `**Explicit Content Filter:** ${BushGuildExplicitContentFilter[guild.explicitContentFilter]}`, + `**Default Message Notifications:** ${BushGuildDefaultMessageNotifications[guild.defaultMessageNotifications]}`, `**2FA Required**: ${guild.mfaLevel === GuildMFALevel.Elevated ? 'True' : 'False'}` ); } else { @@ -168,17 +168,17 @@ export default class GuildInfoCommand extends BushCommand { emojis.push(`\n\n${guild.description}`); } - const guildInfoEmbed = new MessageEmbed() + const guildInfoEmbed = new Embed() .setTitle(guild.name) .setColor(util.colors.default) - .addField('ยป About', guildAbout.join('\n')); - if (guildStats.length) guildInfoEmbed.addField('ยป Stats', guildStats.join('\n')); + .addField({ name: 'ยป About', value: guildAbout.join('\n') }); + if (guildStats.length) guildInfoEmbed.addField({ name: 'ยป Stats', value: guildStats.join('\n') }); |
