@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
27 lines (24 loc) • 1.37 kB
JavaScript
;
var pieces = require('@sapphire/pieces');
var Enums_cjs = require('../types/Enums.cjs');
require('../utils/preconditions/PreconditionContainerArray.cjs');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
function parseConstructorPreConditionsCooldown(command, cooldownLimit, cooldownDelay, cooldownScope, cooldownFilteredUsers, preconditionContainerArray) {
const { defaultCooldown } = pieces.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 ?? Enums_cjs.BucketScope.User;
const filteredUsers = cooldownFilteredUsers ?? defaultCooldown?.filteredUsers;
preconditionContainerArray.append({
name: Enums_cjs.CommandPreConditions.Cooldown,
context: { scope, limit, delay, filteredUsers }
});
}
}
__name(parseConstructorPreConditionsCooldown, "parseConstructorPreConditionsCooldown");
exports.parseConstructorPreConditionsCooldown = parseConstructorPreConditionsCooldown;
//# sourceMappingURL=cooldown.cjs.map
//# sourceMappingURL=cooldown.cjs.map