mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
asdf9
This commit is contained in:
parent
370e4519c2
commit
1e1cd50e52
@ -6,6 +6,7 @@ import io.ktor.client.request.*
|
|||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
import space.mori.chzzk_bot.common.utils.logger
|
||||||
import space.mori.chzzk_bot.webserver.DiscordGuildListAPI
|
import space.mori.chzzk_bot.webserver.DiscordGuildListAPI
|
||||||
import space.mori.chzzk_bot.webserver.dotenv
|
import space.mori.chzzk_bot.webserver.dotenv
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -54,6 +55,7 @@ object DiscordGuildCache {
|
|||||||
if(DiscordRatelimits.isLimited()) {
|
if(DiscordRatelimits.isLimited()) {
|
||||||
delay(DiscordRatelimits.getRateReset().takeIf { it > 1000L } ?: 3000L)
|
delay(DiscordRatelimits.getRateReset().takeIf { it > 1000L } ?: 3000L)
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
val guilds = fetchGuilds(lastGuildId)
|
val guilds = fetchGuilds(lastGuildId)
|
||||||
if (guilds.isEmpty()) {
|
if (guilds.isEmpty()) {
|
||||||
break
|
break
|
||||||
@ -65,6 +67,10 @@ object DiscordGuildCache {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
lastGuildId = guilds.last().id
|
lastGuildId = guilds.last().id
|
||||||
|
} catch(e: Exception) {
|
||||||
|
logger.info("Exception in discord caches. ${e.stackTraceToString()}")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user