From bccfcaab2157693314a19ffc9625a765187da03e Mon Sep 17 00:00:00 2001 From: tippfehlr Date: Sun, 11 Aug 2024 13:34:23 +0200 Subject: [PATCH] feat: ask for MANAGE_ROLES permission on /checkRoles --- locales/en-US.json | 5 +++-- src/modules/commands/checkRoles.ts | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/locales/en-US.json b/locales/en-US.json index 438a37c..39ce9cb 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -103,7 +103,8 @@ "checkRoles": { "description": "re-check all users/roles", "success": "checked {{{usersChecked}}} users, added {{{added}}} and removed {{{removed}}} roles", - "in-progress": "IN PROGRESS: already checked {{{usersChecked}}}/{{{totalUsersToCheck}}} users, added {{{added}}} and removed {{{removed}}} roles." + "in-progress": "IN PROGRESS: already checked {{{usersChecked}}}/{{{totalUsersToCheck}}} users, added {{{added}}} and removed {{{removed}}} roles.", + "askForManageRolesPermission": "I don’t have the `MANAGE_ROLES` permission but need it to assign roles.\n Please add the permission to the “Activity Roles” role. Otherwise the bot will leave the guild automatically." }, "Cancelled": "Cancelled", "deleteActivityRole": { @@ -118,4 +119,4 @@ "deleteActivityRoles": { "deleteAllConfirmation": "Are you sure you want to delete all activity roles?" } -} \ No newline at end of file +} diff --git a/src/modules/commands/checkRoles.ts b/src/modules/commands/checkRoles.ts index 804a647..0c5c37f 100644 --- a/src/modules/commands/checkRoles.ts +++ b/src/modules/commands/checkRoles.ts @@ -34,7 +34,13 @@ export async function checkRolesStandalone({ }) { if (!guild.members.me?.permissions.has(PermissionsBitField.Flags.ManageRoles)) { if (interaction && locale) { - //TODO: add message to allow permission + await interaction.reply({ + content: __({ + phrase: + 'checkRoles->askForManageRolesPermission:I don’t have the `MANAGE_ROLES` permission but need it to assign roles.\n\ +Please add the permission to the “Activity Roles” role. Otherwise the bot will leave the guild automatically.', + }), + }); return; } else { log.warn(