tulpje_framework/context/
event_context.rs1use std::sync::Arc;
2
3use twilight_gateway::Event;
4use twilight_http::Client;
5use twilight_model::id::{Id, marker::ApplicationMarker};
6use twilight_standby::Standby;
7
8use crate::{Context, Metadata};
9
10#[derive(Clone, Debug)]
11pub struct EventContext<T: Clone + Send + Sync> {
12 pub meta: Metadata,
13 pub application_id: Id<ApplicationMarker>,
14 pub services: Arc<T>,
15 pub client: Arc<Client>,
16 pub standby: Arc<Standby>,
17
18 pub event: Event,
19}
20
21impl<T: Clone + Send + Sync> EventContext<T> {
22 pub fn from_context(ctx: Context<T>, meta: Metadata, event: Event) -> Self {
23 Self {
24 application_id: ctx.application_id,
25 client: ctx.client,
26 services: ctx.services,
27 standby: ctx.standby,
28
29 meta,
30 event,
31 }
32 }
33}