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

fix(Command): use optional access operator #307

Merged
merged 1 commit into from
Oct 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/structures/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ export abstract class Command<T = Args, O extends CommandOptions = CommandOption
// be set. If an overridden value is passed, it will have priority. Otherwise it will default to 0 if filtered
// (causing the precondition to not be registered) or the default value with a fallback to a single-use cooldown.
const filtered = defaultCooldown?.filteredCommands?.includes(this.name) ?? false;
const limit = options.cooldownLimit ?? (filtered ? 0 : defaultCooldown!.limit ?? 1);
const delay = options.cooldownDelay ?? (filtered ? 0 : defaultCooldown!.delay ?? 0);
const limit = options.cooldownLimit ?? (filtered ? 0 : defaultCooldown?.limit ?? 1);
const delay = options.cooldownDelay ?? (filtered ? 0 : defaultCooldown?.delay ?? 0);

if (limit && delay) {
const scope = options.cooldownScope ?? defaultCooldown?.scope ?? BucketScope.User;
Expand Down