Add configuration toggle to suppress Unknown dispatch warnings (#2162)
This commit is contained in:
@@ -78,6 +78,7 @@ namespace Discord.WebSocket
|
|||||||
internal bool AlwaysDownloadDefaultStickers { get; private set; }
|
internal bool AlwaysDownloadDefaultStickers { get; private set; }
|
||||||
internal bool AlwaysResolveStickers { get; private set; }
|
internal bool AlwaysResolveStickers { get; private set; }
|
||||||
internal bool LogGatewayIntentWarnings { get; private set; }
|
internal bool LogGatewayIntentWarnings { get; private set; }
|
||||||
|
internal bool SuppressUnknownDispatchWarnings { get; private set; }
|
||||||
internal new DiscordSocketApiClient ApiClient => base.ApiClient;
|
internal new DiscordSocketApiClient ApiClient => base.ApiClient;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override IReadOnlyCollection<SocketGuild> Guilds => State.Guilds;
|
public override IReadOnlyCollection<SocketGuild> Guilds => State.Guilds;
|
||||||
@@ -150,6 +151,7 @@ namespace Discord.WebSocket
|
|||||||
AlwaysDownloadDefaultStickers = config.AlwaysDownloadDefaultStickers;
|
AlwaysDownloadDefaultStickers = config.AlwaysDownloadDefaultStickers;
|
||||||
AlwaysResolveStickers = config.AlwaysResolveStickers;
|
AlwaysResolveStickers = config.AlwaysResolveStickers;
|
||||||
LogGatewayIntentWarnings = config.LogGatewayIntentWarnings;
|
LogGatewayIntentWarnings = config.LogGatewayIntentWarnings;
|
||||||
|
SuppressUnknownDispatchWarnings = config.SuppressUnknownDispatchWarnings;
|
||||||
HandlerTimeout = config.HandlerTimeout;
|
HandlerTimeout = config.HandlerTimeout;
|
||||||
State = new ClientState(0, 0);
|
State = new ClientState(0, 0);
|
||||||
Rest = new DiscordSocketRestClient(config, ApiClient);
|
Rest = new DiscordSocketRestClient(config, ApiClient);
|
||||||
@@ -2771,7 +2773,7 @@ namespace Discord.WebSocket
|
|||||||
|
|
||||||
#region Others
|
#region Others
|
||||||
default:
|
default:
|
||||||
await _gatewayLogger.WarningAsync($"Unknown Dispatch ({type})").ConfigureAwait(false);
|
if(!SuppressUnknownDispatchWarnings) await _gatewayLogger.WarningAsync($"Unknown Dispatch ({type})").ConfigureAwait(false);
|
||||||
break;
|
break;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,6 +188,11 @@ namespace Discord.WebSocket
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool LogGatewayIntentWarnings { get; set; } = true;
|
public bool LogGatewayIntentWarnings { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether or not Unknown Dispatch event messages should be logged.
|
||||||
|
/// </summary>
|
||||||
|
public bool SuppressUnknownDispatchWarnings { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DiscordSocketConfig"/> class with the default configuration.
|
/// Initializes a new instance of the <see cref="DiscordSocketConfig"/> class with the default configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user