.unban added
This commit is contained in:
@@ -24,11 +24,11 @@ namespace NadekoBot.Modules.Administration
|
||||
{"nl-NL", "Dutch, Netherlands"},
|
||||
{"en-US", "English, United States"},
|
||||
{"fr-FR", "Français, France"},
|
||||
{"de-DE", "German, Germany"},
|
||||
{"de-DE", "Deutsch, Deutschland"},
|
||||
{"he-IL", "Hebrew, Israel" },
|
||||
{"it-IT", "Italiano, Italia" },
|
||||
//{"ja-JP", "Japanese, Japan"},
|
||||
{"ko-KR", "Korean, South Korea" },
|
||||
{"ko-KR", "한국어, 대한민국" },
|
||||
{"nb-NO", "Norwegian (bokmål), Norway"},
|
||||
{"pl-PL", "Polski, Polska" },
|
||||
{"pt-BR", "Português Brasileiro, Brasil"},
|
||||
|
@@ -290,6 +290,51 @@ namespace NadekoBot.Modules.Administration
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireUserPermission(GuildPermission.BanMembers)]
|
||||
[RequireBotPermission(GuildPermission.BanMembers)]
|
||||
public async Task Unban([Remainder]string user)
|
||||
{
|
||||
var bans = await Context.Guild.GetBansAsync();
|
||||
|
||||
var bun = bans.FirstOrDefault(x => x.User.ToString().ToLowerInvariant() == user.ToLowerInvariant());
|
||||
|
||||
if (bun == null)
|
||||
{
|
||||
await ReplyErrorLocalized("user_not_found").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
await UnbanInternal(bun.User).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireUserPermission(GuildPermission.BanMembers)]
|
||||
[RequireBotPermission(GuildPermission.BanMembers)]
|
||||
public async Task Unban(ulong userId)
|
||||
{
|
||||
var bans = await Context.Guild.GetBansAsync();
|
||||
|
||||
var bun = bans.FirstOrDefault(x => x.User.Id == userId);
|
||||
|
||||
if (bun == null)
|
||||
{
|
||||
await ReplyErrorLocalized("user_not_found").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
await UnbanInternal(bun.User).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task UnbanInternal(IUser user)
|
||||
{
|
||||
await Context.Guild.RemoveBanAsync(user).ConfigureAwait(false);
|
||||
|
||||
await ReplyConfirmLocalized("unbanned_user", Format.Bold(user.ToString())).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireUserPermission(GuildPermission.KickMembers)]
|
||||
|
Reference in New Issue
Block a user