feat: split ignores into 'ignore messages' and 'ignore entities'

This commit is contained in:
sam 2024-11-18 00:47:27 +01:00
parent d48ab7e16e
commit 0cac964aa6
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
32 changed files with 730 additions and 488 deletions

View file

@ -315,19 +315,20 @@ public class GuildMemberUpdateResponder(
.WithFooter($"User ID: {member.User.ID}")
.WithCurrentTimestamp();
var addedRoles = member.Roles.Except(oldRoles).Select(s => s.Value).ToList();
var removedRoles = oldRoles.Except(member.Roles).Select(s => s.Value).ToList();
var addedRoles = member.Roles.Except(oldRoles).ToList();
var removedRoles = oldRoles.Except(member.Roles).ToList();
if (addedRoles.Count != 0)
{
roleUpdate.AddField("Added", string.Join(", ", addedRoles.Select(id => $"<@&{id}>")));
// Add all added key roles to the log
if (!addedRoles.Except(guildConfig.KeyRoles).Any())
if (!addedRoles.Select(s => s.Value).Except(guildConfig.KeyRoles).Any())
{
var value = string.Join(
"\n",
addedRoles
.Select(s => s.Value)
.Where(guildConfig.KeyRoles.Contains)
.Select(id =>
{
@ -348,11 +349,12 @@ public class GuildMemberUpdateResponder(
);
// Add all removed key roles to the log
if (!removedRoles.Except(guildConfig.KeyRoles).Any())
if (!removedRoles.Select(s => s.Value).Except(guildConfig.KeyRoles).Any())
{
var value = string.Join(
"\n",
removedRoles
.Select(s => s.Value)
.Where(guildConfig.KeyRoles.Contains)
.Select(id =>
{
@ -369,8 +371,12 @@ public class GuildMemberUpdateResponder(
if (roleUpdate.Fields.Count != 0)
{
webhookExecutor.QueueLog(
guildConfig,
LogChannelType.GuildMemberUpdate,
webhookExecutor.GetLogChannel(
guildConfig,
LogChannelType.GuildMemberUpdate,
// Check for all added and removed roles
roleIds: addedRoles.Concat(removedRoles).ToList()
),
roleUpdate.Build().GetOrThrow()
);
}