Skip to content

Commit 482bf03

Browse files
committed
WarningHelper: make warning counts consistent and more configurable
Fixes #250
1 parent 646751e commit 482bf03

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Helpers/WarningHelpers.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ await LykosAvatarMethods.UserOrMemberAvatarURL(targetUser, Program.homeGuild, "p
3434
.WithColor(color: DiscordColor.DarkGreen);
3535
else
3636
{
37+
TimeSpan timeToCheck = TimeSpan.FromDays(Program.cfgjson.WarningDaysThreshold);
3738
foreach (string key in keys)
3839
{
3940
UserWarning warning = warningsOutput[key];
4041
TimeSpan span = DateTime.Now - warning.WarnTimestamp;
41-
if (span.Days < 31)
42+
if (span <= timeToCheck)
4243
{
4344
recentCount += 1;
4445
}
@@ -77,7 +78,7 @@ await LykosAvatarMethods.UserOrMemberAvatarURL(targetUser, Program.homeGuild, "p
7778

7879
embed.AddField($"Last {Program.cfgjson.RecentWarningsPeriodHours} hours", hourRecentMatches.Count().ToString(), true);
7980

80-
embed.AddField("Last 30 days", recentCount.ToString(), true)
81+
embed.AddField($"Last {Program.cfgjson.WarningDaysThreshold} days", recentCount.ToString(), true)
8182
.AddField("Total", keys.Count().ToString(), true);
8283
}
8384

0 commit comments

Comments
 (0)