Skip to content

Commit

Permalink
Discord: Fix after disconnected 3 times, stopped trying to reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed May 23, 2021
1 parent bd4a499 commit 7021203
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions MCGalaxy/Modules/Relay/Discord/DiscordBot.cs
Expand Up @@ -172,6 +172,7 @@ public sealed class DiscordBot : RelayBot {

api.RunAsync();
RegisterEvents();
OnReady();
}

void PrintAttachments(JsonObject data, string channel) {
Expand Down
5 changes: 1 addition & 4 deletions MCGalaxy/Modules/Relay/IRC/IRCBot.cs
Expand Up @@ -267,10 +267,7 @@ public sealed class IRCBot : RelayBot {
}

void OnRegistered() {
Logger.Log(LogType.RelayActivity, "Connected to IRC!");
resetting = false;
retries = 0;

OnReady();
Authenticate();
JoinChannels();
}
Expand Down
6 changes: 6 additions & 0 deletions MCGalaxy/Modules/Relay/RelayBot.cs
Expand Up @@ -126,6 +126,12 @@ public abstract class RelayBot {
if (Enabled) Connect();
}

protected void OnReady() {
Logger.Log(LogType.RelayActivity, "Connected to {0}!", RelayName);
resetting = false;
retries = 0;
}

protected void AutoReconnect() {
if (resetting || retries >= 3) return;

Expand Down

0 comments on commit 7021203

Please sign in to comment.