Skip to content

Commit

Permalink
Remove deleted channels
Browse files Browse the repository at this point in the history
Don't cache them again
  • Loading branch information
BartArys committed Oct 11, 2020
1 parent f65f085 commit 6be7a8f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.gitlab.kordlib.core.gateway.handler
import com.gitlab.kordlib.cache.api.DataCache
import com.gitlab.kordlib.cache.api.put
import com.gitlab.kordlib.cache.api.query
import com.gitlab.kordlib.cache.api.remove
import com.gitlab.kordlib.common.entity.Snowflake
import com.gitlab.kordlib.core.Kord
import com.gitlab.kordlib.core.cache.data.ChannelData
Expand Down Expand Up @@ -67,8 +68,8 @@ internal class ChannelEventHandler(
}

private suspend fun handle(event: ChannelDelete, shard: Int) {
cache.remove<ChannelData> { ChannelData::id eq event.channel.id.toLong() }
val data = ChannelData.from(event.channel)
cache.put(data)

val event = when (val channel = Channel.from(data, kord)) {
is NewsChannel -> NewsChannelDeleteEvent(channel, shard)
Expand Down

0 comments on commit 6be7a8f

Please sign in to comment.