mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
asdf14
This commit is contained in:
parent
f13412d77a
commit
ac2cd3725c
@ -33,7 +33,7 @@ fun Route.apiDiscordRoutes() {
|
||||
return@get
|
||||
}
|
||||
|
||||
call.respond(HttpStatusCode.OK)
|
||||
call.respond(HttpStatusCode.OK, DiscordGuildCache.getCachedGuilds(user.discord.toString())!!)
|
||||
return@get
|
||||
}
|
||||
get {
|
||||
|
@ -16,7 +16,7 @@ object DiscordGuildCache {
|
||||
private val cache = ConcurrentHashMap<String, CachedGuilds>()
|
||||
private const val EXP_SECONDS = 600L
|
||||
|
||||
private suspend fun getCachedGuilds(guildId: String): Guild? {
|
||||
suspend fun getCachedGuilds(guildId: String): Guild? {
|
||||
val now = Instant.now()
|
||||
|
||||
if(cache.isEmpty() || !cache.containsKey(guildId) || cache[guildId]!!.timestamp.plusSeconds(EXP_SECONDS).isAfter(now)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user