-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(EmbedBuilder): add .length
#8682
Conversation
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Codecov Report
@@ Coverage Diff @@
## main #8682 +/- ##
===========================================
+ Coverage 58.20% 85.60% +27.40%
===========================================
Files 227 96 -131
Lines 14902 9467 -5435
Branches 1131 1134 +3
===========================================
- Hits 8673 8104 -569
+ Misses 6189 1321 -4868
- Partials 40 42 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 198 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Could I get a review on this? |
Wouldn't it be fine if users just do: import { embedLength } from '@discordjs/builders';
embedLength(YourEmbedBuilderInstance.data); ? |
Yes, but why does Embed have a length property then? |
I'm against this change, it goes against RFC about exposing a builder's data via getters:
Furthermore, you can do as @iCrawl suggested. And regarding the main library's builder having the |
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add typings?
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://discord-js-guide-git-fork-redguy12-gh8647-discordjs.vercel.app/guide/home/introduction |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [discord.js](https://discord.js.org) ([source](https://github.com/discordjs/discord.js)) | dependencies | minor | [`14.11.0` -> `14.14.1`](https://renovatebot.com/diffs/npm/discord.js/14.11.0/14.14.1) | --- ### Release Notes <details> <summary>discordjs/discord.js (discord.js)</summary> ### [`v14.14.1`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14141---2023-11-12) [Compare Source](discordjs/discord.js@14.14.0...14.14.1) #### Bug Fixes - **Emoji:** `id` set as `undefined` edge case ([#​9953](discordjs/discord.js#9953)) ([cc07a28](discordjs/discord.js@cc07a28)) - **BaseClient:** Default in objects properly ([#​9952](discordjs/discord.js#9952)) ([f93abf7](discordjs/discord.js@f93abf7)) #### Documentation - Use preferred nullable syntax (`?T` over `T | null`) ([#​9946](discordjs/discord.js#9946)) ([1e4ef35](discordjs/discord.js@1e4ef35)) #### Refactor - Use formatters ([#​9956](discordjs/discord.js#9956)) ([40726db](discordjs/discord.js@40726db)) #### Typings - Use wrapper utilities ([#​9945](discordjs/discord.js#9945)) ([4bc1dae](discordjs/discord.js@4bc1dae)) ### [`v14.14.0`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14140---2023-11-12) [Compare Source](discordjs/discord.js@14.13.0...14.14.0) #### Bug Fixes - **Client:** Ensure destroyed connections are not ready ([#​9942](discordjs/discord.js#9942)) ([b5e23ec](discordjs/discord.js@b5e23ec)) - **Webhook:** Do not call `client.deleteWebhook` in `delete` ([#​9786](discordjs/discord.js#9786)) ([31d914e](discordjs/discord.js@31d914e)) - **GuildManager#fetch:** Inject shard id ([#​9921](discordjs/discord.js#9921)) ([85753a9](discordjs/discord.js@85753a9)) - Prevent 'undefined' debug message on intentional shard closure ([#​9846](discordjs/discord.js#9846)) ([0e0b85b](discordjs/discord.js@0e0b85b)) - **Role:** Calculate position correctly when rawPositions are equal ([#​9871](discordjs/discord.js#9871)) ([0529b2a](discordjs/discord.js@0529b2a)) - **GuildScheduledEvent:** Use `if...else` pattern and handle partials ([#​9802](discordjs/discord.js#9802)) ([32d614c](discordjs/discord.js@32d614c)) #### Documentation - **Message:** Remove duplicated word 'of' in description ([#​9923](discordjs/discord.js#9923)) ([85a78f9](discordjs/discord.js@85a78f9)) - **GuildMember:** Clarify display color ([#​9891](discordjs/discord.js#9891)) ([e38d03f](discordjs/discord.js@e38d03f)) - Remove duplicate `APIEmoji` ([#​9880](discordjs/discord.js#9880)) ([8cfadb6](discordjs/discord.js@8cfadb6)) - Consolidate API types ([#​9881](discordjs/discord.js#9881)) ([44a3cbf](discordjs/discord.js@44a3cbf)) - Remove `FileOptions` ([#​9855](discordjs/discord.js#9855)) ([eaabcdf](discordjs/discord.js@eaabcdf)) - **DiscordjsErrorCodes:** Deprecate unused properties ([#​9790](discordjs/discord.js#9790)) ([4588e07](discordjs/discord.js@4588e07)) - **ApplicationCommandManager:** Id parameter can take options ([#​9664](discordjs/discord.js#9664)) ([ed14135](discordjs/discord.js@ed14135)) - **Attachment:** Add MIME types link to `contentType` ([#​9824](discordjs/discord.js#9824)) ([85b2498](discordjs/discord.js@85b2498)) - Fix "its" typo ([#​9825](discordjs/discord.js#9825)) ([c50809e](discordjs/discord.js@c50809e)) - **GuildMember:** Clarify timeout parameter wording ([#​9800](discordjs/discord.js#9800)) ([8d97e2d](discordjs/discord.js@8d97e2d)) - **create-discord-bot:** Support bun in create-discord-bot ([#​9798](discordjs/discord.js#9798)) ([7157748](discordjs/discord.js@7157748)) #### Features - Default select menu values ([#​9867](discordjs/discord.js#9867)) ([4ff3ea4](discordjs/discord.js@4ff3ea4)) - Mainlib docs on new website ([#​9930](discordjs/discord.js#9930)) ([da455bc](discordjs/discord.js@da455bc)) - **cleanContent:** Add slash commands and emojis ([#​9809](discordjs/discord.js#9809)) ([c2349d4](discordjs/discord.js@c2349d4)) - **Emoji:** Add `imageURL()` ([#​9788](discordjs/discord.js#9788)) ([b6c762c](discordjs/discord.js@b6c762c)) - Onboarding mode and edit method ([#​9647](discordjs/discord.js#9647)) ([7671a83](discordjs/discord.js@7671a83)) - Support new application properties and patch endpoint ([#​9709](discordjs/discord.js#9709)) ([1fe7247](discordjs/discord.js@1fe7247)) - **BaseChannel:** Add `isThreadOnly()` ([#​9847](discordjs/discord.js#9847)) ([699b232](discordjs/discord.js@699b232)) - **StageInstanceManager:** Add `guildScheduledEvent` to `create()` ([#​8885](discordjs/discord.js#8885)) ([931c3ed](discordjs/discord.js@931c3ed)) - Support `default_thread_rate_limit_per_user` in channel creation ([#​9273](discordjs/discord.js#9273)) ([1e5c14b](discordjs/discord.js@1e5c14b)) - Add media channels ([#​9662](discordjs/discord.js#9662)) ([571aedd](discordjs/discord.js@571aedd)) - Support widget image URL ([#​9782](discordjs/discord.js#9782)) ([b6a2441](discordjs/discord.js@b6a2441)) - **GuildAuditLogsEntry:** Expose extra integrationType in relevant log types ([#​9796](discordjs/discord.js#9796)) ([3109798](discordjs/discord.js@3109798)) - Add support for teams update ([#​9805](discordjs/discord.js#9805)) ([c66636d](discordjs/discord.js@c66636d)) - **Presence:** Expose sync_id in Activity ([#​9766](discordjs/discord.js#9766)) ([485dd71](discordjs/discord.js@485dd71)) #### Refactor - **utils:** Remove `mergeDefault` ([#​9938](discordjs/discord.js#9938)) ([5b0aa92](discordjs/discord.js@5b0aa92)) - Use proper variable names in callbacks ([#​9840](discordjs/discord.js#9840)) ([11f6955](discordjs/discord.js@11f6955)) - **GuildAuditLogsEntry:** Abstract reduce logic into a new function ([#​9845](discordjs/discord.js#9845)) ([19ea0ba](discordjs/discord.js@19ea0ba)) - Stickers are free (no more "premium" packs) ([#​9791](discordjs/discord.js#9791)) ([e02a59b](discordjs/discord.js@e02a59b)) #### Typings - **Partials:** Add toString() method to supported Partials ([#​9835](discordjs/discord.js#9835)) ([7422d9f](discordjs/discord.js@7422d9f)) - **MessageEditOptions:** Correct `attachments` type ([#​9874](discordjs/discord.js#9874)) ([2aa3250](discordjs/discord.js@2aa3250)) - **UserContextMenuCommandInteraction:** Nullify `targetMember` ([#​9844](discordjs/discord.js#9844)) ([3c043d8](discordjs/discord.js@3c043d8)) - Don't include dom types ([#​9831](discordjs/discord.js#9831)) ([9dbc954](discordjs/discord.js@9dbc954)) - **Client:** Fix isReady narrowing ([#​9828](discordjs/discord.js#9828)) ([6404c01](discordjs/discord.js@6404c01)) ### [`v14.13.0`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14130---2023-08-17) [Compare Source](discordjs/discord.js@14.12.1...14.13.0) #### Bug Fixes - **Action:** Do not add the client user as a recipient ([#​9774](discordjs/discord.js#9774)) ([24fbb11](discordjs/discord.js@24fbb11)) - **DMChannel:** Correct partial typo ([#​9773](discordjs/discord.js#9773)) ([c1ff545](discordjs/discord.js@c1ff545)) - **CachedManager:** Allow overriding constructor for makeCache ([#​9763](discordjs/discord.js#9763)) ([346fa57](discordjs/discord.js@346fa57)) - **types:** Fixed CachedManager constructor arguments in type ([#​9761](discordjs/discord.js#9761)) ([b3c85d3](discordjs/discord.js@b3c85d3)) - **Action:** Do not set `undefined` values ([#​9755](discordjs/discord.js#9755)) ([d8e3755](discordjs/discord.js@d8e3755)) #### Documentation - **EmbedBuilder:** `@readonly` length ([#​9778](discordjs/discord.js#9778)) ([8f572a6](discordjs/discord.js@8f572a6)) - **WebhookEditOptions:** Add all of the types ([#​9776](discordjs/discord.js#9776)) ([d5be424](discordjs/discord.js@d5be424)) - Update Node.js requirement to 16.11.0 ([#​9764](discordjs/discord.js#9764)) ([188877c](discordjs/discord.js@188877c)) #### Features - **Client:** Add deleteWebhook method ([#​9777](discordjs/discord.js#9777)) ([d90ba8d](discordjs/discord.js@d90ba8d)) - **ClientPresence:** Allow setting activity state ([#​9743](discordjs/discord.js#9743)) ([9ed1b59](discordjs/discord.js@9ed1b59)) - **ClientApplication:** Approximate guild count and new `GET` route ([#​9713](discordjs/discord.js#9713)) ([632a9b4](discordjs/discord.js@632a9b4)) - **Role:** Add `flags` ([#​9694](discordjs/discord.js#9694)) ([3b18e5b](discordjs/discord.js@3b18e5b)) - **Attachment:** Add `flags` ([#​9686](discordjs/discord.js#9686)) ([692f0fc](discordjs/discord.js@692f0fc)) - Add `Client#webhooksUpdate` ([#​9732](discordjs/discord.js#9732)) ([0de071d](discordjs/discord.js@0de071d)) #### Typings - **GuildInvitableChannelResolvable:** Allow forum channels ([#​9775](discordjs/discord.js#9775)) ([727dc09](discordjs/discord.js@727dc09)) - Make activity name required ([#​9765](discordjs/discord.js#9765)) ([0a9a3ed](discordjs/discord.js@0a9a3ed)) - **BaseButtonComponentData:** Narrow component type ([#​9735](discordjs/discord.js#9735)) ([a30d46c](discordjs/discord.js@a30d46c)) ### [`v14.12.1`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14121---2023-08-01) [Compare Source](discordjs/discord.js@14.12.0...14.12.1) #### Bug Fixes - **BaseClient:** Fix destroy method ([#​9742](discordjs/discord.js#9742)) ([1af7e5a](discordjs/discord.js@1af7e5a)) ### [`v14.12.0`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14120---2023-07-31) [Compare Source](discordjs/discord.js@14.11.0...14.12.0) #### Bug Fixes - **ChannelUpdate:** Check against unknown channels ([#​9697](discordjs/discord.js#9697)) ([7fb91c5](discordjs/discord.js@7fb91c5)) - **Action:** Use existing recipients if available ([#​9653](discordjs/discord.js#9653)) ([719e54a](discordjs/discord.js@719e54a)) - Everyone role members ([#​9685](discordjs/discord.js#9685)) ([0803eb5](discordjs/discord.js@0803eb5)) - `awaitMessageComponent` with `MessageComponentInteraction`s ([#​8598](discordjs/discord.js#8598)) ([b61e4fb](discordjs/discord.js@b61e4fb)) - **ThreadManager:** Fix internal crash upon conditionally resolving thread members ([#​9648](discordjs/discord.js#9648)) ([a6dbe16](discordjs/discord.js@a6dbe16)) - **User:** Check global name in equals ([#​9631](discordjs/discord.js#9631)) ([8f3bd38](discordjs/discord.js@8f3bd38)) - **WebSocketManager:** Await WebSocket destroy ([#​9519](discordjs/discord.js#9519)) ([75308f2](discordjs/discord.js@75308f2)) - **Client:** Safe call for possibly null WebSocket ([#​9600](discordjs/discord.js#9600)) ([24a6149](discordjs/discord.js@24a6149)) - **ThreadManager:** Ensure `fetchActive()` only returns active threads in a channel ([#​9568](discordjs/discord.js#9568)) ([53aa24d](discordjs/discord.js@53aa24d)) - **LimitedCollection:** Allow items to be stored if keepOverLimit is true when maxSize is 0 ([#​9534](discordjs/discord.js#9534)) ([9345d1b](discordjs/discord.js@9345d1b)) - **AutocompleteInteraction:** Prevent snake casing of locales ([#​9565](discordjs/discord.js#9565)) ([7196fe3](discordjs/discord.js@7196fe3)) #### Documentation - Change `Channel` to `BaseChannel` ([#​9718](discordjs/discord.js#9718)) ([e5effb6](discordjs/discord.js@e5effb6)) - **BaseChannel:** Remove `APIChannel` ([#​9717](discordjs/discord.js#9717)) ([125405f](discordjs/discord.js@125405f)) - **BuildersSelectMenuOption:** Update link ([#​9690](discordjs/discord.js#9690)) ([ede9f4e](discordjs/discord.js@ede9f4e)) - **ClientOptions:** Change default value of sweepers in docs ([#​9591](discordjs/discord.js#9591)) ([911e6ef](discordjs/discord.js@911e6ef)) - **Client:** Correct invite gateway permission checks ([#​9597](discordjs/discord.js#9597)) ([e1b6eee](discordjs/discord.js@e1b6eee)) - Fix broken links to new documentation ([#​9563](discordjs/discord.js#9563)) ([d01e8aa](discordjs/discord.js@d01e8aa)) #### Features - Add ws option support for "buildIdentifyThrottler" ([#​9728](discordjs/discord.js#9728)) ([6307f81](discordjs/discord.js@6307f81)) - **Client:** Add `guildAvailable` event ([#​9692](discordjs/discord.js#9692)) ([3c85fb2](discordjs/discord.js@3c85fb2)) - User avatar decorations ([#​8914](discordjs/discord.js#8914)) ([8d97017](discordjs/discord.js@8d97017)) - Add silent option to ShardingManager ([#​9506](discordjs/discord.js#9506)) ([df40dcd](discordjs/discord.js@df40dcd)) - **EmbedBuilder:** Add `.length` ([#​8682](discordjs/discord.js#8682)) ([53c17e0](discordjs/discord.js@53c17e0)) - Guild onboarding ([#​9120](discordjs/discord.js#9120)) ([dc73c93](discordjs/discord.js@dc73c93)) - Add resume event in shard ([#​9650](discordjs/discord.js#9650)) ([a73d54e](discordjs/discord.js@a73d54e)) - **presence:** Re-introduce image resolving for other platforms ([#​9637](discordjs/discord.js#9637)) ([73c2f8a](discordjs/discord.js@73c2f8a)) - Add message to send resume event to shard ([#​9626](discordjs/discord.js#9626)) ([a873ec1](discordjs/discord.js@a873ec1)) - Support new username system ([#​9512](discordjs/discord.js#9512)) ([1ab60f9](discordjs/discord.js@1ab60f9)) - **GuildAuditLogsEntry#extra:** Add missing `channel` property ([#​9518](discordjs/discord.js#9518)) ([2272321](discordjs/discord.js@2272321)) #### Performance - **Channel:** Linear speed position getter ([#​9497](discordjs/discord.js#9497)) ([09b0382](discordjs/discord.js@09b0382)) - **Role:** Improve `members` getter ([#​9529](discordjs/discord.js#9529)) ([37181ab](discordjs/discord.js@37181ab)) #### Refactor - **User:** Remove deprecation warning from tag ([#​9660](discordjs/discord.js#9660)) ([cf8012c](discordjs/discord.js@cf8012c)) - **GuildMember:** Make `_roles` property non-enumerable ([#​9387](discordjs/discord.js#9387)) ([46167a7](discordjs/discord.js@46167a7)) - **rest:** Switch api to fetch-like and provide strategies ([#​9416](discordjs/discord.js#9416)) ([cdaa0a3](discordjs/discord.js@cdaa0a3)) - **BREAKING CHANGE:** NodeJS v18+ is required when using node due to the use of global `fetch` - **BREAKING CHANGE:** The raw method of REST now returns a web compatible `Respone` object. - **BREAKING CHANGE:** The `parseResponse` utility method has been updated to operate on a web compatible `Response` object. - **BREAKING CHANGE:** Many underlying internals have changed, some of which were exported. - **BREAKING CHANGE:** `DefaultRestOptions` used to contain a default `agent`, which is now set to `null` instead. #### Typings - **MessageManager:** Allow comparison of messages again ([#​9612](discordjs/discord.js#9612)) ([a48d0ef](discordjs/discord.js@a48d0ef)) - **AutoModerationActionExecution:** Add forum channels as a possible type in `channel()` ([#​9623](discordjs/discord.js#9623)) ([d64330a](discordjs/discord.js@d64330a)) - **ModalSubmitFields:** Components is an array ([#​9406](discordjs/discord.js#9406)) ([1cab79f](discordjs/discord.js@1cab79f)) - Use `readonly` arrays and `const` type parameters in places ([#​9641](discordjs/discord.js#9641)) ([cd69868](discordjs/discord.js@cd69868)) - **BaseInteraction:** `appPermissions` not `null` in guilds ([#​9601](discordjs/discord.js#9601)) ([6c2242f](discordjs/discord.js@6c2242f)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=--> Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/351 Reviewed-by: Vylpes <ethan@vylpes.com> Co-authored-by: Renovate Bot <renovate@vylpes.com> Co-committed-by: Renovate Bot <renovate@vylpes.com>
Please describe the changes this PR makes and why it should be merged:
Resolves #8647
Status and versioning classification: