.unban added
This commit is contained in:
parent
2d73f4bdfd
commit
111b4bc465
@ -24,11 +24,11 @@ namespace NadekoBot.Modules.Administration
|
|||||||
{"nl-NL", "Dutch, Netherlands"},
|
{"nl-NL", "Dutch, Netherlands"},
|
||||||
{"en-US", "English, United States"},
|
{"en-US", "English, United States"},
|
||||||
{"fr-FR", "Français, France"},
|
{"fr-FR", "Français, France"},
|
||||||
{"de-DE", "German, Germany"},
|
{"de-DE", "Deutsch, Deutschland"},
|
||||||
{"he-IL", "Hebrew, Israel" },
|
{"he-IL", "Hebrew, Israel" },
|
||||||
{"it-IT", "Italiano, Italia" },
|
{"it-IT", "Italiano, Italia" },
|
||||||
//{"ja-JP", "Japanese, Japan"},
|
//{"ja-JP", "Japanese, Japan"},
|
||||||
{"ko-KR", "Korean, South Korea" },
|
{"ko-KR", "한국어, 대한민국" },
|
||||||
{"nb-NO", "Norwegian (bokmål), Norway"},
|
{"nb-NO", "Norwegian (bokmål), Norway"},
|
||||||
{"pl-PL", "Polski, Polska" },
|
{"pl-PL", "Polski, Polska" },
|
||||||
{"pt-BR", "Português Brasileiro, Brasil"},
|
{"pt-BR", "Português Brasileiro, Brasil"},
|
||||||
|
@ -290,6 +290,51 @@ namespace NadekoBot.Modules.Administration
|
|||||||
.ConfigureAwait(false);
|
.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]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireUserPermission(GuildPermission.KickMembers)]
|
[RequireUserPermission(GuildPermission.KickMembers)]
|
||||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to unclaim ucall uc.
|
/// Looks up a localized string similar to unclaim ucall uc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -3240,6 +3240,15 @@
|
|||||||
<data name="warn_usage" xml:space="preserve">
|
<data name="warn_usage" xml:space="preserve">
|
||||||
<value>`{0}warn @b1nzy`</value>
|
<value>`{0}warn @b1nzy`</value>
|
||||||
</data>
|
</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">
|
<data name="warnclear_cmd" xml:space="preserve">
|
||||||
<value>warnclear warnc</value>
|
<value>warnclear warnc</value>
|
||||||
</data>
|
</data>
|
||||||
|
18
src/NadekoBot/Resources/ResponseStrings.Designer.cs
generated
18
src/NadekoBot/Resources/ResponseStrings.Designer.cs
generated
@ -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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Undeafen successful..
|
/// Looks up a localized string similar to Undeafen successful..
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to User's role added.
|
/// Looks up a localized string similar to User's role added.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2287,6 +2287,12 @@ Owner ID: {2}</value>
|
|||||||
<data name="administration_reason" xml:space="preserve">
|
<data name="administration_reason" xml:space="preserve">
|
||||||
<value>Reason</value>
|
<value>Reason</value>
|
||||||
</data>
|
</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">
|
<data name="administration_user_warned" xml:space="preserve">
|
||||||
<value>User {0} has been warned.</value>
|
<value>User {0} has been warned.</value>
|
||||||
</data>
|
</data>
|
||||||
|
Loading…
Reference in New Issue
Block a user