Hey, there is a *very frustrating* mismatch in types for slash command builders in sapphire it seems

Hey, there is a very frustrating mismatch in types for slash command builders in sapphire it seems
Argument of type 'import("./node_modules/@sapphire/framework/node_modules/@discordjs/builders/dist/index").SlashCommandStringOption' is not assignable to parameter of type 'import("./node_modules/@discordjs/builders/dist/interactions/slashCommands/options/string").SlashCommandStringOption'.
Property 'runRequiredValidations' is protected but type 'ApplicationCommandOptionBase' is not a class derived from 'ApplicationCommandOptionBase'.ts(2345)
Argument of type 'import("./node_modules/@sapphire/framework/node_modules/@discordjs/builders/dist/index").SlashCommandStringOption' is not assignable to parameter of type 'import("./node_modules/@discordjs/builders/dist/interactions/slashCommands/options/string").SlashCommandStringOption'.
Property 'runRequiredValidations' is protected but type 'ApplicationCommandOptionBase' is not a class derived from 'ApplicationCommandOptionBase'.ts(2345)
It looks like it is because sapphire uses [email protected] but i use [email protected] I saw that you debumped builders multiple time recently, what's the reason? because this is currently breaking :/ is it now possible to re-bump to builders@>=1 ? thanks
13 Replies
Favna
Favna•3y ago
no builders >=1 doesnt work with djs v13 / dapi-types 0.33 so that'll have to wait until sapphire v4
Elliot
ElliotOP•3y ago
ah i did not know that, it was not stated in builder's changelog... which is weird if it is breaking. anyway thanks for the answer, i'll debump mine then
Favna
Favna•3y ago
v0 -> v1 is breaking by the sheer fact that it's a semver major 👀
Elliot
ElliotOP•3y ago
yep but the changelog litteraly says "nothing changed"
Favna
Favna•3y ago
ehhhhhhhhhhh that's true
Elliot
ElliotOP•3y ago
hey, why don't you export * from @sapphire/pieces? https://github.com/sapphiredev/framework/blob/314840ba3390f146db60197be152567f636c2f62/src/index.ts#L32 I'm trying to ditch @pieces in favor of forwarded exports in @framework, but i am missing PieceJSON (and i can see that AliasPieceJSON is also missing). Is there a reason why it is not export *? Are (Alias)PieceJSON oversights? i can shoot a pr real quick to add (Alias)PieceJSON or change to export * if needed
Ben
Ben•3y ago
I found, well something (idk if its a bug or just an out of date example) in Args.getOption(). The examples in the js docs linked below show that getOption returns a string or null. However, this is not the case, the function itself calls ArgumentStream.option() from @sapphire/lexure which returns an Option<string>. I'm not sure if this change is intentional as its not listed in the migration guide but I though y'all should know https://github.com/sapphiredev/framework/blob/main/src/lib/parsers/Args.ts#L576-L591 Also I have no ide how to get the actual value given to the option out of an Option<string> since it doesn't seem to have a value property even after an isSome() typecheck NVM I didn't see the unrwapOr() function
24
24•3y ago
Yes, a huge oversight is the docs the unwrapOr should cover most things, but I think there are still 2 places where the docs are wrong (I think..)
Favna
Favna•3y ago
Forgot I guess but at any rate you can use their namespaces equivalents Piece.JSON and AliasPiece.JSON Rather an oversight in framework. End users shouldn't have to deal with result values from args. Should be resolved in 3.1.0 as per https://github.com/sapphiredev/framework/pull/511
Elliot
ElliotOP•3y ago
hey is there a way to send a paginated message in an ephemeral reply? so only the user sees it. I couldn't find any
Favna
Favna•3y ago
Pretty sure if you first defer with ephemeral then the PM will automatically also be ephemeral
EvolutionX
EvolutionX•3y ago
defer the reply in ephemeral way and normally do it
Elliot
ElliotOP•3y ago
yep it does the trick, thanks! Although i have to say this is very unintuitive 😅 it would be way better to have a .setEphemeral in the builder, or to give an option in .run() : .run(interaction, { target?: User, ephemeral?: boolean }

Did you find this page helpful?