UNPKG

@ayanaware/bentocord

Version:

Bentocord is a Bento plugin designed to rapidly build fully functional Discord Bots.

25 lines 959 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RoleSuppressor = void 0; const SuppressorType_1 = require("../constants/SuppressorType"); class RoleSuppressor { constructor() { this.suppressor = SuppressorType_1.SuppressorType.ROLE; } async suppress(ctx, option, roleIds, all = false) { if (!Array.isArray(roleIds)) return false; if (!ctx.member) return false; const memberRoleIds = ctx.member.roles; let result = false; if (all) result = roleIds.every(r => memberRoleIds.includes(r)); else result = roleIds.some(r => memberRoleIds.includes(r)); const message = await ctx.formatTranslation('BENTOCORD_SUPPRESSOR_ROLE', {}, 'You do not possess the required roles.'); return result ? false : message; } } exports.RoleSuppressor = RoleSuppressor; //# sourceMappingURL=RoleSuppressor.js.map