tulpje_cache/event/
integration.rs1use twilight_model::gateway::payload::incoming::{
2 IntegrationCreate, IntegrationDelete, IntegrationUpdate,
3};
4
5use crate::{Cache, Error, UpdateCache};
6
7impl UpdateCache for IntegrationCreate {
8 async fn update(&self, cache: &Cache) -> Result<(), Error> {
9 if let Some(guild_id) = self.guild_id {
10 cache.cache_integration(guild_id, &self.0).await?;
11 }
12
13 Ok(())
14 }
15}
16
17impl UpdateCache for IntegrationDelete {
18 async fn update(&self, cache: &Cache) -> Result<(), Error> {
19 cache.delete_integration(self.guild_id, self.id).await
20 }
21}
22
23impl UpdateCache for IntegrationUpdate {
24 async fn update(&self, cache: &Cache) -> Result<(), Error> {
25 if let Some(guild_id) = self.guild_id {
26 cache.cache_integration(guild_id, &self.0).await?;
27 }
28
29 Ok(())
30 }
31}