From 2d81bc45fdf7f3d9cd97e2a4f1a8237953197fc6 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Tue, 17 Oct 2017 15:14:15 +0200 Subject: [PATCH] .warn can now only be used on users lower than you in the role hierarchy --- NadekoBot.Core/Modules/Administration/UserPunishCommands.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NadekoBot.Core/Modules/Administration/UserPunishCommands.cs b/NadekoBot.Core/Modules/Administration/UserPunishCommands.cs index 2b70661a..1eb7dc94 100644 --- a/NadekoBot.Core/Modules/Administration/UserPunishCommands.cs +++ b/NadekoBot.Core/Modules/Administration/UserPunishCommands.cs @@ -29,6 +29,11 @@ namespace NadekoBot.Modules.Administration [RequireUserPermission(GuildPermission.BanMembers)] public async Task Warn(IGuildUser user, [Remainder] string reason = null) { + if (Context.User.Id != user.Guild.OwnerId && (user.GetRoles().Select(r => r.Position).Max() >= ((IGuildUser)Context.User).GetRoles().Select(r => r.Position).Max())) + { + await ReplyErrorLocalized("hierarchy").ConfigureAwait(false); + return; + } try { await (await user.GetOrCreateDMChannelAsync()).EmbedAsync(new EmbedBuilder().WithErrorColor()