Skip to content

Commit c5c15a8

Browse files
committed
Assume JDA got connected for any status above CONNECTING_TO_WEBSOCKET
1 parent 75e9a03 commit c5c15a8

File tree

1 file changed

+3
-2
lines changed
  • BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core

1 file changed

+3
-2
lines changed

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/ReadyListener.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ internal class ReadyListener {
2525
@BEventListener(priority = Int.MAX_VALUE, mode = RunMode.BLOCKING)
2626
internal suspend fun onConnectEvent(event: StatusChangeEvent, context: BContext) {
2727
// At this point, JDA should be usable
28-
if (!connected && event.newStatus == JDA.Status.CONNECTING_TO_WEBSOCKET) {
28+
// Use >= because any event beyond this point is a valid JDA instance
29+
if (!connected && event.newStatus >= JDA.Status.CONNECTING_TO_WEBSOCKET) {
2930
lock.withLock {
3031
if (connected) return
3132
connected = true
@@ -50,4 +51,4 @@ internal class ReadyListener {
5051

5152
context.eventDispatcher.dispatchEvent(FirstGuildReadyEvent(context, event))
5253
}
53-
}
54+
}

0 commit comments

Comments
 (0)