.unban added

This commit is contained in:
Kwoth 2017-03-30 04:35:24 +02:00
parent 2d73f4bdfd
commit 111b4bc465
6 changed files with 107 additions and 2 deletions

View File

@ -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"},

View File

@ -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)]

View File

@ -8456,6 +8456,33 @@ namespace NadekoBot.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to unban.
/// </summary>
public static string unban_cmd {
get {
return ResourceManager.GetString("unban_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unbans a user with the provided user#discrim or id..
/// </summary>
public static string unban_desc {
get {
return ResourceManager.GetString("unban_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}unban kwoth#1234` or `{0}unban 123123123`.
/// </summary>
public static string unban_usage {
get {
return ResourceManager.GetString("unban_usage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to unclaim ucall uc.
/// </summary>

View File

@ -3240,6 +3240,15 @@
<data name="warn_usage" xml:space="preserve">
<value>`{0}warn @b1nzy`</value>
</data>
<data name="unban_cmd" xml:space="preserve">
<value>unban</value>
</data>
<data name="unban_desc" xml:space="preserve">
<value>Unbans a user with the provided user#discrim or id.</value>
</data>
<data name="unban_usage" xml:space="preserve">
<value>`{0}unban kwoth#1234` or `{0}unban 123123123`</value>
</data>
<data name="warnclear_cmd" xml:space="preserve">
<value>warnclear warnc</value>
</data>

View File

@ -1504,6 +1504,15 @@ namespace NadekoBot.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to User {0} has been unbanned..
/// </summary>
public static string administration_unbanned_user {
get {
return ResourceManager.GetString("administration_unbanned_user", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Undeafen successful..
/// </summary>
@ -1585,6 +1594,15 @@ namespace NadekoBot.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to User not found..
/// </summary>
public static string administration_user_not_found {
get {
return ResourceManager.GetString("administration_user_not_found", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to User&apos;s role added.
/// </summary>

View File

@ -2287,6 +2287,12 @@ Owner ID: {2}</value>
<data name="administration_reason" xml:space="preserve">
<value>Reason</value>
</data>
<data name="administration_unbanned_user" xml:space="preserve">
<value>User {0} has been unbanned.</value>
</data>
<data name="administration_user_not_found" xml:space="preserve">
<value>User not found.</value>
</data>
<data name="administration_user_warned" xml:space="preserve">
<value>User {0} has been warned.</value>
</data>