Skip to content

Commit cbab2d1

Browse files
committed
Handle ErrorResponseException in bot connection logic
1 parent a0a1262 commit cbab2d1

File tree

1 file changed

+2
-1
lines changed
  • src/main/java/net/clementraynaud/skoice/bot

1 file changed

+2
-1
lines changed

src/main/java/net/clementraynaud/skoice/bot/Bot.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import net.dv8tion.jda.api.entities.Icon;
4343
import net.dv8tion.jda.api.entities.Member;
4444
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
45+
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
4546
import net.dv8tion.jda.api.exceptions.InvalidTokenException;
4647
import net.dv8tion.jda.api.interactions.Interaction;
4748
import net.kyori.adventure.text.event.HoverEvent;
@@ -115,7 +116,7 @@ public void connect(CommandSender sender) {
115116
this.jda = JDABuilder.createDefault(new String(finalBase64TokenBytes))
116117
.addEventListeners(new ReadyListener(this.plugin))
117118
.build();
118-
} catch (InvalidTokenException | IllegalArgumentException e) {
119+
} catch (InvalidTokenException | IllegalArgumentException | ErrorResponseException e) {
119120
this.plugin.getLogger().warning(this.plugin.getLang().getMessage("logger.error.bot-could-not-connect"));
120121
this.plugin.getConfigYamlFile().remove(ConfigField.TOKEN.toString());
121122
if (tokenManager != null) {

0 commit comments

Comments
 (0)