Skip to content

Commit

Permalink
Fix bug when it doesn't reconnect after a network loss
Browse files Browse the repository at this point in the history
  • Loading branch information
carlodrift committed Dec 5, 2024
1 parent 32301ee commit 4166f71
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.clementraynaud.skoice.listeners;

import net.clementraynaud.skoice.Skoice;
import net.dv8tion.jda.api.events.StatusChangeEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;

public class StatusChangeListener extends ListenerAdapter {

private final Skoice plugin;

public StatusChangeListener(Skoice plugin) {
this.plugin = plugin;
}

@Override
public void onStatusChange(StatusChangeEvent event) {
this.plugin.getBot().updateStatus();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.clementraynaud.skoice.Skoice;
import net.clementraynaud.skoice.bot.BotStatus;
import net.clementraynaud.skoice.commands.CommandInfo;
import net.clementraynaud.skoice.listeners.StatusChangeListener;
import net.clementraynaud.skoice.listeners.channel.network.GenericChannelListener;
import net.clementraynaud.skoice.listeners.guild.GuildJoinListener;
import net.clementraynaud.skoice.listeners.guild.GuildLeaveListener;
Expand Down Expand Up @@ -126,7 +127,8 @@ public void registerPermanentBotListeners() {
new SlashCommandInteractionListener(this.plugin),
new ButtonInteractionListener(this.plugin),
new StringSelectInteractionListener(this.plugin),
new ModalInteractionListener(this.plugin)
new ModalInteractionListener(this.plugin),
new StatusChangeListener(this.plugin)
);
}

Expand Down

0 comments on commit 4166f71

Please sign in to comment.