diff --git a/locale/Messages.resx b/locale/Messages.resx
index 60e6e07..1387edf 100644
--- a/locale/Messages.resx
+++ b/locale/Messages.resx
@@ -585,4 +585,7 @@
Report an issue
+
+ Kicked
+
diff --git a/locale/Messages.ru.resx b/locale/Messages.ru.resx
index 4b9492c..572c0b2 100644
--- a/locale/Messages.ru.resx
+++ b/locale/Messages.ru.resx
@@ -585,4 +585,7 @@
Сообщить о проблеме
+
+ Выгнан
+
diff --git a/locale/Messages.tt-ru.resx b/locale/Messages.tt-ru.resx
index de1f39f..d20c358 100644
--- a/locale/Messages.tt-ru.resx
+++ b/locale/Messages.tt-ru.resx
@@ -502,7 +502,7 @@
приколы полученные по заслугам
- забанен
+ пермабан
вышел из сервера
@@ -585,4 +585,7 @@
зарепортить баг
+
+ кикнут
+
diff --git a/src/Commands/KickCommandGroup.cs b/src/Commands/KickCommandGroup.cs
index ee94b93..a278fb4 100644
--- a/src/Commands/KickCommandGroup.cs
+++ b/src/Commands/KickCommandGroup.cs
@@ -151,7 +151,9 @@ public class KickCommandGroup : CommandGroup
return Result.FromError(kickResult.Error);
}
- data.GetOrCreateMemberData(target.ID).Roles.Clear();
+ var memberData = data.GetOrCreateMemberData(target.ID);
+ memberData.Roles.Clear();
+ memberData.Kicked = true;
var title = string.Format(Messages.UserKicked, target.GetTag());
var description = MarkdownExtensions.BulletPoint(string.Format(Messages.DescriptionActionReason, reason));
diff --git a/src/Commands/MuteCommandGroup.cs b/src/Commands/MuteCommandGroup.cs
index 522c7f7..c7b21f6 100644
--- a/src/Commands/MuteCommandGroup.cs
+++ b/src/Commands/MuteCommandGroup.cs
@@ -300,9 +300,9 @@ public class MuteCommandGroup : CommandGroup
}
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)
.WithColour(ColorsList.Red).Build();
diff --git a/src/Commands/ToolsCommandGroup.cs b/src/Commands/ToolsCommandGroup.cs
index f04ddf6..1dbf72d 100644
--- a/src/Commands/ToolsCommandGroup.cs
+++ b/src/Commands/ToolsCommandGroup.cs
@@ -122,32 +122,21 @@ public class ToolsCommandGroup : CommandGroup
embedColor = AppendGuildInformation(embedColor, guildMember, builder);
}
- var isMuted = (memberData.MutedUntil is not null && DateTimeOffset.UtcNow <= memberData.MutedUntil) ||
- communicationDisabledUntil is not null;
+ var wasMuted = (memberData.MutedUntil is not null && DateTimeOffset.UtcNow <= memberData.MutedUntil) ||
+ communicationDisabledUntil is not null;
+ var wasBanned = memberData.BannedUntil is not null;
+ var wasKicked = memberData.Kicked;
- var existingBanResult = await _guildApi.GetGuildBanAsync(guildId, target.ID, ct);
-
- if (isMuted || existingBanResult.IsDefined())
+ if (wasMuted || wasBanned || wasKicked)
{
builder.Append("### ")
.AppendLine(Markdown.Bold(Messages.UserInfoPunishments));
+
+ embedColor = AppendPunishmentsInformation(wasMuted, wasKicked, wasBanned, memberData,
+ builder, embedColor, communicationDisabledUntil);
}
- if (isMuted)
- {
- AppendMuteInformation(memberData, communicationDisabledUntil, builder);
-
- embedColor = ColorsList.Red;
- }
-
- if (existingBanResult.IsDefined())
- {
- AppendBanInformation(memberData, builder);
-
- embedColor = ColorsList.Black;
- }
-
- if (!guildMemberResult.IsSuccess && !existingBanResult.IsDefined())
+ if (!guildMemberResult.IsSuccess && !wasBanned)
{
builder.Append("### ")
.AppendLine(Markdown.Bold(Messages.UserInfoNotOnGuild));
@@ -166,6 +155,29 @@ public class ToolsCommandGroup : CommandGroup
return await _feedback.SendContextualEmbedResultAsync(embed, ct: ct);
}
+ private static Color AppendPunishmentsInformation(bool wasMuted, bool wasKicked, bool wasBanned,
+ MemberData memberData, StringBuilder builder, Color embedColor, DateTimeOffset? communicationDisabledUntil)
+ {
+ if (wasMuted)
+ {
+ AppendMuteInformation(memberData, communicationDisabledUntil, builder);
+ embedColor = ColorsList.Red;
+ }
+
+ if (wasKicked)
+ {
+ builder.AppendBulletPointLine(Messages.UserInfoKicked);
+ }
+
+ if (wasBanned)
+ {
+ AppendBanInformation(memberData, builder);
+ embedColor = ColorsList.Black;
+ }
+
+ return embedColor;
+ }
+
private static Color AppendGuildInformation(Color color, IGuildMember guildMember, StringBuilder builder)
{
if (guildMember.Nickname.IsDefined(out var nickname))
diff --git a/src/Data/MemberData.cs b/src/Data/MemberData.cs
index 0b0cfb2..8e23e54 100644
--- a/src/Data/MemberData.cs
+++ b/src/Data/MemberData.cs
@@ -18,6 +18,7 @@ public sealed class MemberData
public ulong Id { get; }
public DateTimeOffset? BannedUntil { get; set; }
public DateTimeOffset? MutedUntil { get; set; }
+ public bool Kicked { get; set; }
public List Roles { get; set; } = [];
public List Reminders { get; } = [];
}
diff --git a/src/Messages.Designer.cs b/src/Messages.Designer.cs
index 767bd5b..8dad3dc 100644
--- a/src/Messages.Designer.cs
+++ b/src/Messages.Designer.cs
@@ -1036,5 +1036,13 @@ namespace Octobot {
return ResourceManager.GetString("ButtonReportIssue", resourceCulture);
}
}
+
+ internal static string UserInfoKicked
+ {
+ get
+ {
+ return ResourceManager.GetString("UserInfoKicked", resourceCulture);
+ }
+ }
}
}
diff --git a/src/Responders/GuildMemberJoinedResponder.cs b/src/Responders/GuildMemberJoinedResponder.cs
index 66faa28..eee93b6 100644
--- a/src/Responders/GuildMemberJoinedResponder.cs
+++ b/src/Responders/GuildMemberJoinedResponder.cs
@@ -43,6 +43,8 @@ public class GuildMemberJoinedResponder : IResponder
var cfg = data.Settings;
var memberData = data.GetOrCreateMemberData(user.ID);
+ memberData.Kicked = false;
+
var returnRolesResult = await TryReturnRolesAsync(cfg, memberData, gatewayEvent.GuildID, user.ID, ct);
if (!returnRolesResult.IsSuccess)
{