selfrole bugfix

This commit is contained in:
Erik 2022-07-09 11:09:47 +03:00
parent 22a87766d1
commit c9f0ae1144
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -36,11 +36,11 @@ class SelfroleCommand extends SlashCommand {
if (!selfrole.roles.length) return { index: 'COMMAND_SELFROLE_NONE', emoji: 'failure' }; if (!selfrole.roles.length) return { index: 'COMMAND_SELFROLE_NONE', emoji: 'failure' };
const memberRoles = member.roles.cache.map((r) => r.id); const memberRoles = member.roles.cache.map((r) => r.id);
const invalid = roles.value.filter((r) => !selfrole.roles.includes(r.id)); const invalid = roles?.value.filter((r) => !selfrole.roles.includes(r.id)) || [];
const _roles = roles.value.filter((r) => selfrole.roles.includes(r.id)); const _roles = roles?.value.filter((r) => selfrole.roles.includes(r.id)) || [];
let warning = null; let warning = null;
if (invalid.length) warning = guild.format('COMMAND_SELFROLE_INVALID', { roles: invalid.map((r) => r.name).join('**, **') }); if (invalid.length) warning = guild.format('COMMAND_SELFROLE_INVALID', { roles: invalid.map((r) => r.name).join('**, **') });
if(!_roles.length) return { content: warning }; if(!_roles.length && subcommand !== 'clear') return { content: warning };
let index = null, let index = null,
params = {}; params = {};