From 58e9273fed8e48e7bfa3187e574d267692c3af54 Mon Sep 17 00:00:00 2001 From: Lunar Starstrum Date: Sun, 3 Nov 2024 12:39:26 -0600 Subject: [PATCH] Update deps --- libs/DSharpPlus | 2 +- src/Commands/Moderation/CopyCommand.cs | 10 ++-------- src/Events/Handlers/GuildMemberUpdatedEventHandler.cs | 4 ++-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/libs/DSharpPlus b/libs/DSharpPlus index 36093a1..e33ee7a 160000 --- a/libs/DSharpPlus +++ b/libs/DSharpPlus @@ -1 +1 @@ -Subproject commit 36093a168a1e08d17a0033d29d859e08209d9370 +Subproject commit e33ee7a8720431a2469612800595f4892731284f diff --git a/src/Commands/Moderation/CopyCommand.cs b/src/Commands/Moderation/CopyCommand.cs index 40e32fa..989d8c9 100644 --- a/src/Commands/Moderation/CopyCommand.cs +++ b/src/Commands/Moderation/CopyCommand.cs @@ -135,12 +135,7 @@ await webhook.ExecuteAsync(new DiscordWebhookBuilder() private async Task IdleAsync(CommandContext context, DiscordChannel channel, CancellationToken cancellationToken = default) { // Lock the channel to prevent other messages from being sent - List overwrites = []; - foreach (DiscordOverwrite overwrite in channel.PermissionOverwrites) - { - overwrites.Add(await DiscordOverwriteBuilder.FromAsync(overwrite)); - } - + List overwrites = [.. channel.PermissionOverwrites.Select(DiscordOverwriteBuilder.From)]; List newOverwrites = []; foreach (DiscordOverwriteBuilder overwrite in overwrites) { @@ -156,9 +151,8 @@ private async Task IdleAsync(CommandContext context, DiscordChannel channel, Can } // Add an overwrite that'll allow the bot to send messages - newOverwrites.Add(new DiscordOverwriteBuilder() + newOverwrites.Add(new DiscordOverwriteBuilder(channel.Guild.CurrentMember) { - Target = channel.Guild.CurrentMember, Allowed = channel.IsThread ? DiscordPermissions.SendMessagesInThreads : DiscordPermissions.SendMessages }); diff --git a/src/Events/Handlers/GuildMemberUpdatedEventHandler.cs b/src/Events/Handlers/GuildMemberUpdatedEventHandler.cs index 42392ea..5914c26 100644 --- a/src/Events/Handlers/GuildMemberUpdatedEventHandler.cs +++ b/src/Events/Handlers/GuildMemberUpdatedEventHandler.cs @@ -54,12 +54,12 @@ private static async ValueTask LogMemberUpdateAsync(GuildMemberUpdatedEventArgs args["{user_before_display_name}"] = eventArgs.MemberBefore.GetDisplayName(); args["{user_before_global_name}"] = eventArgs.MemberBefore.GlobalName!; args["{user_before_name}"] = eventArgs.MemberBefore.Username + (eventArgs.MemberBefore.Discriminator == "0" ? "" : $"#{eventArgs.MemberBefore.Discriminator}"); - args["{user_before_guild_avatar_url}"] = eventArgs.MemberBefore.GuildAvatarUrl; + args["{user_before_guild_avatar_url}"] = eventArgs.MemberBefore.DisplayAvatarUrl; args["{user_before_avatar_url}"] = eventArgs.MemberBefore.AvatarUrl; args["{user_before_role_count}"] = eventArgs.MemberBefore.Roles.Count().ToString("N0", CultureInfo.InvariantCulture); args["{user_before_role_list}"] = string.Join(", ", eventArgs.MemberBefore.Roles.Select(x => x.Mention)); - args["{user_guild_avatar_url}"] = eventArgs.MemberAfter.GuildAvatarUrl; + args["{user_guild_avatar_url}"] = eventArgs.MemberAfter.DisplayAvatarUrl; args["{user_avatar_url}"] = eventArgs.MemberAfter.AvatarUrl; args["{user_role_count}"] = eventArgs.MemberAfter.Roles.Count().ToString("N0", CultureInfo.InvariantCulture); args["{user_role_list}"] = string.Join(", ", eventArgs.MemberAfter.Roles.Select(x => x.Mention));