From 223b668628c6691a0b1f8fb1f731f58ffbfe3352 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sat, 1 Apr 2017 11:15:37 +0200 Subject: [PATCH] softban is a separate punishment from kick now. Commandlist updated --- .../Modules/Administration/Commands/LogCommand.cs | 3 +++ .../Administration/Commands/ProtectionCommands.cs | 7 +++++++ .../Administration/Commands/UserPunishCommands.cs | 11 +++++++++++ src/NadekoBot/Resources/ResponseStrings.Designer.cs | 11 ++++++++++- src/NadekoBot/Resources/ResponseStrings.resx | 6 +++++- .../Services/Database/Models/AntiProtection.cs | 1 + 6 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs b/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs index f061f045..515c2f46 100644 --- a/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs +++ b/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs @@ -307,6 +307,9 @@ namespace NadekoBot.Modules.Administration punishment = "🔇 " + logChannel.Guild.GetLogText("muted_pl").ToUpperInvariant(); break; case PunishmentAction.Kick: + punishment = "👢 " + logChannel.Guild.GetLogText("kicked_pl").ToUpperInvariant(); + break; + case PunishmentAction.Softban: punishment = "☣ " + logChannel.Guild.GetLogText("soft_banned_pl").ToUpperInvariant(); break; case PunishmentAction.Ban: diff --git a/src/NadekoBot/Modules/Administration/Commands/ProtectionCommands.cs b/src/NadekoBot/Modules/Administration/Commands/ProtectionCommands.cs index af7269c9..23f1eaf0 100644 --- a/src/NadekoBot/Modules/Administration/Commands/ProtectionCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/ProtectionCommands.cs @@ -188,6 +188,13 @@ namespace NadekoBot.Modules.Administration catch (Exception ex) { _log.Warn(ex, "I can't apply punishement"); } break; case PunishmentAction.Kick: + try + { + await gu.KickAsync().ConfigureAwait(false); + } + catch (Exception ex) { _log.Warn(ex, "I can't apply punishement"); } + break; + case PunishmentAction.Softban: try { await gu.Guild.AddBanAsync(gu, 7).ConfigureAwait(false); diff --git a/src/NadekoBot/Modules/Administration/Commands/UserPunishCommands.cs b/src/NadekoBot/Modules/Administration/Commands/UserPunishCommands.cs index f37b864c..f794d47a 100644 --- a/src/NadekoBot/Modules/Administration/Commands/UserPunishCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/UserPunishCommands.cs @@ -72,6 +72,17 @@ namespace NadekoBot.Modules.Administration case PunishmentAction.Ban: await guild.AddBanAsync(user).ConfigureAwait(false); break; + case PunishmentAction.Softban: + await guild.AddBanAsync(user).ConfigureAwait(false); + try + { + await guild.RemoveBanAsync(user).ConfigureAwait(false); + } + catch + { + await guild.RemoveBanAsync(user).ConfigureAwait(false); + } + break; default: break; } diff --git a/src/NadekoBot/Resources/ResponseStrings.Designer.cs b/src/NadekoBot/Resources/ResponseStrings.Designer.cs index ea980b1f..3d91002f 100644 --- a/src/NadekoBot/Resources/ResponseStrings.Designer.cs +++ b/src/NadekoBot/Resources/ResponseStrings.Designer.cs @@ -574,6 +574,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Kicked. + /// + public static string administration_kicked_pl { + get { + return ResourceManager.GetString("administration_kicked_pl", resourceCulture); + } + } + /// /// Looks up a localized string similar to User kicked. /// @@ -1504,7 +1513,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to soft-banned (kicked). + /// Looks up a localized string similar to soft-banned. /// public static string administration_soft_banned_pl { get { diff --git a/src/NadekoBot/Resources/ResponseStrings.resx b/src/NadekoBot/Resources/ResponseStrings.resx index 92087d6b..c71eea89 100644 --- a/src/NadekoBot/Resources/ResponseStrings.resx +++ b/src/NadekoBot/Resources/ResponseStrings.resx @@ -740,7 +740,7 @@ Reason: {1} Slow mode initiated - soft-banned (kicked) + soft-banned PLURAL @@ -2284,6 +2284,10 @@ Owner ID: {2} Command Text + + Kicked + PLURAL + Moderator diff --git a/src/NadekoBot/Services/Database/Models/AntiProtection.cs b/src/NadekoBot/Services/Database/Models/AntiProtection.cs index 0172dd90..a90ee649 100644 --- a/src/NadekoBot/Services/Database/Models/AntiProtection.cs +++ b/src/NadekoBot/Services/Database/Models/AntiProtection.cs @@ -31,6 +31,7 @@ namespace NadekoBot.Services.Database.Models Mute, Kick, Ban, + Softban } public class AntiSpamIgnore : DbEntity