Skip to content
GitHub

4.3.4 changelog

Published

Entries marked Breaking change a working bot; the migration guide says what to do about them. Every release of the line is in the changelog.

Patch Changes

  • #1114 f743c4f Thanks @l7aromeo! - respond(interaction).error() now adds an error to a private component message only when the message stays within Discord's text limits: 4000 characters across a Components V2 message's Text Displays, and 6000 characters across an embed message's embeds. It counted only components and embeds, so a long error could push the message past those limits and Discord refused the edit. Past them, the error follows up privately, as it does when the components or embeds don't fit.

  • #1125 92752bb Thanks @l7aromeo! - An attachments list given to respond()'s send() or edit() is still sent as given, but MeoCord now warns when it leaves out uploads the edit's media still show, naming them: that media is sent as given and breaks, a gallery reading back not found, a File component refused, and an embed's images left as links to their signed CDN URLs in place of their uploads, so remove it too or keep its upload listed. An app listing [...message.attachments.values()] on a Components V2 message hits this, since that list holds only the uploads nothing shows. An entry with only the id of one of the message's own uploads is now sent as { id, filename }, which Discord needs to keep a Components V2 component's upload. respond(interaction).original's documentation now says to re-send its components through send() or edit(): a direct interaction.editReply() sends their CDN URLs as they are.

  • #1120 4fd40d9 Thanks @l7aromeo! - meocord/eslint now reads a bot's tsconfig.json, tsconfig.test.json and tsconfig.eslint.json from the folder of the bot's own eslint.config.*, wherever ESLint runs from. Linted from the root of a workspace, a bot whose config is eslint.config.mjs, eslint.config.js in a "type": "module" package, or eslint.config.ts under Bun's runtime got TS5012 on every file. With any config, the import-cycle check missed cycles through the bot's path aliases from there, and was left out where eslint-import-resolver-typescript is installed in the bot's folder alone, as in a pnpm workspace. The tsconfigRootDir: import.meta.dirname entry the ESLint guide suggests for those configs can go; a tsconfigRootDir the app sets still wins.

  • #1114 f2f8b2c Thanks @l7aromeo! - respond() now edits a follow-up that became the answer in that follow-up's own format. A Components V2 respond(interaction).followUp() that replaced a public deferral, or followed a delete(), was edited as an embed message, which Discord's documentation says doesn't work on a V2 message; and an embed one that followed a component's V2 message was edited as V2, dropping its content and embeds.

  • #1125 1d6c74b Thanks @l7aromeo! - @Defer's lock no longer deletes a Components V2 message's uploaded files when the presenter's loading view has files of its own, and the restore no longer leaves its images broken. The same holds for an error view with files added to a private component message, and for an answer that replaces a loading view with files. Discord lists a V2 message's uploads only in its components' media, and an embed's images only in the embed, so MeoCord kept none of them. Such an edit now keeps every upload the message shows or holds, its media stay attachment-backed, and the limit of 10 files counts them. A loading or error view whose file is named like one the message keeps is sent without its files, with a warning, as Discord would show the view's file in its place. Of two kept files sharing a name, Discord shows the newer one wherever the name is used; a File component showing the older one can't be kept, and MeoCord warns, naming it.

  • #1125 1194779 Thanks @l7aromeo! - An edit through respond() now keeps a message's uploaded files attachment-backed when it lists no attachments: @Defer's lock and restore without loading files, and an app's own send() or edit() that re-sends the message's components or embeds. Their media point at the message's own uploads as attachment://, so a Components V2 gallery keeps its attachment_id and a File component is no longer refused with a 400. An app edit that adds files without listing attachments now keeps the uploads its components and embeds show beside the new files, where it dropped them before; with more than 10 files in all it keeps only the new ones, with a warning. An attachments list an app gives is sent as given, with each discord.js Attachment in it sent as { id, filename }, the shape Discord needs to keep a Components V2 component's upload. To drop files, list the ones to keep, or pass attachments: [].

  • #1114 fdfabc9 Thanks @l7aromeo! - respond() now edits a reply the app sent itself with interaction.reply() or deferReply() to a button, select menu or modal on a Components V2 message in that reply's own format. It took the format of the message the component is on, so an embed reply was edited as Components V2: its content and embeds were dropped, and Discord refused the edit with a 400. MeoCord's own error messages still follow the component's message.

  • #1114 c4521dc Thanks @l7aromeo! - respond() now edits a Components V2 reply the app sent itself with interaction.reply() as V2. It edited it as an embed message, which Discord's documentation says doesn't work on a V2 message. discord.js keeps no flags of such a reply, so respond() reads it back once with fetchReply() before it first edits it, whether it is an embed or V2. It reads back nothing after a deferReply(), an update() or a deferUpdate(), whose format is known.

  • #1114 3b9abcb Thanks @l7aromeo! - Under useStrictMocks(), the mocks now handle Components V2 messages as Discord does. An edit changes only the flags Discord lets it change: SuppressEmbeds, and IsComponentsV2, which it can set but never clear. So a private deferral edited into a V2 message stays private, where it read back as public, and an edit with flags: 0 leaves a V2 message V2. A reply, follow-up, edit or update that leaves a V2 message holding content or embeds is refused with a 400 (createDiscordError(50035)), as Discord refuses it: sent so, or made V2 by an edit that doesn't clear them with content: null and embeds: []. The same applies to a mock message's own edit() and reply(), and to a channel's, user's or member's send().

    In default mode the mocks behave as before: an edit's flags replace the message's, and such a message is sent. Each logs one warning where strict mocks differ. A test that sends content or embeds with IsComponentsV2 under strict mocks now fails as it would against Discord; drop them, or clear them in the edit that makes the message V2.

  • #1125 ba8c092 Thanks @l7aromeo! - Under useStrictMocks(), the mocks now keep the files a message is sent with as Discord does, so a test sees an edit lose them. An embed's image and a Components V2 component's media show their upload by CDN URL, the component's with attachment_id, and attachments lists only the uploads no embed or component shows. An edit that sends files or attachments keeps only the uploads it lists, and none when it lists no attachments, as discord.js then lists the new files alone; component media whose upload an edit removed reads back not found (loading_state 3), as does a later edit that points at it again, and media re-sent with its CDN URL reads back without attachment_id while its upload stays on the message. A CDN URL from another channel is an image the message doesn't hold.

    A component's attachment:// reaches a kept upload in an edit that lists no attachments, or lists it as { id, filename }; listed as { id } or as discord.js's Attachment, it is refused with a 400, as Discord refuses it. So are an attachment the message doesn't have, an upload listed under another filename, and a File component pointed at a URL. A new file of the same name wins, then the newer of two kept uploads that share a name. An embed's attachment:// reaches a kept upload however it is listed. This applies to an interaction's answers and edits, a mock message's edit() and reply(), and a channel's send().

    In default mode the mocks behave as before, and log one warning where strict mocks differ. A test under strict mocks that points media at attachment:// of a file it didn't send now fails as it would against Discord.

  • #1114 9f2417a Thanks @l7aromeo! - respond() now logs a warning, naming the interaction, when it drops non-empty content or embeds from an answer to a Components V2 message, which can carry only components. The drop was silent, so the user kept seeing the old message and the app was never told. Send that text as components instead, such as a Text Display.

  • #1114 0f7f52b Thanks @l7aromeo! - respond() now clears the content and embeds of a message that holds them when its edit or update makes it Components V2, sending content: null and embeds: [] with the components. It sent only the components and the flag, which Discord refuses with a 400, and which useStrictMocks() refuses too: a send({ components, flags: MessageFlags.IsComponentsV2 }) after an embed answer, the app's own embed reply, or on a component's embed message failed. Only such an answer gets the two fields: the V2 edit of a deferral nothing was sent into yet, or of a component's message that shows only components, is sent as before, and so is an answer that is already V2 or stays an embed.