From c9f0ae11441934857c5bcd6bf508589f8372cd85 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sat, 9 Jul 2022 11:09:47 +0300 Subject: [PATCH] selfrole bugfix --- src/structure/components/commands/utility/Selfrole.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structure/components/commands/utility/Selfrole.js b/src/structure/components/commands/utility/Selfrole.js index 39c6394..fef0737 100644 --- a/src/structure/components/commands/utility/Selfrole.js +++ b/src/structure/components/commands/utility/Selfrole.js @@ -36,11 +36,11 @@ class SelfroleCommand extends SlashCommand { if (!selfrole.roles.length) return { index: 'COMMAND_SELFROLE_NONE', emoji: 'failure' }; const memberRoles = member.roles.cache.map((r) => 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 invalid = roles?.value.filter((r) => !selfrole.roles.includes(r.id)) || []; + const _roles = roles?.value.filter((r) => selfrole.roles.includes(r.id)) || []; let warning = null; 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, params = {};