From 422becf6c6338db4c5dec49592019e353df69299 Mon Sep 17 00:00:00 2001 From: mctaylors Date: Mon, 8 Apr 2024 15:55:23 +0300 Subject: [PATCH] and we're back to our PR Signed-off-by: mctaylors --- locale/Messages.resx | 4 ++-- locale/Messages.ru.resx | 4 ++-- src/Commands/WarnCommandGroup.cs | 16 +++++----------- src/Messages.Designer.cs | 4 ++-- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/locale/Messages.resx b/locale/Messages.resx index 9f771e3..191e4a1 100644 --- a/locale/Messages.resx +++ b/locale/Messages.resx @@ -795,7 +795,7 @@ Warn Punishment Duration is not set for the current punishment type. - - Warn Threshold is set, but the Warn Punishment is not. + + Increase the Warn Threshold or set a Warn Punishment. diff --git a/locale/Messages.ru.resx b/locale/Messages.ru.resx index 1dd0ffc..f3fb587 100644 --- a/locale/Messages.ru.resx +++ b/locale/Messages.ru.resx @@ -795,7 +795,7 @@ Длительность наказания предупреждения не установлена для текущего типа наказания. - - Порог предупреждения установлен, но наказание нет. + + Увеличьте порог предупреждения или установите наказание за предупреждение. diff --git a/src/Commands/WarnCommandGroup.cs b/src/Commands/WarnCommandGroup.cs index 7ad1f80..dea3102 100644 --- a/src/Commands/WarnCommandGroup.cs +++ b/src/Commands/WarnCommandGroup.cs @@ -120,10 +120,13 @@ public class WarnCommandGroup : CommandGroup var warnPunishment = GuildSettings.WarnPunishment.Get(settings); var warnDuration = GuildSettings.WarnPunishmentDuration.Get(settings); - if (warnPunishment is "off" or "disable" or "disabled" && warns.Count - 1 >= warnThreshold) + if (warnPunishment is "off" or "disable" or "disabled" + && warns.Count + 1 >= warnThreshold + && warnThreshold is not 0) { var errorEmbed = new EmbedBuilder() - .WithSmallTitle(Messages.WarnPunishmentDisabled, bot) + .WithSmallTitle(string.Format(Messages.WarnThresholdExceeded, warnThreshold), bot) + .WithDescription(Messages.WarnThresholdExceededDescription) .WithColour(ColorsList.Red).Build(); return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct: CancellationToken); @@ -138,15 +141,6 @@ public class WarnCommandGroup : CommandGroup return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct: CancellationToken); } - if (warns.Count >= warnThreshold && warnThreshold is not 0) - { - var errorEmbed = new EmbedBuilder() - .WithSmallTitle(string.Format(Messages.WarnThresholdExceeded, warnThreshold), bot) - .WithColour(ColorsList.Red).Build(); - - return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct: ct); - } - return await WarnUserAsync(executor, target, reason, guild, data, channelId, bot, settings, warns, warnThreshold, warnPunishment, warnDuration, ct); } diff --git a/src/Messages.Designer.cs b/src/Messages.Designer.cs index 8141cb0..19737fd 100644 --- a/src/Messages.Designer.cs +++ b/src/Messages.Designer.cs @@ -1337,11 +1337,11 @@ namespace Octobot { } } - internal static string WarnPunishmentDisabled + internal static string WarnThresholdExceededDescription { get { - return ResourceManager.GetString("WarnPunishmentDisabled", resourceCulture); + return ResourceManager.GetString("WarnThresholdExceededDescription", resourceCulture); } } }