From 23aabd26fa05cd8e0b1c492caf05e133f2e70411 Mon Sep 17 00:00:00 2001 From: Toastie Date: Tue, 29 Oct 2024 23:36:21 +1300 Subject: [PATCH] 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/EllieBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs b/src/EllieBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs index dc687cc..7ff09d9 100644 --- a/src/EllieBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs +++ b/src/EllieBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs @@ -25,6 +25,13 @@ public partial class Administration 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) await Response().Confirm(strs.aar_disabled).SendAsync();