Skip to content

Commit

Permalink
perf: only store presences for main guild
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanccn committed Oct 26, 2023
1 parent 03b87fc commit fd55552
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ async fn main() -> Result<()> {
}

FullEvent::PresenceUpdate { new_data, .. } => {
let mut presence_store = presence_api::PRESENCE_STORE.lock().await;
presence_store.insert(
new_data.user.id,
presence_api::ValfiskPresenceData::from_presence(new_data),
);
if new_data.guild_id.and_then(|g| Some(g.to_string()))
== std::env::var("GUILD_ID").ok()
{
let mut presence_store =
presence_api::PRESENCE_STORE.lock().await;
presence_store.insert(
new_data.user.id,
presence_api::ValfiskPresenceData::from_presence(new_data),
);
}
}

&_ => {}
Expand Down

0 comments on commit fd55552

Please sign in to comment.