Move gateway intents warning to ready event (#2042)

This commit is contained in:
Quin Lynch
2022-01-14 07:52:08 -04:00
committed by GitHub
parent 291d1e4d3c
commit 3633929e5f

View File

@@ -261,9 +261,6 @@ namespace Discord.WebSocket
_defaultStickers = builder.ToImmutable();
}
if(LogGatewayIntentWarnings)
await LogGatewayIntentsWarning().ConfigureAwait(false);
}
/// <inheritdoc />
@@ -314,6 +311,10 @@ namespace Discord.WebSocket
//Wait for READY
await _connection.WaitAsync().ConfigureAwait(false);
// Log warnings on ready event
if (LogGatewayIntentWarnings)
await LogGatewayIntentsWarning().ConfigureAwait(false);
}
private async Task OnDisconnectingAsync(Exception ex)
{
@@ -743,7 +744,7 @@ namespace Discord.WebSocket
if(!_gatewayIntents.HasFlag(GatewayIntents.GuildPresences) && _presenceUpdated.HasSubscribers)
{
await _gatewayLogger.WarningAsync("You're using the PresenceUpdate event without specifying the GuildPresences intent, consider adding the intent to your config.").ConfigureAwait(false);
await _gatewayLogger.WarningAsync("You're using the PresenceUpdate event without specifying the GuildPresences intent. Discord wont send this event to your client without the intent set in your config.").ConfigureAwait(false);
}
bool hasGuildScheduledEventsSubscribers =
@@ -762,7 +763,7 @@ namespace Discord.WebSocket
if(!_gatewayIntents.HasFlag(GatewayIntents.GuildScheduledEvents) && hasGuildScheduledEventsSubscribers)
{
await _gatewayLogger.WarningAsync("You're using events related to the GuildScheduledEvents gateway intent without specifying the intent, consider adding the intent to your config.").ConfigureAwait(false);
await _gatewayLogger.WarningAsync("You're using events related to the GuildScheduledEvents gateway intent without specifying the intent. Discord wont send this event to your client without the intent set in your config.").ConfigureAwait(false);
}
bool hasInviteEventSubscribers =
@@ -776,7 +777,7 @@ namespace Discord.WebSocket
if (!_gatewayIntents.HasFlag(GatewayIntents.GuildInvites) && hasInviteEventSubscribers)
{
await _gatewayLogger.WarningAsync("You're using events related to the GuildInvites gateway intent without specifying the intent, consider adding the intent to your config.").ConfigureAwait(false);
await _gatewayLogger.WarningAsync("You're using events related to the GuildInvites gateway intent without specifying the intent. Discord wont send this event to your client without the intent set in your config.").ConfigureAwait(false);
}
}