1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 09:09:00 +03:00

and we're back to our PR

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2024-04-08 15:55:23 +03:00
parent 1350c65b3d
commit 422becf6c6
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1
4 changed files with 11 additions and 17 deletions

View file

@ -795,7 +795,7 @@
<data name="WarnPunishmentDurationNotSet" xml:space="preserve"> <data name="WarnPunishmentDurationNotSet" xml:space="preserve">
<value>Warn Punishment Duration is not set for the current punishment type.</value> <value>Warn Punishment Duration is not set for the current punishment type.</value>
</data> </data>
<data name="WarnPunishmentDisabled" xml:space="preserve"> <data name="WarnThresholdExceededDescription" xml:space="preserve">
<value>Warn Threshold is set, but the Warn Punishment is not.</value> <value>Increase the Warn Threshold or set a Warn Punishment.</value>
</data> </data>
</root> </root>

View file

@ -795,7 +795,7 @@
<data name="WarnPunishmentDurationNotSet" xml:space="preserve"> <data name="WarnPunishmentDurationNotSet" xml:space="preserve">
<value>Длительность наказания предупреждения не установлена для текущего типа наказания.</value> <value>Длительность наказания предупреждения не установлена для текущего типа наказания.</value>
</data> </data>
<data name="WarnPunishmentDisabled" xml:space="preserve"> <data name="WarnThresholdExceededDescription" xml:space="preserve">
<value>Порог предупреждения установлен, но наказание нет.</value> <value>Увеличьте порог предупреждения или установите наказание за предупреждение.</value>
</data> </data>
</root> </root>

View file

@ -120,10 +120,13 @@ public class WarnCommandGroup : CommandGroup
var warnPunishment = GuildSettings.WarnPunishment.Get(settings); var warnPunishment = GuildSettings.WarnPunishment.Get(settings);
var warnDuration = GuildSettings.WarnPunishmentDuration.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() var errorEmbed = new EmbedBuilder()
.WithSmallTitle(Messages.WarnPunishmentDisabled, bot) .WithSmallTitle(string.Format(Messages.WarnThresholdExceeded, warnThreshold), bot)
.WithDescription(Messages.WarnThresholdExceededDescription)
.WithColour(ColorsList.Red).Build(); .WithColour(ColorsList.Red).Build();
return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct: CancellationToken); return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct: CancellationToken);
@ -138,15 +141,6 @@ public class WarnCommandGroup : CommandGroup
return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct: CancellationToken); 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, return await WarnUserAsync(executor, target, reason, guild, data, channelId, bot, settings,
warns, warnThreshold, warnPunishment, warnDuration, ct); warns, warnThreshold, warnPunishment, warnDuration, ct);
} }

View file

@ -1337,11 +1337,11 @@ namespace Octobot {
} }
} }
internal static string WarnPunishmentDisabled internal static string WarnThresholdExceededDescription
{ {
get get
{ {
return ResourceManager.GetString("WarnPunishmentDisabled", resourceCulture); return ResourceManager.GetString("WarnThresholdExceededDescription", resourceCulture);
} }
} }
} }