From 1dcd158f43432c71cb1a84c06761a72713e83b15 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 28 Oct 2024 21:42:05 +0000 Subject: [PATCH] fix: Bot will now not accept .aar Role if that Role is higher than or equal to bot's role. Previously bot would just fail silently, now there is a proper error message. --- .../AutoAssignableRoles/AutoAssignRoleCommands.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs b/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs index 86af7cc0d..3798141a2 100644 --- a/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs @@ -24,6 +24,13 @@ public partial class Administration await Response().Error(strs.hierarchy).SendAsync(); return; } + + // the user can't aar the role which is greater or equal to the bot's highest role + if (role.Position >= ((SocketGuild)ctx.Guild).CurrentUser.GetRoles().Max(x => x.Position)) + { + await Response().Error(strs.hierarchy).SendAsync(); + return; + } var roles = await _service.ToggleAarAsync(ctx.Guild.Id, role.Id); if (roles.Count == 0)