Skip to content
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: new select menus #8793

Merged
merged 24 commits into from Nov 1, 2022
Merged

Conversation

didinele
Copy link
Member

@didinele didinele commented Oct 28, 2022

Please describe the changes this PR makes and why it should be merged:
As discussed internally (see: https://canary.discord.com/channels/222078108977594368/999796393810067607/1035493023162830848), supersedes #8775

Things this PR does better:

  • Makes 0 breaking changes; in case of sensical class/method renames, re-exports/aliases were added under the old names with deprecation notices on them
  • After some discussion with other contributors, has all of the caching behavior set in stone - i.e. consistent with how slash commands behave
  • Cleaner/finished typings for the main lib
  • Split SelectMenuComponent into multiple classes
  • ... few other things that no longer come to mind after the 3 hours this took

Closes #8753

Note: There is one caveat with the typings I wrote, AnySelectMenuInteraction is a confusing type name and something we moved away from in the past. Ideally this would just be named SelectMenuInteraction and be a union of all the possible select menu interaction classes, but this is not possible, as SelectMenuInteraction is the name of the old StringSelectMenuInteraction and is re-exported as such to prevent this PR from being breaking.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)

@vercel
Copy link

vercel bot commented Oct 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Nov 1, 2022 at 5:28PM (UTC)
discord-js-guide ⬜️ Ignored (Inspect) Nov 1, 2022 at 5:28PM (UTC)

@codecov
Copy link

codecov bot commented Oct 28, 2022

Codecov Report

Merging #8793 (62f5240) into main (8b400ca) will decrease coverage by 6.34%.
The diff coverage is 88.31%.

❗ Current head 62f5240 differs from pull request most recent head 5bdf316. Consider uploading reports for the commit 5bdf316 to get more accurate results

@@            Coverage Diff             @@
##             main    #8793      +/-   ##
==========================================
- Coverage   91.97%   85.62%   -6.35%     
==========================================
  Files          10       96      +86     
  Lines        2107     9457    +7350     
  Branches      244     1134     +890     
==========================================
+ Hits         1938     8098    +6160     
- Misses        166     1317    +1151     
- Partials        3       42      +39     
Flag Coverage Δ
brokers 65.24% <ø> (?)
builders 98.71% <88.31%> (?)
collection 100.00% <ø> (?)
proxy 81.53% <ø> (?)
rest 91.97% <ø> (ø)
util 100.00% <ø> (?)
utilities 100.00% <ø> (?)
voice 63.70% <ø> (?)
ws 59.83% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/builders/src/components/Components.ts 87.87% <60.00%> (ø)
...ers/src/components/selectMenu/ChannelSelectMenu.ts 65.57% <65.57%> (ø)
...src/components/selectMenu/MentionableSelectMenu.ts 90.32% <90.32%> (ø)
...ilders/src/components/selectMenu/RoleSelectMenu.ts 90.32% <90.32%> (ø)
...ilders/src/components/selectMenu/UserSelectMenu.ts 90.32% <90.32%> (ø)
...ilders/src/components/selectMenu/BaseSelectMenu.ts 92.18% <92.18%> (ø)
packages/builders/src/components/ActionRow.ts 100.00% <100.00%> (ø)
packages/builders/src/components/Assertions.ts 100.00% <100.00%> (ø)
...ders/src/components/selectMenu/StringSelectMenu.ts 100.00% <100.00%> (ø)
...rc/components/selectMenu/StringSelectMenuOption.ts 100.00% <100.00%> (ø)
... and 80 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jaw0r3k
Copy link
Contributor

jaw0r3k commented Oct 28, 2022

Its just copied lol

@Qjuh
Copy link
Contributor

Qjuh commented Oct 28, 2022

Its just copied lol

Did you actually read the bullet point list of five things this PR does better?

@jaw0r3k
Copy link
Contributor

jaw0r3k commented Oct 28, 2022

Its just copied lol

Did you actually read the bullet point list of five things this PR does better?

The only better thing i see is

  • Cleaner/finished typings for the main lib

Copy link
Contributor

@Syjalo Syjalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add BaseInteraction#isAnySelectMenu() that will be changed to BaseInteraction#isSelectMenu() in v15

@didinele
Copy link
Member Author

Add BaseInteraction#isAnySelectMenu() that will be changed to BaseInteraction#isSelectMenu() in v15

Not a bad idea, will do tomorrow.

Copy link
Member

@kyranet kyranet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add type tests for the type narrowing between different select menu types.

packages/discord.js/typings/index.d.ts Outdated Show resolved Hide resolved
packages/discord.js/typings/index.d.ts Outdated Show resolved Hide resolved
packages/discord.js/typings/index.d.ts Show resolved Hide resolved
packages/discord.js/typings/index.d.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@JulianVennen JulianVennen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of your imports don't work correctly. You're using object destruction here, even though the classes are exported directly.

Co-authored-by: Julian Vennen <julian@aternos.org>
@didinele
Copy link
Member Author

Now also tested.

@almeidx
Copy link
Member

almeidx commented Oct 31, 2022

Maybe bump discord-api-types to the latest version (0.37.6)?

Co-authored-by: Almeida <almeidx@pm.me>
@didinele
Copy link
Member Author

Maybe bump discord-api-types to the latest version (0.37.6)?

Feel like that's out of scope for me at this point unless we need something from that version/it has relevant bug fixes.

Co-authored-by: Aura Román <kyradiscord@gmail.com>
@kyranet kyranet mentioned this pull request Nov 1, 2022
@kodiakhq kodiakhq bot merged commit 5152abf into discordjs:main Nov 1, 2022
@didinele didinele deleted the feat/new-select-menus branch November 1, 2022 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add new component types for User, Role, Mentionable, and Channel Select
10 participants