Skip to content

Commit

Permalink
chore(core): create Entitlements after caching
Browse files Browse the repository at this point in the history
Just in case caching fails.
  • Loading branch information
lukellmann committed Sep 11, 2024
1 parent b108060 commit 6d74f96
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,17 @@ internal class EntitlementEventHandler : BaseGatewayEventHandler() {
else -> null
}

private suspend fun handleDeletedEntitlement(entity: DiscordEntitlement, kord: Kord): Entitlement {
val entitlement = Entitlement(EntitlementData.from(entity), kord)
private suspend fun handleDeletedEntitlement(entitlement: DiscordEntitlement, kord: Kord): Entitlement {
kord.cache.remove {
idEq(EntitlementData::id, entitlement.id)
idEq(EntitlementData::applicationId, entitlement.applicationId)
}
return entitlement
return Entitlement(EntitlementData.from(entitlement), kord)
}

private suspend fun handleEntitlement(entity: DiscordEntitlement, kord: Kord): Entitlement {
val entitlement = Entitlement(EntitlementData.from(entity), kord)
kord.cache.put(entitlement.data)
return entitlement
private suspend fun handleEntitlement(entitlement: DiscordEntitlement, kord: Kord): Entitlement {
val data = EntitlementData.from(entitlement)
kord.cache.put(data)
return Entitlement(data, kord)
}
}

0 comments on commit 6d74f96

Please sign in to comment.