1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-19 16:33:36 +03:00

turn isMuted into wasMuted

now including MuteCommandGroup.cs

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2023-12-21 16:31:28 +03:00
parent fdb4d703ee
commit a3f946bdaa
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1
2 changed files with 7 additions and 7 deletions

View file

@ -300,9 +300,9 @@ public class MuteCommandGroup : CommandGroup
} }
var memberData = data.GetOrCreateMemberData(target.ID); var memberData = data.GetOrCreateMemberData(target.ID);
var isMuted = memberData.MutedUntil is not null || communicationDisabledUntil is not null; var wasMuted = memberData.MutedUntil is not null || communicationDisabledUntil is not null;
if (!isMuted) if (!wasMuted)
{ {
var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.UserNotMuted, bot) var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.UserNotMuted, bot)
.WithColour(ColorsList.Red).Build(); .WithColour(ColorsList.Red).Build();

View file

@ -122,17 +122,17 @@ public class ToolsCommandGroup : CommandGroup
embedColor = AppendGuildInformation(embedColor, guildMember, builder); embedColor = AppendGuildInformation(embedColor, guildMember, builder);
} }
var isMuted = (memberData.MutedUntil is not null && DateTimeOffset.UtcNow <= memberData.MutedUntil) || var wasMuted = (memberData.MutedUntil is not null && DateTimeOffset.UtcNow <= memberData.MutedUntil) ||
communicationDisabledUntil is not null; communicationDisabledUntil is not null;
var wasBanned = memberData.BannedUntil is not null; var wasBanned = memberData.BannedUntil is not null;
var wasKicked = memberData.Kicked; var wasKicked = memberData.Kicked;
if (isMuted || wasBanned || wasKicked) if (wasMuted || wasBanned || wasKicked)
{ {
builder.Append("### ") builder.Append("### ")
.AppendLine(Markdown.Bold(Messages.UserInfoPunishments)); .AppendLine(Markdown.Bold(Messages.UserInfoPunishments));
embedColor = AppendPunishmentsInformation(isMuted, wasKicked, wasBanned, memberData, embedColor = AppendPunishmentsInformation(wasMuted, wasKicked, wasBanned, memberData,
builder, embedColor, communicationDisabledUntil); builder, embedColor, communicationDisabledUntil);
} }
@ -155,10 +155,10 @@ public class ToolsCommandGroup : CommandGroup
return await _feedback.SendContextualEmbedResultAsync(embed, ct: ct); return await _feedback.SendContextualEmbedResultAsync(embed, ct: ct);
} }
private static Color AppendPunishmentsInformation(bool isMuted, bool wasKicked, bool wasBanned, private static Color AppendPunishmentsInformation(bool wasMuted, bool wasKicked, bool wasBanned,
MemberData memberData, StringBuilder builder, Color embedColor, DateTimeOffset? communicationDisabledUntil) MemberData memberData, StringBuilder builder, Color embedColor, DateTimeOffset? communicationDisabledUntil)
{ {
if (isMuted) if (wasMuted)
{ {
AppendMuteInformation(memberData, communicationDisabledUntil, builder); AppendMuteInformation(memberData, communicationDisabledUntil, builder);
embedColor = ColorsList.Red; embedColor = ColorsList.Red;