|
1 | 1 | import { AliasPiece, AliasPieceOptions, PieceContext } from '@sapphire/pieces';
|
2 | 2 | import { Awaited, isNullish } from '@sapphire/utilities';
|
3 |
| -import { Message, PermissionResolvable, Permissions } from 'discord.js'; |
| 3 | +import { Message, PermissionResolvable, Permissions, Snowflake } from 'discord.js'; |
4 | 4 | import * as Lexure from 'lexure';
|
5 | 5 | import { Args } from '../parsers/Args';
|
6 | 6 | import { BucketScope } from '../types/Enums';
|
@@ -154,10 +154,12 @@ export abstract class Command<T = Args> extends AliasPiece {
|
154 | 154 | protected parseConstructorPreConditionsCooldown(options: CommandOptions) {
|
155 | 155 | const limit = options.cooldownLimit ?? 1;
|
156 | 156 | const delay = options.cooldownDelay ?? 0;
|
| 157 | + const filteredUsers = options.cooldownFilteredUsers; |
| 158 | + |
157 | 159 | if (limit && delay) {
|
158 | 160 | this.preconditions.append({
|
159 | 161 | name: CommandPreConditions.Cooldown,
|
160 |
| - context: { scope: options.cooldownScope ?? BucketScope.User, limit, delay } |
| 162 | + context: { scope: options.cooldownScope ?? BucketScope.User, limit, delay, filteredUsers } |
161 | 163 | });
|
162 | 164 | }
|
163 | 165 | }
|
@@ -344,6 +346,14 @@ export interface CommandOptions extends AliasPieceOptions, FlagStrategyOptions {
|
344 | 346 | */
|
345 | 347 | cooldownScope?: BucketScope;
|
346 | 348 |
|
| 349 | + /** |
| 350 | + * The users that are exempt from the Cooldown precondition. |
| 351 | + * Use this to filter out someone like a bot owner |
| 352 | + * @since 2.0.0 |
| 353 | + * @default undefined |
| 354 | + */ |
| 355 | + cooldownFilteredUsers?: Snowflake[]; |
| 356 | + |
347 | 357 | /**
|
348 | 358 | * The required permissions for the client.
|
349 | 359 | * @since 2.0.0
|
|
0 commit comments