From 743433cd86f47294dff602cde242292549c5cdde Mon Sep 17 00:00:00 2001 From: Maisy Date: Sat, 30 Jul 2022 17:57:53 -0500 Subject: [PATCH 1/2] Initial changes for 0.11.0 --- package.json | 7 +- src/ContextMenuBase.ts | 8 +- src/OptionTypes.ts | 2 + src/Page.ts | 80 ++++------- src/PageComponents.ts | 105 ++++++++------ src/PingableTimedCache.ts | 3 +- src/SlashCommandBase.ts | 93 ++++++++---- src/SlashasaurusClient.ts | 93 ++++++------ src/TemplateModal.ts | 26 ++-- src/utilityTypes.ts | 34 ++--- yarn.lock | 292 +++++++++++++++++++------------------- 11 files changed, 384 insertions(+), 359 deletions(-) diff --git a/package.json b/package.json index 043c0a8..5e55890 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "slashasaurus", - "version": "0.10.4", + "version": "0.11.0-beta.0", "main": "dist/index.js", "types": "dist/index.d.ts", "license": "MIT", @@ -12,21 +12,20 @@ "@types/node": "^17.0.21", "@typescript-eslint/eslint-plugin": "^5.27.0", "@typescript-eslint/parser": "^5.27.0", - "discord.js": "^13.7.0", + "discord.js": "^14.0.1", "eslint": "^8.16.0", "prettier": "^2.3.2", "rimraf": "^3.0.2", "typescript": "4.5.5" }, "peerDependencies": { - "discord.js": "^13.7.0" + "discord.js": "^14.0.1" }, "repository": { "type": "git", "url": "https://github.com/Rodentman87/slashasaurus.git" }, "dependencies": { - "@discordjs/builders": "^0.15.0", "@discordjs/rest": "^0.5.0", "discord-api-types": "^0.33.0" } diff --git a/src/ContextMenuBase.ts b/src/ContextMenuBase.ts index 7f5d69d..82c8d9c 100644 --- a/src/ContextMenuBase.ts +++ b/src/ContextMenuBase.ts @@ -1,6 +1,6 @@ import type { - MessageContextMenuInteraction, - UserContextMenuInteraction, + MessageContextMenuCommandInteraction, + UserContextMenuCommandInteraction, } from 'discord.js'; import type { LocalizationMap } from 'discord-api-types/v10'; import { SlashasaurusClient } from './SlashasaurusClient'; @@ -16,11 +16,11 @@ type ContextCommandOptions = { export type ContextMenuHandlerType = T extends 'MESSAGE' ? ( - interaction: MessageContextMenuInteraction, + interaction: MessageContextMenuCommandInteraction, client: SlashasaurusClient ) => void : ( - interaction: UserContextMenuInteraction, + interaction: UserContextMenuCommandInteraction, client: SlashasaurusClient ) => void; diff --git a/src/OptionTypes.ts b/src/OptionTypes.ts index 857d510..03e31d9 100644 --- a/src/OptionTypes.ts +++ b/src/OptionTypes.ts @@ -53,6 +53,8 @@ type StringChoiceResolvableType = interface StringOptionsData extends BaseApplicationCommandOptionsData { readonly type: StringChoiceResolvableType; + readonly minLength?: number; + readonly maxLength?: number; } interface StringChoiceOptionsData diff --git a/src/Page.ts b/src/Page.ts index 7e1d6dc..43ef817 100644 --- a/src/Page.ts +++ b/src/Page.ts @@ -1,21 +1,20 @@ +import { EmbedBuilder } from '@discordjs/builders'; import { - BaseCommandInteraction, - ButtonInteraction, CommandInteraction, + ButtonInteraction, InteractionWebhook, Message, - MessageActionRow, - MessageActionRowComponent, - MessageButton, MessageComponentInteraction, - MessageEmbed, MessageOptions, MessagePayload, SelectMenuInteraction, TextBasedChannel, WebhookEditMessageOptions, + ActionRowBuilder, + APIEmbed, + MessageActionRowComponentBuilder, + Embed, } from 'discord.js'; -import { MessageButtonStyles } from 'discord.js/typings/enums'; import { PageActionRow, PageButton, PageSelect } from './PageComponents'; import { SlashasaurusClient } from './SlashasaurusClient'; import { MaybePromise } from './utilityTypes'; @@ -42,6 +41,7 @@ type PageComponentRows = (PageComponentArray | PageActionRow)[]; export interface RenderedPage extends Omit { components?: PageComponentRows; + embeds?: (APIEmbed | EmbedBuilder)[]; } // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -128,7 +128,7 @@ export abstract class Page< } sendAsReply( - interaction: MessageComponentInteraction | BaseCommandInteraction, + interaction: MessageComponentInteraction | CommandInteraction, ephemeral = false ) { this.client.replyToInteractionWithPage(this, interaction, ephemeral); @@ -205,12 +205,13 @@ export type DeserializeStateFn< export function pageComponentRowsToComponents( rows: PageComponentRows, page: Page -): MessageActionRow[] { +): ActionRowBuilder[] { page.clearHandlers(); const pageId = page.constructor.pageId; return rows .map((row) => { - const actionRow = new MessageActionRow(); + const actionRow = + new ActionRowBuilder(); if (row instanceof PageActionRow) { row.children.forEach((component) => { actionRow.addComponents( @@ -228,8 +229,9 @@ export function pageComponentRowsToComponents( } return actionRow; }) - .filter( - (e): e is MessageActionRow => e instanceof MessageActionRow + .filter>( + (e): e is ActionRowBuilder => + e instanceof ActionRowBuilder ); } @@ -243,11 +245,7 @@ function componentToDjsComponent( `~${pageId};${page.registerHandler(component.handler)}` ); } else { - return new MessageButton({ - ...component, - style: MessageButtonStyles.LINK, - type: 'BUTTON', - }); + return component.toDjsComponent(); } } @@ -284,18 +282,14 @@ export function compareMessages( // Check Embeds if ( - // @ts-expect-error There's some weird stuff with generic intersections that breaks here, but this is fine - a.embeds.filter((e) => e.type === 'rich').length !== (b.embeds ?? []).length + a.embeds.filter((e) => e.data.type === 'rich').length !== + (b.embeds ?? []).length ) return false; if (a.embeds.length > 0) { if ( !(b.embeds ?? []).every((bEmbedData, index) => { - const bEmbed = - bEmbedData instanceof MessageEmbed - ? bEmbedData - : new MessageEmbed(bEmbedData); - // return bEmbed.equals(a.embeds[index]); + const bEmbed = 'data' in bEmbedData ? bEmbedData.data : bEmbedData; return embedsAreEqual(a.embeds[index], bEmbed); }) ) { @@ -306,15 +300,9 @@ export function compareMessages( return true; } -function embedsAreEqual( - a: MessageComponentInteraction['message']['embeds'][number], - b: MessageEmbed -) { - if (a.type !== 'rich') return true; - +function embedsAreEqual(a: Embed, b: APIEmbed) { if ( a.title !== (b.title ? b.title.trim() : b.title) || - a.type !== b.type || a.description !== (b.description ? b.description.trim() : b.description) || a.url !== b.url || (a.color ?? 0) !== b.color @@ -329,17 +317,12 @@ function embedsAreEqual( // Compare authors const headerIconUrl = - a.author && - ('iconURL' in a.author - ? a.author.iconURL - : 'icon_url' in a.author - ? a.author.icon_url - : undefined); + a.author && ('iconURL' in a.author ? a.author.iconURL : undefined); if ( a.author && b.author && (a.author.name !== b.author.name?.trim() || - headerIconUrl !== b.author.iconURL || + headerIconUrl !== b.author.icon_url || a.author.url !== b.author.url) ) return false; @@ -347,17 +330,12 @@ function embedsAreEqual( // Compare footers const footerIconUrl = - a.footer && - ('iconURL' in a.footer - ? a.footer.iconURL - : 'icon_url' in a.footer - ? a.footer.icon_url - : undefined); + a.footer && ('iconURL' in a.footer ? a.footer.iconURL : undefined); if ( a.footer && b.footer && (a.footer?.text !== b.footer?.text?.trim() || - footerIconUrl !== b.footer?.iconURL) + footerIconUrl !== b.footer?.icon_url) ) return false; else if ((a.footer && !b.footer) || (b.footer && !a.footer)) return false; @@ -377,11 +355,13 @@ function embedsAreEqual( return false; // Compare fields - if ((a.fields ?? []).length !== b.fields.length) return false; - return (a.fields ?? []).every( + const aFields = a.fields ?? []; + const bFields = b.fields ?? []; + if (aFields.length !== bFields.length) return false; + return aFields.every( (f, i) => - f.inline === b.fields[i].inline && - f.name === b.fields[i].name?.trim() && - f.value === b.fields[i].value?.trim() + f.inline === bFields[i].inline && + f.name === bFields[i].name?.trim() && + f.value === bFields[i].value?.trim() ); } diff --git a/src/PageComponents.ts b/src/PageComponents.ts index 58fda83..e0968c2 100644 --- a/src/PageComponents.ts +++ b/src/PageComponents.ts @@ -1,27 +1,30 @@ +import { SelectMenuBuilder } from '@discordjs/builders'; import { + ButtonBuilder, ButtonInteraction, - EmojiIdentifierResolvable, - ExcludeEnum, - MessageButton, - MessageComponent, + ButtonStyle, + ComponentEmojiResolvable, + ComponentType, MessageComponentInteraction, - MessageSelectMenu, - MessageSelectOptionData, SelectMenuInteraction, - Util, + parseEmoji, + SelectMenuOptionBuilder, } from 'discord.js'; -import { MessageButtonStyles } from 'discord.js/typings/enums'; -type NonLinkStyles = ExcludeEnum; +type NonLinkStyles = + | ButtonStyle.Danger + | ButtonStyle.Secondary + | ButtonStyle.Primary + | ButtonStyle.Success; type PageButtonLabelOptions = | { label: string; - emoji?: EmojiIdentifierResolvable; + emoji?: ComponentEmojiResolvable; } | { label?: string; - emoji: EmojiIdentifierResolvable; + emoji: ComponentEmojiResolvable; }; type PotentialDjsComponent = NonNullable< @@ -29,7 +32,7 @@ type PotentialDjsComponent = NonNullable< >[number]['components'][number]; interface ExportableToDjsComponent { - toDjsComponent(id: string): MessageComponent; + toDjsComponent(id: string): ButtonBuilder | SelectMenuBuilder; } export function createInteractable

( @@ -89,10 +92,10 @@ export type PageLinkButtonOptions = { export class PageInteractableButton implements ExportableToDjsComponent { type: 'BUTTON' = 'BUTTON'; handler: (interaction: ButtonInteraction) => void; - style: NonLinkStyles = 'SECONDARY'; + style: NonLinkStyles = ButtonStyle.Secondary; disabled = false; label?: string; - emoji?: EmojiIdentifierResolvable; + emoji?: ComponentEmojiResolvable; constructor(options: PageInteractableButtonOptions) { this.handler = options.handler; @@ -102,26 +105,27 @@ export class PageInteractableButton implements ExportableToDjsComponent { if (options.emoji) this.emoji = options.emoji; } - toDjsComponent(id: string): MessageButton { - return new MessageButton({ - ...this, + toDjsComponent(id: string): ButtonBuilder { + const builder = new ButtonBuilder({ + style: this.style, + disabled: this.disabled, customId: id, }); + if (this.label) builder.setLabel(this.label); + if (this.emoji) builder.setEmoji(this.emoji); + return builder; } compareToComponent(component: PotentialDjsComponent) { - if (!(component.type === 'BUTTON' || component.type === 2)) return false; + if (!(component.type === ComponentType.Button)) return false; if ((this.emoji && !component.emoji) || (!this.emoji && component.emoji)) return false; if (this.emoji && component.emoji) { if (!compareEmoji(this.emoji, component.emoji)) return false; } return ( - // @ts-expect-error this is private but we need to use it - MessageButton.resolveStyle(this.style) === - // @ts-expect-error this is private but we need to use it - MessageButton.resolveStyle(component.style as any) && - this.disabled === component.disabled && + this.style === component.style && + this.disabled === (component.disabled ?? false) && (this.label ?? null) === component.label ); } @@ -132,7 +136,7 @@ export class PageLinkButton implements ExportableToDjsComponent { url: string; disabled = false; label?: string; - emoji?: EmojiIdentifierResolvable; + emoji?: ComponentEmojiResolvable; constructor(options: PageLinkButtonOptions) { this.url = options.url; @@ -141,22 +145,25 @@ export class PageLinkButton implements ExportableToDjsComponent { if (options.emoji) this.emoji = options.emoji; } - toDjsComponent(): MessageButton { - return new MessageButton({ - ...this, - style: 'LINK', + toDjsComponent(): ButtonBuilder { + const builder = new ButtonBuilder({ + style: ButtonStyle.Link, + disabled: this.disabled, }); + if (this.label) builder.setLabel(this.label); + if (this.emoji) builder.setEmoji(this.emoji); + return builder; } compareToComponent(component: PotentialDjsComponent) { - if (!(component.type === 'BUTTON' || component.type === 2)) return false; + if (!(component.type === ComponentType.Button)) return false; if ((this.emoji && !component.emoji) || (!this.emoji && component.emoji)) return false; if (this.emoji && component.emoji) { if (!compareEmoji(this.emoji, component.emoji)) return false; } return ( - ('LINK' === component.style || 5 === component.style) && + ButtonStyle.Link === component.style && this.disabled === component.disabled && (this.label ?? null) === component.label && this.url === component.url @@ -168,7 +175,7 @@ export type PageButton = PageInteractableButton | PageLinkButton; export interface PageSelectOptions { handler: (interaction: SelectMenuInteraction) => void; - options: MessageSelectOptionData[]; + options: SelectMenuOptionBuilder[]; placeholder?: string; minValues?: number; maxValues?: number; @@ -178,7 +185,7 @@ export interface PageSelectOptions { export class PageSelect implements ExportableToDjsComponent { type: 'SELECT_MENU' = 'SELECT_MENU'; handler: (interaction: SelectMenuInteraction) => void; - options: MessageSelectOptionData[]; + options: SelectMenuOptionBuilder[]; placeholder?: string; minValues = 1; maxValues = 1; @@ -194,14 +201,19 @@ export class PageSelect implements ExportableToDjsComponent { } toDjsComponent(id: string) { - return new MessageSelectMenu({ - ...this, - customId: id, + const builder = new SelectMenuBuilder({ + min_values: this.minValues, + max_values: this.maxValues, + disabled: this.disabled, + custom_id: id, }); + builder.addOptions(this.options); + if (this.placeholder) builder.setPlaceholder(this.placeholder); + return builder; } compareToComponent(component: PotentialDjsComponent) { - if (!(component.type === 'SELECT_MENU')) return false; + if (!(component.type === ComponentType.SelectMenu)) return false; if ( this.disabled !== component.disabled || this.maxValues !== component.maxValues || @@ -214,16 +226,19 @@ export class PageSelect implements ExportableToDjsComponent { const other = component.options[index]; if ( - other.default !== (option.default ?? false) || - other.description !== (option.description ?? null) || - other.label !== option.label || - other.value !== option.value + other.default !== (option.data.default ?? false) || + other.description !== (option.data.description ?? null) || + other.label !== option.data.label || + other.value !== option.data.value ) return false; - if ((option.emoji && !other.emoji) || (!option.emoji && other.emoji)) + if ( + (option.data.emoji && !other.emoji) || + (!option.data.emoji && other.emoji) + ) return false; - if (option.emoji && other.emoji) { - if (!compareEmoji(option.emoji, other.emoji)) return false; + if (option.data.emoji && other.emoji) { + if (!compareEmoji(option.data.emoji, other.emoji)) return false; } return true; }); @@ -231,10 +246,10 @@ export class PageSelect implements ExportableToDjsComponent { } function compareEmoji( - a: EmojiIdentifierResolvable, + a: ComponentEmojiResolvable, bEmoji: { id?: string | null; name?: string | null } ) { - const aEmoji = Util.resolvePartialEmoji(a); + const aEmoji = typeof a === 'string' ? parseEmoji(a) : a; if (!aEmoji) return false; if (aEmoji.id) { return aEmoji.id === bEmoji.id; diff --git a/src/PingableTimedCache.ts b/src/PingableTimedCache.ts index da62468..c1d2071 100644 --- a/src/PingableTimedCache.ts +++ b/src/PingableTimedCache.ts @@ -3,8 +3,7 @@ export class PingableTimedCache { private cache: Map = new Map(); private ttl: number; - // @ts-ignore - private timer: NodeJS.Timer; + public timer: NodeJS.Timer; private leaveHook?: (value: T) => void; constructor(ttl: number, leaveHook?: (value: T) => void) { diff --git a/src/SlashCommandBase.ts b/src/SlashCommandBase.ts index 1e55a7a..b8d8dbb 100644 --- a/src/SlashCommandBase.ts +++ b/src/SlashCommandBase.ts @@ -1,18 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { AutocompleteInteraction, CommandInteraction } from 'discord.js'; -import { - LocalizationMap, - ApplicationCommandOptionType, -} from 'discord-api-types/v10'; -import { SlashasaurusClient } from './SlashasaurusClient'; -import { - MapOptionsToAutocompleteNames, - CommandOptionsObject, - MaybePromise, -} from './utilityTypes'; -import { ApplicationCommandOptionData, OptionsDataArray } from './OptionTypes'; -import { ValidationError } from './CustomErrors'; import { + AutocompleteInteraction, + ChatInputCommandInteraction, + CommandInteraction, + InteractionType, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, @@ -24,7 +15,19 @@ import { SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandUserOption, -} from '@discordjs/builders'; +} from 'discord.js'; +import { + LocalizationMap, + ApplicationCommandOptionType, +} from 'discord-api-types/v10'; +import { SlashasaurusClient } from './SlashasaurusClient'; +import { + MapOptionsToAutocompleteNames, + CommandOptionsObject, + MaybePromise, +} from './utilityTypes'; +import { ApplicationCommandOptionData, OptionsDataArray } from './OptionTypes'; +import { ValidationError } from './CustomErrors'; type ChatCommandOptions = { name: string; @@ -161,7 +164,7 @@ export class SlashCommand { } async validateAndTransformOptions( - interaction: CommandInteraction + interaction: ChatInputCommandInteraction ): Promise | string[]>; async validateAndTransformOptions( interaction: AutocompleteInteraction, @@ -169,20 +172,28 @@ export class SlashCommand { skipValidationAndTransformation: boolean ): Promise>; async validateAndTransformOptions( - interaction: CommandInteraction | AutocompleteInteraction, + interaction: ChatInputCommandInteraction | AutocompleteInteraction, skipRequiredCheck = false, skipValidationAndTransformation = false ): Promise | string[]> { const errors: string[] = []; - const values: Record> = {}; + const values: Record> = {}; for (const option of this.commandInfo.options) { // Get the option data - let value = getDataForType( - interaction, - option.type, - option.name, - skipRequiredCheck ? false : option.required ?? false - ); + let value = + interaction.type === InteractionType.ApplicationCommand + ? getCommandDataForType( + interaction, + option.type, + option.name, + skipRequiredCheck ? false : option.required ?? false + ) + : getAutocompleteDataForType( + interaction, + option.type, + option.name, + skipRequiredCheck ? false : option.required ?? false + ); // If the value is undefined, assign early and continue to skip the rest of the validation and transformation if (value === null) { @@ -241,8 +252,8 @@ export class SlashCommand { } } -function getDataForType( - interaction: CommandInteraction | AutocompleteInteraction, +function getCommandDataForType( + interaction: ChatInputCommandInteraction, type: ApplicationCommandOptionData['type'], name: string, required: boolean @@ -260,7 +271,10 @@ function getDataForType( case 'USER': case ApplicationCommandOptionType.User: if (interaction.inGuild()) - return interaction.options.getMember(name, required); + return ( + interaction.options.getMember(name) ?? + interaction.options.getUser(name, required) + ); return interaction.options.getUser(name, required); case 'CHANNEL': case ApplicationCommandOptionType.Channel: @@ -280,6 +294,29 @@ function getDataForType( } } +function getAutocompleteDataForType( + interaction: AutocompleteInteraction, + type: ApplicationCommandOptionData['type'], + name: string, + required: boolean +) { + switch (type) { + case 'STRING': + case ApplicationCommandOptionType.String: + return interaction.options.getString(name, required); + case 'INTEGER': + case ApplicationCommandOptionType.Integer: + return interaction.options.getInteger(name, required); + case 'BOOLEAN': + case ApplicationCommandOptionType.Boolean: + return interaction.options.getBoolean(name, required); + case 'NUMBER': + case ApplicationCommandOptionType.Number: + return interaction.options.getNumber(name, required); + } + return null; +} + export function populateBuilder< T extends SlashCommandBuilder | SlashCommandSubcommandBuilder >(info: ChatCommandOptions<[]>, builder: T) { @@ -313,6 +350,10 @@ export function populateBuilder< .setDescriptionLocalizations(option.descriptionLocalizations ?? null) .setRequired(option.required ?? false) .setAutocomplete(option.autocomplete ?? false); + if ('minLength' in option && option.minLength) + string.setMinLength(option.minLength); + if ('maxLength' in option && option.maxLength) + string.setMaxLength(option.maxLength); if ('choices' in option && option.choices) { string.setChoices( ...option.choices.map((choice) => ({ diff --git a/src/SlashasaurusClient.ts b/src/SlashasaurusClient.ts index 77c8608..f1a7e6a 100644 --- a/src/SlashasaurusClient.ts +++ b/src/SlashasaurusClient.ts @@ -1,17 +1,19 @@ import { AutocompleteInteraction, Awaitable, - BaseCommandInteraction, BaseGuildTextChannel, BitFieldResolvable, ButtonInteraction, + ChatInputCommandInteraction, Client, ClientEvents, ClientOptions, CommandInteraction, - ContextMenuInteraction, + ComponentType, + ContextMenuCommandInteraction, DMChannel, Interaction, + InteractionType, InteractionWebhook, Message, MessageComponentInteraction, @@ -64,7 +66,7 @@ interface SlashasaurusClientEvents extends ClientEvents { commandRun: [intercation: CommandInteraction]; buttonPressed: [interaction: ButtonInteraction]; selectChanged: [interaction: SelectMenuInteraction]; - contextMenuRun: [interaction: ContextMenuInteraction]; + contextMenuRun: [interaction: ContextMenuCommandInteraction]; autocomplete: [interaction: AutocompleteInteraction]; modalSubmit: [interaction: ModalSubmitInteraction]; } @@ -228,8 +230,6 @@ export class SlashasaurusClient extends Client { * * @param folderPath The relative path to the folder */ - // TODO: guild specific commands - // guild commands will be a 0.3 thing probably tbh (lol ok that totally happened :mmLol:) async registerCommandsFrom( folderPath: string, register: false @@ -840,33 +840,44 @@ export class SlashasaurusClient extends Client { private handleInteractionEvent(interaction: Interaction) { this.logger?.debug(interaction); - if (interaction.isCommand()) { - // This is a command, pass it to our command handlers - this.handleCommand(interaction); - this.emit('commandRun', interaction); - } else if (interaction.isButton()) { - if (interaction.customId.startsWith('~')) { - this.handlePageButton(interaction); - } - this.emit('buttonPressed', interaction); - } else if (interaction.isSelectMenu()) { - if (interaction.customId.startsWith('~')) { - this.handlePageSelect(interaction); - } - this.emit('selectChanged', interaction); - } else if (interaction.isContextMenu()) { - this.handleContextMenu(interaction); - this.emit('contextMenuRun', interaction); - } else if (interaction.isAutocomplete()) { - this.handleAutocomplete(interaction); - this.emit('autocomplete', interaction); - } else if (interaction.isModalSubmit()) { - this.handleModalSubmit(interaction); - this.emit('modalSubmit', interaction); + switch (interaction.type) { + case InteractionType.ApplicationCommand: + if (interaction.commandType === ApplicationCommandType.ChatInput) { + this.handleCommand(interaction); + this.emit('commandRun', interaction); + } else if ( + interaction.commandType === ApplicationCommandType.Message || + interaction.commandType === ApplicationCommandType.User + ) { + this.handleContextMenu(interaction); + this.emit('contextMenuRun', interaction); + } + break; + case InteractionType.ApplicationCommandAutocomplete: + this.handleAutocomplete(interaction); + this.emit('autocomplete', interaction); + break; + case InteractionType.MessageComponent: + if (interaction.componentType === ComponentType.Button) { + if (interaction.customId.startsWith('~')) { + this.handlePageButton(interaction); + } + this.emit('buttonPressed', interaction); + } else if (interaction.componentType === ComponentType.SelectMenu) { + if (interaction.customId.startsWith('~')) { + this.handlePageSelect(interaction); + } + this.emit('selectChanged', interaction); + } + break; + case InteractionType.ModalSubmit: + this.handleModalSubmit(interaction); + this.emit('modalSubmit', interaction); + break; } } - private async handleCommand(interaction: CommandInteraction) { + private async handleCommand(interaction: ChatInputCommandInteraction) { let commandName = interaction.commandName; // @ts-expect-error This is TS-private, but I know what I'm doing if (interaction.options._group) { @@ -942,10 +953,10 @@ export class SlashasaurusClient extends Client { } } - private async handleContextMenu(interaction: ContextMenuInteraction) { + private async handleContextMenu(interaction: ContextMenuCommandInteraction) { const commandName = interaction.commandName; const command = - interaction.targetType === 'MESSAGE' + interaction.commandType === ApplicationCommandType.Message ? this.messageContextMenuMap.get(commandName) : this.userContextMenuMap.get(commandName); if (!command) { @@ -955,12 +966,8 @@ export class SlashasaurusClient extends Client { throw new Error(`Unregistered command ${commandName} was run`); } else { this.logger?.info(`Running context command ${commandName}`); - this.contextMenuMiddleware.execute( - command.run, - // @ts-expect-error this will complain that the types don't match, but it's a waste of a check to split this here. - interaction, - this - ); + // @ts-expect-error This is going to complain because the context menu handler is typed with a more specific type + this.contextMenuMiddleware.execute(command.run, interaction, this); } } @@ -1068,17 +1075,15 @@ export class SlashasaurusClient extends Client { const modal = this.modalMap.get(interaction.customId); if (!modal) return; const values: Record = {}; - interaction.components.forEach((row) => { - row.components.forEach((component) => { - values[component.customId] = component.value; - }); + interaction.fields.fields.forEach((field) => { + values[field.customId] = field.value; }); modal.handler(interaction, values); } async replyToInteractionWithPage( page: Page, - interaction: MessageComponentInteraction | BaseCommandInteraction, + interaction: MessageComponentInteraction | CommandInteraction, ephemeral: boolean ) { const messageOptions = await page.render(); @@ -1092,7 +1097,7 @@ export class SlashasaurusClient extends Client { ephemeral: true, fetchReply: true, flags: messageOptions.flags as unknown as BitFieldResolvable< - 'SUPPRESS_EMBEDS' | 'EPHEMERAL', + 'SuppressEmbeds' | 'Ephemeral', number >, }); @@ -1116,7 +1121,7 @@ export class SlashasaurusClient extends Client { : [], fetchReply: true, flags: messageOptions.flags as unknown as BitFieldResolvable< - 'SUPPRESS_EMBEDS' | 'EPHEMERAL', + 'SuppressEmbeds' | 'Ephemeral', number >, }); diff --git a/src/TemplateModal.ts b/src/TemplateModal.ts index 20bb006..0e08f80 100644 --- a/src/TemplateModal.ts +++ b/src/TemplateModal.ts @@ -1,12 +1,12 @@ +import { TextInputBuilder } from '@discordjs/builders'; import { - MessageActionRow, - Modal, - ModalActionRowComponent, + ActionRowBuilder, + ModalBuilder, ModalSubmitInteraction, - TextInputComponent, TextInputStyle, + ModalActionRowComponentBuilder, + ComponentType, } from 'discord.js'; -import { TextInputStyles } from 'discord.js/typings/enums'; type ExtractFromDelimiters< S extends string, @@ -116,18 +116,22 @@ export class TemplateModal< this.handler = handler; } - public getModal(variables: GetModalVariablesInput): Modal { + public getModal(variables: GetModalVariablesInput): ModalBuilder { const title = replaceVariables(this.title, variables); - const modal = new Modal({ + const modal = new ModalBuilder({ title, customId: this.customId, components: this.components.map((component) => { - const row = new MessageActionRow(); - const textInput = new TextInputComponent({ - ...component, - style: component.style ?? TextInputStyles.SHORT, + const row = new ActionRowBuilder(); + const textInput = new TextInputBuilder({ + type: ComponentType.TextInput, + custom_id: component.customId, + style: component.style ?? TextInputStyle.Short, label: replaceVariables(component.label, variables), + required: component.required, }); + if (component.maxLength) textInput.setMaxLength(component.maxLength); + if (component.minLength) textInput.setMinLength(component.minLength); if (component.placeholder) textInput.setPlaceholder( replaceVariables(component.placeholder, variables) diff --git a/src/utilityTypes.ts b/src/utilityTypes.ts index 874283a..4dbbd15 100644 --- a/src/utilityTypes.ts +++ b/src/utilityTypes.ts @@ -3,15 +3,13 @@ import { ApplicationCommandOptionChoiceData, CategoryChannel, CommandInteractionOptionResolver, - ExcludeEnum, NewsChannel, StageChannel, - StoreChannel, TextChannel, ThreadChannel, VoiceChannel, + ChannelType, } from 'discord.js'; -import { ChannelTypes } from 'discord.js/typings/enums'; import { OptionsDataArray, ApplicationCommandOptionData } from './OptionTypes'; export type ExtractArrayType = ((a: T) => never) extends ( @@ -87,38 +85,22 @@ export type OptionsMap = { }; type ChannelsMap = { - GUILD_TEXT: TextChannel; 0: TextChannel; - DM: never; - 1: never; - GUILD_VOICE: VoiceChannel; + 1: never; // DM 2: VoiceChannel; - GROUP_DM: never; - 3: never; - GUILD_CATEGORY: CategoryChannel; + 3: never; // Group DM 4: CategoryChannel; - GUILD_NEWS: NewsChannel; 5: NewsChannel; - GUILD_STORE: StoreChannel; - 6: StoreChannel; - GUILD_NEWS_THREAD: ThreadChannel; 10: ThreadChannel; - GUILD_PUBLIC_THREAD: ThreadChannel; 11: ThreadChannel; - GUILD_PRIVATE_THREAD: ThreadChannel; 12: ThreadChannel; - GUILD_STAGE_VOICE: StageChannel; 13: StageChannel; - GUILD_DIRECTORY: never; - 14: never; + 14: never; // Directory + 15: never; // Forum }; -type MapChannelTypesToChannels< - T extends ReadonlyArray> -> = { - [K in keyof T]: T[K] extends ExcludeEnum - ? ChannelsMap[T[K]] - : never; +type MapChannelTypesToChannels> = { + [K in keyof T]: T[K] extends ChannelType ? ChannelsMap[T[K]] : never; }[number]; type OptionToValue = T extends { @@ -129,7 +111,7 @@ type OptionToValue = T extends { : T extends HasChoices ? MapChoicesToValues : T extends { - channelTypes: ReadonlyArray>; + channelTypes: ReadonlyArray; } ? | MapChannelTypesToChannels diff --git a/yarn.lock b/yarn.lock index a95d729..ee24d1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,40 +2,27 @@ # yarn lockfile v1 -"@discordjs/builders@^0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-0.13.0.tgz#2b689263663dbae0b8cedbe8cf581ee724bb505d" - integrity sha512-4L9y26KRNNU8Y7J78SRUN1Uhava9D8jfit/YqEaKi8gQRc7PdqKqk2poybo6RXaiyt/BgKYPfcjxT7WvzGfYCA== - dependencies: - "@sapphire/shapeshift" "^2.0.0" - "@sindresorhus/is" "^4.6.0" - discord-api-types "^0.31.1" - fast-deep-equal "^3.1.3" - ts-mixer "^6.0.1" - tslib "^2.3.1" - -"@discordjs/builders@^0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-0.15.0.tgz#f76318f2de0b057c21bb25bb010ef2317039793d" - integrity sha512-w1UfCPzx2iKycn6qh/f0c+PcDpcTHzHr7TXALXu/a4gKHGamiSg3lP8GhYswweSJk/Q5cbFLHZUsnoY3MVKNAg== +"@discordjs/builders@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-1.0.0.tgz#1ddc5a7f9d20977e7414c02989169bb7f55294ba" + integrity sha512-8y91ZfpOHubiGJu5tVyGI9tQCEyHZDTeqUWVcJd0dq7B96xIf84S0L4fwmD1k9zTe1eqEFSk0gc7BpY+FKn7Ww== dependencies: - "@sapphire/shapeshift" "^3.1.0" - "@sindresorhus/is" "^4.6.0" - discord-api-types "^0.33.3" + "@sapphire/shapeshift" "^3.5.1" + discord-api-types "^0.36.2" fast-deep-equal "^3.1.3" ts-mixer "^6.0.1" tslib "^2.4.0" -"@discordjs/collection@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.6.0.tgz#ee9c7b349a61d081fcdbda36df4187e575510952" - integrity sha512-Ieaetb36l0nmAS5X9Upqk4W7euAO6FdXPxn3I8vBAKEcoIzEZI1mcVcPfCfagGJZSgBKpENnAnKkP4GAn+MV8w== - "@discordjs/collection@^0.7.0": version "0.7.0" resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.7.0.tgz#1a6c00198b744ba2b73a64442145da637ac073b8" integrity sha512-R5i8Wb8kIcBAFEPLLf7LVBQKBDYUL+ekb23sOgpkpyGT+V4P7V83wTxcsqmX+PbqHt4cEHn053uMWfRqh/Z/nA== +"@discordjs/collection@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-1.0.0.tgz#4d777d87e56640a200200e7f5605c0fba05ac1b8" + integrity sha512-nAxDQYE5dNAzEGQ7HU20sujDsG5vLowUKCEqZkKUIlrXERZFTt/60zKUj/g4+AVCGeq+pXC5hivMaNtiC+PY5Q== + "@discordjs/rest@^0.5.0": version "0.5.0" resolved "https://registry.yarnpkg.com/@discordjs/rest/-/rest-0.5.0.tgz#dc5bd68e33bf8dd1cf08cf3c55b2901deb92eb5d" @@ -48,6 +35,19 @@ tslib "^2.4.0" undici "^5.4.0" +"@discordjs/rest@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@discordjs/rest/-/rest-1.0.0.tgz#624ac48cf8f66f46d47371323963a0c0617ddd63" + integrity sha512-uDAvnE0P2a8axMdD4C51EGjvCRQ2HZk2Yxf6vHWZgIqG87D8DGKMPwmquIxrrB07MjV+rwci2ObU+mGhGP+bJg== + dependencies: + "@discordjs/collection" "^1.0.0" + "@sapphire/async-queue" "^1.3.2" + "@sapphire/snowflake" "^3.2.2" + discord-api-types "^0.36.2" + file-type "^17.1.2" + tslib "^2.4.0" + undici "^5.7.0" + "@eslint/eslintrc@^1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.0.tgz#29f92c30bb3e771e4a2048c95fa6855392dfac4f" @@ -103,39 +103,34 @@ resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.3.1.tgz#9d861e626dbffae02d808e13f823d4510e450a78" integrity sha512-FFTlPOWZX1kDj9xCAsRzH5xEJfawg1lNoYAA+ecOWJMHOfiZYb1uXOI3ne9U4UILSEPwfE68p3T9wUHwIQfR0g== -"@sapphire/shapeshift@^2.0.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@sapphire/shapeshift/-/shapeshift-2.2.0.tgz#9c1221b538fd0f966766158176c686a3a5c98490" - integrity sha512-UEnKgMlQyI0yY/q+lCMX0VJft9y86IsesgbIQj6e62FBYSaMVr+IaMNpi4z45Q14VnuMACbK0yrbHISNqgUYcQ== +"@sapphire/async-queue@^1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.3.2.tgz#befe5f5025e2e317a9eba2d1a24ca5d2e4576f86" + integrity sha512-rUpMLATsoAMnlN3gecAcr9Ecnw1vG7zi5Xr+IX22YzRzi1k9PF9vKzoT8RuEJbiIszjcimu3rveqUnvwDopz8g== -"@sapphire/shapeshift@^3.1.0": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@sapphire/shapeshift/-/shapeshift-3.2.0.tgz#f26298ed472e73ee89e0a164c9f98305676bf101" - integrity sha512-asNgE5Ooil2/oGIAj6vZMoUc2ZFED0TGYD7jwvZsjHPQZBEh9ITj94ca4bCgiCR1s2ER/UjzykH+5wE3ebVZnQ== +"@sapphire/shapeshift@^3.5.1": + version "3.5.1" + resolved "https://registry.yarnpkg.com/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz#3bfd0e6bcfdced4ac26a6f450b5f7b8e49f4f2cc" + integrity sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA== + dependencies: + fast-deep-equal "^3.1.3" + lodash.uniqwith "^4.5.0" "@sapphire/snowflake@^3.2.2": version "3.2.2" resolved "https://registry.yarnpkg.com/@sapphire/snowflake/-/snowflake-3.2.2.tgz#faacdc1b5f7c43145a71eddba917de2b707ef780" integrity sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ== -"@sindresorhus/is@^4.6.0": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" - integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== +"@tokenizer/token@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@tokenizer/token/-/token-0.3.0.tgz#fe98a93fe789247e998c75e74e9c7c63217aa276" + integrity sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A== "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== -"@types/node-fetch@^2.6.1": - version "2.6.1" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.1.tgz#8f127c50481db65886800ef496f20bbf15518975" - integrity sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA== - dependencies: - "@types/node" "*" - form-data "^3.0.0" - "@types/node@*": version "16.9.4" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.4.tgz#a12f0ee7847cf17a97f6fdf1093cb7a9af23cca4" @@ -275,11 +270,6 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -325,13 +315,6 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -358,11 +341,6 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -370,16 +348,6 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -discord-api-types@^0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.30.0.tgz#3050ff1f06b8bd4259bb2c2b1b67517268ea7188" - integrity sha512-wYst0jrT8EJs2tVlwUTQ2xT0oWMjUrRMpFTkNY3NMleWyQNHgWaKhqFfxdLPdC2im9IuR5EsxcEgjhf/npeftw== - -discord-api-types@^0.31.1: - version "0.31.2" - resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.31.2.tgz#8d131e25340bd695815af3bb77128a6993c1b516" - integrity sha512-gpzXTvFVg7AjKVVJFH0oJGC0q0tO34iJGSHZNz9u3aqLxlD6LfxEs9wWVVikJqn9gra940oUTaPFizCkRDcEiA== - discord-api-types@^0.33.0: version "0.33.0" resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.33.0.tgz#4c20b3a85b6d78ce71954a506e98b98ac3105661" @@ -390,20 +358,27 @@ discord-api-types@^0.33.3: resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.33.5.tgz#6548b70520f7b944c60984dca4ab58654d664a12" integrity sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg== -discord.js@^13.7.0: - version "13.7.0" - resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-13.7.0.tgz#5172f7f5d816e2c7296015d335b54e46968d9c67" - integrity sha512-iV/An3FEB/CiBGdjWHRtgskM4UuWPq5vjhjKsrQhdVU16dbKrBxA+eIV2HWA07B3tXUGM6eco1wkr42gxxV1BA== +discord-api-types@^0.36.2: + version "0.36.2" + resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.36.2.tgz#2362bc544837be965ec99a5919f900c9699a7028" + integrity sha512-TunPAvzwneK/m5fr4hxH3bMsrtI22nr9yjfHyo5NBGMjpsAauGNiGCmwoFf0oO3jSd2mZiKUvZwCKDaB166u2Q== + +discord.js@^14.0.1: + version "14.0.1" + resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-14.0.1.tgz#2de95035294b361689ec1c9de935f0b6c21923b1" + integrity sha512-MZ2cvvk1WCpTUCLcchX5e/mBM22JCPAYle76qEuAfQfVTFdxE2YoKgRWMwWm6s/OJdkXyzglRWj405hg4vikEg== dependencies: - "@discordjs/builders" "^0.13.0" - "@discordjs/collection" "^0.6.0" - "@sapphire/async-queue" "^1.3.1" - "@types/node-fetch" "^2.6.1" + "@discordjs/builders" "^1.0.0" + "@discordjs/collection" "^1.0.0" + "@discordjs/rest" "^1.0.0" + "@sapphire/snowflake" "^3.2.2" "@types/ws" "^8.5.3" - discord-api-types "^0.30.0" - form-data "^4.0.0" - node-fetch "^2.6.1" - ws "^8.6.0" + discord-api-types "^0.36.2" + fast-deep-equal "^3.1.3" + lodash.snakecase "^4.1.1" + tslib "^2.4.0" + undici "^5.7.0" + ws "^8.8.1" doctrine@^3.0.0: version "3.0.0" @@ -569,6 +544,15 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +file-type@^17.1.2: + version "17.1.2" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-17.1.2.tgz#9257437a64e0c3623f70d9f27430522d978b1384" + integrity sha512-3thBUSfa9YEUEGO/NAAiQGvjujZxZiJTF6xNwyDn6kB0NcEtwMn5ttkGG9jGwm/Nt/t8U1bpBNqyBNZCz4F4ig== + dependencies: + readable-web-to-node-stream "^3.0.2" + strtok3 "^7.0.0-alpha.7" + token-types "^5.0.0-alpha.2" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -589,24 +573,6 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -667,6 +633,11 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" @@ -693,7 +664,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2: +inherits@2, inherits@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -750,6 +721,16 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== +lodash.snakecase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d" + integrity sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw== + +lodash.uniqwith@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz#7a0cbf65f43b5928625a9d4d0dc54b18cadc7ef3" + integrity sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q== + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -770,18 +751,6 @@ micromatch@^4.0.4: braces "^3.0.2" picomatch "^2.3.1" -mime-db@1.51.0: - version "1.51.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" - integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== - -mime-types@^2.1.12: - version "2.1.34" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24" - integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== - dependencies: - mime-db "1.51.0" - minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -806,13 +775,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -node-fetch@^2.6.1: - version "2.6.6" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89" - integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA== - dependencies: - whatwg-url "^5.0.0" - once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -854,6 +816,11 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +peek-readable@^5.0.0-alpha.5: + version "5.0.0-alpha.5" + resolved "https://registry.yarnpkg.com/peek-readable/-/peek-readable-5.0.0-alpha.5.tgz#ace5dfedf7bc33f17c9b5170b9d54f69a4fba79b" + integrity sha512-pJohF/tDwV3ntnT5+EkUo4E700q/j/OCDuPxtM+5/kFGjyOai/sK4/We4Cy1MB2OiTQliWU5DxPvYIKQAdPqAA== + picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -879,6 +846,22 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== +readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-web-to-node-stream@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz#5d52bb5df7b54861fd48d015e93a2cb87b3ee0bb" + integrity sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw== + dependencies: + readable-stream "^3.6.0" + regexpp@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" @@ -908,6 +891,11 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + semver@^7.3.7: version "7.3.7" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" @@ -932,6 +920,13 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -944,6 +939,14 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +strtok3@^7.0.0-alpha.7: + version "7.0.0-alpha.8" + resolved "https://registry.yarnpkg.com/strtok3/-/strtok3-7.0.0-alpha.8.tgz#23a7870974e0494b58b14af6dd1c2c67cf13314d" + integrity sha512-u+k19v+rTxBjGYxncRQjGvZYwYvEd0uP3D+uHKe/s4WB1eXS5ZwpZsTlBu5xSS4zEd89mTXECXg6WW3FSeV8cA== + dependencies: + "@tokenizer/token" "^0.3.0" + peek-readable "^5.0.0-alpha.5" + supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -963,10 +966,13 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= +token-types@^5.0.0-alpha.2: + version "5.0.0-alpha.2" + resolved "https://registry.yarnpkg.com/token-types/-/token-types-5.0.0-alpha.2.tgz#e43d63b2a8223a593d1c782a5149bec18f1abf97" + integrity sha512-EsG9UxAW4M6VATrEEjhPFTKEUi1OiJqTUMIZOGBN49fGxYjZB36k0p7to3HZSmWRoHm1QfZgrg3e02fpqAt5fQ== + dependencies: + "@tokenizer/token" "^0.3.0" + ieee754 "^1.2.1" ts-mixer@^6.0.1: version "6.0.1" @@ -978,11 +984,6 @@ tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" - integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== - tslib@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" @@ -1017,6 +1018,11 @@ undici@^5.4.0: resolved "https://registry.yarnpkg.com/undici/-/undici-5.5.1.tgz#baaf25844a99eaa0b22e1ef8d205bffe587c8f43" integrity sha512-MEvryPLf18HvlCbLSzCW0U00IMftKGI5udnjrQbC5D4P0Hodwffhv+iGfWuJwg16Y/TK11ZFK8i+BPVW2z/eAw== +undici@^5.7.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.7.0.tgz#979f89229c01505573cb274d0e11ea8d82b4004f" + integrity sha512-ORgxwDkiPS+gK2VxE7iyVeR7JliVn5DqhZ4LgQqYLBXsuK+lwOEmnJ66dhvlpLM0tC3fC7eYF1Bti2frbw2eAA== + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -1024,24 +1030,16 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + v8-compile-cache@^2.0.3: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -1059,10 +1057,10 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -ws@^8.6.0: - version "8.6.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.6.0.tgz#e5e9f1d9e7ff88083d0c0dd8281ea662a42c9c23" - integrity sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw== +ws@^8.8.1: + version "8.8.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.8.1.tgz#5dbad0feb7ade8ecc99b830c1d77c913d4955ff0" + integrity sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA== yallist@^4.0.0: version "4.0.0" From f03fffe68644a572c6b6e8ff1281548f7b751afd Mon Sep 17 00:00:00 2001 From: Maisy Date: Mon, 8 Aug 2022 23:58:18 -0500 Subject: [PATCH 2/2] set version as this is ready for release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5e55890..39bf1b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "slashasaurus", - "version": "0.11.0-beta.0", + "version": "0.11.0", "main": "dist/index.js", "types": "dist/index.d.ts", "license": "MIT",