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
f743c4fThanks @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
92752bbThanks @l7aromeo! - Anattachmentslist given torespond()'ssend()oredit()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 theidof 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 throughsend()oredit(): a directinteraction.editReply()sends their CDN URLs as they are.#1120
4fd40d9Thanks @l7aromeo! -meocord/eslintnow reads a bot'stsconfig.json,tsconfig.test.jsonandtsconfig.eslint.jsonfrom the folder of the bot's owneslint.config.*, wherever ESLint runs from. Linted from the root of a workspace, a bot whose config iseslint.config.mjs,eslint.config.jsin a"type": "module"package, oreslint.config.tsunder Bun's runtime gotTS5012on every file. With any config, the import-cycle check missed cycles through the bot's path aliases from there, and was left out whereeslint-import-resolver-typescriptis installed in the bot's folder alone, as in a pnpm workspace. ThetsconfigRootDir: import.meta.dirnameentry the ESLint guide suggests for those configs can go; atsconfigRootDirthe app sets still wins.#1114
f2f8b2cThanks @l7aromeo! -respond()now edits a follow-up that became the answer in that follow-up's own format. A Components V2respond(interaction).followUp()that replaced a public deferral, or followed adelete(), 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
1d6c74bThanks @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
1194779Thanks @l7aromeo! - An edit throughrespond()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 ownsend()oredit()that re-sends the message's components or embeds. Their media point at the message's own uploads asattachment://, so a Components V2 gallery keeps itsattachment_idand a File component is no longer refused with a 400. An app edit that addsfileswithout listingattachmentsnow 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. Anattachmentslist an app gives is sent as given, with each discord.jsAttachmentin 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 passattachments: [].#1114
fdfabc9Thanks @l7aromeo! -respond()now edits a reply the app sent itself withinteraction.reply()ordeferReply()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
c4521dcThanks @l7aromeo! -respond()now edits a Components V2 reply the app sent itself withinteraction.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, sorespond()reads it back once withfetchReply()before it first edits it, whether it is an embed or V2. It reads back nothing after adeferReply(), anupdate()or adeferUpdate(), whose format is known.#1114
3b9abcbThanks @l7aromeo! - UnderuseStrictMocks(), the mocks now handle Components V2 messages as Discord does. An edit changes only the flags Discord lets it change:SuppressEmbeds, andIsComponentsV2, 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 withflags: 0leaves a V2 message V2. A reply, follow-up, edit or update that leaves a V2 message holdingcontentorembedsis refused with a 400 (createDiscordError(50035)), as Discord refuses it: sent so, or made V2 by an edit that doesn't clear them withcontent: nullandembeds: []. The same applies to a mock message's ownedit()andreply(), and to a channel's, user's or member'ssend().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
contentorembedswithIsComponentsV2under strict mocks now fails as it would against Discord; drop them, or clear them in the edit that makes the message V2.#1125
ba8c092Thanks @l7aromeo! - UnderuseStrictMocks(), 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 withattachment_id, andattachmentslists only the uploads no embed or component shows. An edit that sendsfilesorattachmentskeeps only the uploads it lists, and none when it lists noattachments, as discord.js then lists the new files alone; component media whose upload an edit removed reads back not found (loading_state3), as does a later edit that points at it again, and media re-sent with its CDN URL reads back withoutattachment_idwhile 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'sAttachment, 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'sattachment://reaches a kept upload however it is listed. This applies to an interaction's answers and edits, a mock message'sedit()andreply(), and a channel'ssend().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
9f2417aThanks @l7aromeo! -respond()now logs a warning, naming the interaction, when it drops non-emptycontentorembedsfrom 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
0f7f52bThanks @l7aromeo! -respond()now clears the content and embeds of a message that holds them when its edit or update makes it Components V2, sendingcontent: nullandembeds: []with the components. It sent only the components and the flag, which Discord refuses with a 400, and whichuseStrictMocks()refuses too: asend({ 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.