Closed lassejlv closed 6 months ago
Hi. Can you please share the exact error you're facing. Thanks
When using ValidationProps type, and using .reply you are getting an type error.
I was able to reproduce the issue:
import type { ValidationProps } from 'commandkit';
export default function ({ interaction, commandObj, handler }: ValidationProps) {
interaction.reply('This does not work.'); // Property 'reply' does not exist on type 'ChatInputCommandInteraction<CacheType> | ContextMenuCommandInteraction<CacheType> | AutocompleteInteraction<...>'.
}
With version 1.10, validations also support autocomplete. This is a new feature in command files.
With this new update, the interaction
object can now also be of type AutocompleteInteraction
alongside the previous ChatInputCommandInteraction
and ContextMenuCommandInteraction
.
Since you can't "reply" to the AutocompleteInteraction
type (you can only "respond" with autocomplete), you need to add a check in your validation to ensure that the interaction type you're handling is of either ChatInputCommandInteraction
, or ContextMenuCommandInteraction
.
import type { ValidationProps } from 'commandkit';
export default function ({ interaction, commandObj, handler }: ValidationProps) {
if (interaction.isAutocomplete()) return;
interaction.reply('This now works!');
}
Gonna leave this open for now for feedback
Arr alright thanks for the help :) keep up the good work!
https://commandkit.js.org/guide/validation-file-setup then using the
ValidationProps
. Then if you useinteraction.reply(...)
it will throw an error. Version:0.1.10