UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

24 lines (22 loc) 1.24 kB
import { __name } from '../../chunk-PAWJFY3S.mjs'; import { container } from '@sapphire/pieces'; import { BucketScope, CommandPreConditions } from '../types/Enums.mjs'; import '../utils/preconditions/PreconditionContainerArray.mjs'; function parseConstructorPreConditionsCooldown(command, cooldownLimit, cooldownDelay, cooldownScope, cooldownFilteredUsers, preconditionContainerArray) { const { defaultCooldown } = container.client.options; const filtered = defaultCooldown?.filteredCommands?.includes(command.name) ?? false; const limit = cooldownLimit ?? (filtered ? 0 : defaultCooldown?.limit ?? 1); const delay = cooldownDelay ?? (filtered ? 0 : defaultCooldown?.delay ?? 0); if (limit && delay) { const scope = cooldownScope ?? defaultCooldown?.scope ?? BucketScope.User; const filteredUsers = cooldownFilteredUsers ?? defaultCooldown?.filteredUsers; preconditionContainerArray.append({ name: CommandPreConditions.Cooldown, context: { scope, limit, delay, filteredUsers } }); } } __name(parseConstructorPreConditionsCooldown, "parseConstructorPreConditionsCooldown"); export { parseConstructorPreConditionsCooldown }; //# sourceMappingURL=cooldown.mjs.map //# sourceMappingURL=cooldown.mjs.map