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(components): Add unsafe message component builders #7387

Merged

Conversation

suneettipirneni
Copy link
Member

@suneettipirneni suneettipirneni commented Feb 1, 2022

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

This adds new builders that don't perform any validation on input:

  • UnsafeButtonComponent
  • UnsafeSelectMenuComponent
  • UnsafeSelectMenuOption
  • UnsafeEmbed

If you'd like to use a shorter name I'd recommend renaming the imports for your needs:

import { UnsafeButtonComponent as ButtonComponent } from `@discordjs/builders`;

// Optional - Reexport them from a file to avoid repeating this process
export { ButtonComponent };

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)

@suneettipirneni suneettipirneni force-pushed the builders/feat/unsafe-components branch 2 times, most recently from 96bbed4 to 7a321f0 Compare February 1, 2022 22:33
@ImRodry
Copy link
Contributor

ImRodry commented Feb 1, 2022

Can't this be an option on the original builders and not a new class?

@suneettipirneni
Copy link
Member Author

Can't this be an option on the original builders and not a new class?

We discussed this internally, we would rather have a separate class than have an if branch for all methods on one class.

@iCrawl iCrawl added this to the builders v1 milestone Feb 2, 2022
@vvito7
Copy link
Contributor

vvito7 commented Feb 2, 2022

Isn't it supposed to have the types for each parameter in UnsafeSelectMenu.ts, UnsafeSelectMenuOption.ts and UnsafeEmbed.ts files?

@imranbarbhuiya
Copy link
Contributor

imranbarbhuiya commented Feb 2, 2022

Isn't it supposed to have the types for each parameter in UnsafeSelectMenu.ts, UnsafeSelectMenuOption.ts and UnsafeEmbed.ts files?

They are coming from ts file which'll auto generate types. If you are saying about adding types in main package types then this pr isn't reexporting them in djs

@vvito7
Copy link
Contributor

vvito7 commented Feb 2, 2022

Got it, thanks for explaining.

Copy link
Contributor

@imranbarbhuiya imranbarbhuiya left a comment

Choose a reason for hiding this comment

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

Types also

@iCrawl
Copy link
Member

iCrawl commented Feb 3, 2022

This needs a rebase.

@iCrawl iCrawl merged commit 6b6222b into discordjs:main Feb 4, 2022
@suneettipirneni suneettipirneni deleted the builders/feat/unsafe-components branch February 7, 2022 16:22
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.

None yet

8 participants