Updated readme with the new settings, added another exception filter to the discordbot

This commit is contained in:
TheUbMunster 2023-06-27 18:32:04 -06:00
parent c3e664dce4
commit fc70cb90d8
2 changed files with 27 additions and 3 deletions

View File

@ -82,7 +82,10 @@ Banlist: banned people are unable to join the server, default: false
PersistShines/Moons: Allows the server to remember moon progress across crashes/restarts
### Discord
Note: Token and LogChannel needs to have quotes "" around it
Note: Token, LogChannel and CommandChannel need to have quotes "" around it
Token: the token of the bot you want to load into, default: null
Prefix: the bot prefix to be used, default: $
LogChannel: logs the server console to that channel, default: null
CommandChannel: allows discord commands, default: null
LogChannel/(AdminChannel): allows discord commands & logs the server console to that channel, default: null
LogCommands: log all executed commands to log handlers (discord, console), default: false
FilterOutNonIssueWarnings: filter out the nonsense warnings/errors? default: true

View File

@ -74,7 +74,8 @@ public class DiscordBot
//filter it out to avoid logging it to discord.
if (localSettings.FilterOutNonIssueWarnings)
{
if (a.Message.Contains("Server requested a reconnect"))
//if (a.Message.Contains("Server requested a reconnect"))
if (a.Exception?.ToString().Contains("Server requested a reconnect") ?? false)
{
//This is to filter out this message. This warning is for discord server load balancing and isn't a problem
@ -82,6 +83,26 @@ public class DiscordBot
//Warning[Discord: Gateway] at Discord.ConnectionManager.<> c__DisplayClass29_0.<< StartAsync > b__0 > d.MoveNext()
return;
}
else if (a.Exception?.ToString().Contains("The remote party closed the WebSocket connection without completing the close handshake.") ?? false)
{
//From Discord.NET discord's server, support:
//Discord does this normally and it effects all bots, as long as your bot is reconnecting
//after the error it is expected and should just be ignored.
/*{18:21:02 Gateway System.Exception: WebSocket connection was closed
---> System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
at System.Net.WebSockets.ManagedWebSocket.ThrowIfEOFUnexpected(Boolean throwOnPrematureClosure)
at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken, Boolean throwOnPrematureClosure)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---
at Discord.Net.WebSockets.DefaultWebSocketClient.RunAsync(CancellationToken cancelToken)
--- End of inner exception stack trace ---
at Discord.ConnectionManager.<>c__DisplayClass29_0.<<StartAsync>b__0>d.MoveNext()}*/
return;
}
}
string message = a.Message + (a.Exception != null ? "Exception: " + a.Exception.ToString() : "");
ConsoleColor col;