Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

feat: Add Components #63

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

suneettipirneni
Copy link
Member

@suneettipirneni suneettipirneni commented Dec 15, 2021

Please describe the changes this PR makes and why it should be merged:

Adds SelectMenuComponent, ButtonComponent and ActionRow<T>

Status and versioning classification:

  • Code changes have been tested, 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)

@suneettipirneni suneettipirneni changed the title feat: add message components feat: Add Components Dec 15, 2021
@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2021

Codecov Report

Merging #63 (d0b22b0) into main (b5d0b15) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              main       #63    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           21        27     +6     
  Lines          306       423   +117     
  Branches        42        51     +9     
==========================================
+ Hits           306       423   +117     
Impacted Files Coverage Δ
src/components/ActionRow.ts 100.00% <100.00%> (ø)
src/components/Assertions.ts 100.00% <100.00%> (ø)
src/components/Button.ts 100.00% <100.00%> (ø)
src/components/Components.ts 100.00% <100.00%> (ø)
src/components/selectMenu/SelectMenu.ts 100.00% <100.00%> (ø)
src/components/selectMenu/SelectMenuOption.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5d0b15...d0b22b0. Read the comment docs.

Copy link
Member

@vladfrangu vladfrangu left a comment

Choose a reason for hiding this comment

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

I semi-understand the split between link button and interaction button but personally I'd rather have one Button class that then changes its type based on what you set in the style (so something like <S extends ButtonStyle>(style: S): S extends ButtonStyle.Link ? Omit<this, 'setCustomId' | 'whateverElse'>& Pick<ButtonComponent, 'setUrl'> : Omit<this, 'setUrl'> & Pick<ButtonComponent<T>, 'setCustomId', 'whatever'>, of course simplifying the types like I did for the slashcommandbuilder (where it has a subcommandsonly and options only type)

src/components/ActionRow.ts Outdated Show resolved Hide resolved
src/components/ActionRow.ts Outdated Show resolved Hide resolved
src/components/ActionRow.ts Outdated Show resolved Hide resolved
src/components/button/BaseButton.ts Outdated Show resolved Hide resolved
src/components/button/BaseButton.ts Outdated Show resolved Hide resolved
src/components/selectMenu/SelectMenu.ts Outdated Show resolved Hide resolved
src/components/selectMenu/SelectMenu.ts Outdated Show resolved Hide resolved
src/components/selectMenu/SelectMenu.ts Outdated Show resolved Hide resolved
src/components/selectMenu/SelectMenuOption.ts Outdated Show resolved Hide resolved
src/components/selectMenu/SelectMenuOption.ts Show resolved Hide resolved
src/components/Assertions.ts Show resolved Hide resolved
src/components/Assertions.ts Show resolved Hide resolved
src/components/selectMenu/SelectMenuOption.ts Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants