kick and ban will respoect role hierarchy now
This commit is contained in:
parent
1c2236ba66
commit
574b23070a
@ -301,6 +301,16 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
msg = "No reason provided.";
|
||||
}
|
||||
if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Select(r=>r.Position).Max() >= ((IGuildUser)umsg.Author).Roles.Select(r => r.Position).Max())
|
||||
{
|
||||
await channel.SendMessageAsync("You can't use this command on users with a role higher or equal to yours in the role hierarchy.");
|
||||
return;
|
||||
}
|
||||
if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Max().Position >= ((IGuildUser)umsg.Author).Roles.Max().Position)
|
||||
{
|
||||
await channel.SendMessageAsync("You can't use this command on users with a role higher or equal to yours in the role hierarchy.");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
await (await user.CreateDMChannelAsync()).SendMessageAsync($"**You have been BANNED from `{channel.Guild.Name}` server.**\n" +
|
||||
@ -330,6 +340,11 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
msg = "No reason provided.";
|
||||
}
|
||||
if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Max().Position >= ((IGuildUser)umsg.Author).Roles.Max().Position)
|
||||
{
|
||||
await channel.SendMessageAsync("You can't use this command on users with a role higher or equal to yours in the role hierarchy.");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
await user.SendMessageAsync($"**You have been SOFT-BANNED from `{channel.Guild.Name}` server.**\n" +
|
||||
@ -363,6 +378,12 @@ namespace NadekoBot.Modules.Administration
|
||||
await channel.SendMessageAsync("User not found.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Select(r => r.Position).Max() >= ((IGuildUser)umsg.Author).Roles.Select(r => r.Position).Max())
|
||||
{
|
||||
await channel.SendMessageAsync("You can't use this command on users with a role higher or equal to yours in the role hierarchy.");
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(msg))
|
||||
{
|
||||
try
|
||||
|
@ -79,7 +79,7 @@ namespace NadekoBot.Modules.Utility
|
||||
`Joined Server:` **{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm")}**
|
||||
`Joined Discord:` **{user.CreatedAt.ToString("dd.MM.yyyy HH:mm")}**
|
||||
`Roles:` **({user.Roles.Count()}) - {string.Join(", ", user.Roles.Select(r => r.Name)).SanitizeMentions()}**
|
||||
`AvatarUrl:` **{user.AvatarUrl}**";
|
||||
`AvatarUrl:` **{await NadekoBot.Google.ShortenUrl(user.AvatarUrl).ConfigureAwait(false)}**";
|
||||
await msg.Reply(toReturn).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user