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.

This commit is contained in:
Toastie (DCS Team) 2024-10-29 23:36:21 +13:00
parent 524015410a
commit 23aabd26fa
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -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();