-
-
Notifications
You must be signed in to change notification settings - Fork 72
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: stricter types for preconditions #226
Conversation
d0e9f99
to
1e3f9c2
Compare
* @since 2.0.0 | ||
* @param options The command options given from the constructor. | ||
*/ | ||
protected parseConstructorPreConditions(options: CommandOptions): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be sure to mention this in discordjs/guide#711 because otherwise people won't know they have to extend this to have their own custom preconditions with a constructor pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoever ends up hitting merge be sure to add a whiteline before the breaking changes:
So:
Fixed cooldown precondition not working when defining alias properties from `Command`.
BREAKING CHANGE: Changed `Command#preconditions` to `PreconditionContainerArray`.
Becomes:
Fixed cooldown precondition not working when defining alias properties from `Command`.
BREAKING CHANGE: Changed `Command#preconditions` to `PreconditionContainerArray`.
Added `Command#parseConstructorPreConditions`. Added `Command#parseConstructorPreConditionsRunIn`. Added `Command#parseConstructorPreConditionsNsfw`. Added `Command#parseConstructorPreConditionsRequiredClientPermissions`. Added `Command#parseConstructorPreConditionsCooldown`. Added `CommandPreConditions.Permissions`. Added `CommandOptions.cooldownScope`. Added `CommandOptions.requiredClientPermissions`. Added `Preconditions` interface, this strict types all precondition names and contexts. Added `PreconditionContainerArray#append`. Added `SimplePreconditionSingleResolvableDetails`. Fixed cooldown precondition not working when defining alias properties from `Command`. BREAKING CHANGE: Changed `Command#preconditions` to `PreconditionContainerArray`. BREAKING CHANGE: Removed `Command#resolveConstructorPreConditions`. BREAKING CHANGE: Renamed `CommandOptions.cooldownBucket` to `cooldownLimit`. BREAKING CHANGE: Renamed `CommandOptions.cooldownDuration` to `cooldownDelay`. BREAKING CHANGE: Renamed `BucketType` to `BucketScope`. BREAKING CHANGE: Changed `PreconditionSingleResolvableDetails` to take a type parameter. BREAKING CHANGE: Changed `PreconditionSingleResolvable` to use `Preconditions`'s type. BREAKING CHANGE: Renamed `CooldownContext.bucketType` to `scope`.
1e3f9c2
to
0462736
Compare
I force-pushed with a fixed description (and resolved requests), so the separation isn't needed, @favna |
Command#parseConstructorPreConditions
.Command#parseConstructorPreConditionsRunIn
.Command#parseConstructorPreConditionsNsfw
.Command#parseConstructorPreConditionsRequiredClientPermissions
.Command#parseConstructorPreConditionsCooldown
.CommandPreConditions.Permissions
.CommandOptions.cooldownScope
.CommandOptions.requiredClientPermissions
.Preconditions
interface, this strict types all precondition names and contexts.PreconditionContainerArray#append
.SimplePreconditionSingleResolvableDetails
.Command
.Command#preconditions
toPreconditionContainerArray
.Command#resolveConstructorPreConditions
.CommandOptions.cooldownBucket
tocooldownLimit
.CommandOptions.cooldownDuration
tocooldownDelay
.BucketType
toBucketScope
.PreconditionSingleResolvableDetails
to take a type parameter.PreconditionSingleResolvable
to usePreconditions
's type.CooldownContext.bucketType
toscope
.