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:
parent
1350c65b3d
commit
422becf6c6
4 changed files with 11 additions and 17 deletions
|
@ -795,7 +795,7 @@
|
|||
<data name="WarnPunishmentDurationNotSet" xml:space="preserve">
|
||||
<value>Warn Punishment Duration is not set for the current punishment type.</value>
|
||||
</data>
|
||||
<data name="WarnPunishmentDisabled" xml:space="preserve">
|
||||
<value>Warn Threshold is set, but the Warn Punishment is not.</value>
|
||||
<data name="WarnThresholdExceededDescription" xml:space="preserve">
|
||||
<value>Increase the Warn Threshold or set a Warn Punishment.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -795,7 +795,7 @@
|
|||
<data name="WarnPunishmentDurationNotSet" xml:space="preserve">
|
||||
<value>Длительность наказания предупреждения не установлена для текущего типа наказания.</value>
|
||||
</data>
|
||||
<data name="WarnPunishmentDisabled" xml:space="preserve">
|
||||
<value>Порог предупреждения установлен, но наказание нет.</value>
|
||||
<data name="WarnThresholdExceededDescription" xml:space="preserve">
|
||||
<value>Увеличьте порог предупреждения или установите наказание за предупреждение.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
4
src/Messages.Designer.cs
generated
4
src/Messages.Designer.cs
generated
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue