diff options
Diffstat (limited to 'src')
86 files changed, 583 insertions, 523 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.m |
