From 09eb9facbafa9d10d16a52768befd3f3295ceaa4 Mon Sep 17 00:00:00 2001 From: Quin Lynch <49576606+quinchs@users.noreply.github.com> Date: Sun, 30 Jan 2022 03:09:41 -0400 Subject: [PATCH] Fix thread member download on create (#2072) --- src/Discord.Net.WebSocket/DiscordSocketClient.cs | 3 +++ .../Entities/Channels/SocketTextChannel.cs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs index 8cef898214..5225e9379a 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs @@ -2913,6 +2913,9 @@ internal void EnsureGatewayIntent(GatewayIntents intents) } } + internal bool HasGatewayIntent(GatewayIntents intents) + => _gatewayIntents.HasFlag(intents); + private async Task GuildAvailableAsync(SocketGuild guild) { if (!guild.IsConnected) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs index 55085899d3..dbf2386252 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs @@ -119,7 +119,8 @@ public virtual async Task CreateThreadAsync(string name, Th var thread = (SocketThreadChannel)Guild.AddOrUpdateChannel(Discord.State, model); - await thread.DownloadUsersAsync(); + if(Discord.AlwaysDownloadUsers && Discord.HasGatewayIntent(GatewayIntents.GuildMembers)) + await thread.DownloadUsersAsync(); return thread; }