.warnp should accept roles only below your max role. Also added a custom error message

This commit is contained in:
Kwoth
2021-07-13 23:58:16 +02:00
parent 71da4d11c0
commit 3c33c55dda
2 changed files with 9 additions and 0 deletions

View File

@@ -323,6 +323,14 @@ namespace NadekoBot.Modules.Administration
public async Task WarnPunish(int number, AddRole _, IRole role, StoopidTime time = null)
{
var punish = PunishmentAction.AddRole;
if (ctx.Guild.OwnerId != ctx.User.Id &&
role.Position >= ((IGuildUser)ctx.User).GetRoles().Max(x => x.Position))
{
await ReplyErrorLocalizedAsync("role_too_high");
return;
}
var success = _service.WarnPunish(ctx.Guild.Id, number, punish, time, role);
if (!success)

View File

@@ -80,6 +80,7 @@
"greet_off": "Greet announcements disabled.",
"greet_on": "Greet announcements enabled on this channel.",
"hierarchy": "You can't use this command on users with a role higher or equal than yours (or mine) in the role hierarchy.",
"role_too_high": "You can't use this command with roles which are above your highest role, unless you're server administrator.",
"images_loading": "Images will be reloaded within a few seconds.",
"insuf_perms_i": "I have insufficient permissions.",
"insuf_perms_u": "You have insufficient permissions.",