discordjs / builders

A collection of builders that you can use when creating your bot.
Apache License 2.0
97 stars 37 forks source link

chore: update dapi types and fix errors #59

Closed suneettipirneni closed 2 years ago

suneettipirneni commented 2 years ago

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

This adds support for the latest dapi-types. Some changes to the structures needed to be made to make builders compatible with the new types. SlashCommandOptionBase is now generic and accepts an optional ApplicationCommandOptionType.

Status and versioning classification:

codecov-commenter commented 2 years ago

Codecov Report

Merging #59 (4fa9ae1) into main (0263f00) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #59   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        22    +1     
  Lines          276       291   +15     
  Branches        37        37           
=========================================
+ Hits           276       291   +15     
Impacted Files Coverage Δ
...s/slashCommands/mixins/CommandChannelOptionBase.ts 100.00% <ø> (ø)
...ractions/slashCommands/mixins/CommandOptionBase.ts 100.00% <ø> (ø)
...s/slashCommands/mixins/CommandOptionWithChoices.ts 100.00% <ø> (ø)
src/interactions/slashCommands/options/number.ts 100.00% <0.00%> (ø)
src/interactions/slashCommands/options/integer.ts 100.00% <0.00%> (ø)
...ns/slashCommands/mixins/CommandNumberOptionBase.ts 100.00% <0.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 0263f00...4fa9ae1. Read the comment docs.

suneettipirneni commented 2 years ago

I don't get the point of the generics..

Without the generics TS can't tell what specific type of the type prop on SlashCommandBase is. For example if you have an option that takes choices, but your type prop is any ApplicationCommandOptionType then that's an error. This is because not all option types have a choices prop. This is the same for other type-specific props.

suneettipirneni commented 2 years ago

The issues here should be fixed by:

vladfrangu commented 2 years ago

This needs a rebase

PythonCoderAS commented 2 years ago

What is the status on this PR? I am unable to upgrade my version of discord-api-types since that will also break the discordjs buiders.