mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-08 05:11:12 +00:00
asdf14
This commit is contained in:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user