Skip to content

Commit

Permalink
feat: ask for MANAGE_ROLES permission on /checkRoles
Browse files Browse the repository at this point in the history
  • Loading branch information
tippfehlr committed Aug 11, 2024
1 parent 3fcfa8a commit bccfcaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -118,4 +119,4 @@
"deleteActivityRoles": {
"deleteAllConfirmation": "Are you sure you want to delete all activity roles?"
}
}
}
8 changes: 7 additions & 1 deletion src/modules/commands/checkRoles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit bccfcaa

Please sign in to comment.