mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
apiDiscordRoutes fix. (6x)
- add debug code
This commit is contained in:
parent
a9c4398be3
commit
67b4209d13
@ -3,6 +3,7 @@ package space.mori.chzzk_bot.webserver.utils
|
|||||||
import applicationHttpClient
|
import applicationHttpClient
|
||||||
import io.ktor.client.call.*
|
import io.ktor.client.call.*
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
|
import io.ktor.client.statement.*
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
@ -87,6 +88,11 @@ object DiscordGuildCache {
|
|||||||
|
|
||||||
DiscordRatelimits.setRateLimit(rateLimit, remaining, resetAfter)
|
DiscordRatelimits.setRateLimit(rateLimit, remaining, resetAfter)
|
||||||
|
|
||||||
|
if (result.status != HttpStatusCode.OK) {
|
||||||
|
logger.error("Failed to fetch data from Discord API. Status: ${result.status} ${result.bodyAsText()}")
|
||||||
|
return emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
val parsed = result.body<List<GuildRole>>()
|
val parsed = result.body<List<GuildRole>>()
|
||||||
|
|
||||||
parsed.forEach { println("${it.name} - ${it.id}") }
|
parsed.forEach { println("${it.name} - ${it.id}") }
|
||||||
@ -110,6 +116,11 @@ object DiscordGuildCache {
|
|||||||
|
|
||||||
DiscordRatelimits.setRateLimit(rateLimit, remaining, resetAfter)
|
DiscordRatelimits.setRateLimit(rateLimit, remaining, resetAfter)
|
||||||
|
|
||||||
|
if (result.status != HttpStatusCode.OK) {
|
||||||
|
logger.error("Failed to fetch data from Discord API. Status: ${result.status} ${result.bodyAsText()}")
|
||||||
|
return emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
val parsed = result.body<List<GuildChannel>>().filter { it.type == ChannelType.GUILD_TEXT }
|
val parsed = result.body<List<GuildChannel>>().filter { it.type == ChannelType.GUILD_TEXT }
|
||||||
|
|
||||||
parsed.forEach { println("${it.name} - ${it.id}") }
|
parsed.forEach { println("${it.name} - ${it.id}") }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user