27 lines
586 B
Rust
27 lines
586 B
Rust
use std::sync::Arc;
|
|
|
|
use async_trait::async_trait;
|
|
use twilight_model::gateway::payload::incoming::InteractionCreate;
|
|
|
|
use crate::{
|
|
framework::{
|
|
events::traits::{EventResult, OnInteractionHandler},
|
|
runtime::Runtime,
|
|
},
|
|
state::State,
|
|
};
|
|
|
|
#[derive(Debug)]
|
|
pub struct InteractionRunner;
|
|
|
|
#[async_trait]
|
|
impl OnInteractionHandler<State> for InteractionRunner {
|
|
async fn on_interaction(
|
|
&self,
|
|
event: &InteractionCreate,
|
|
rt: Arc<Runtime<State>>,
|
|
) -> EventResult {
|
|
Ok(rt.registry.execute(event, rt.clone()).await?)
|
|
}
|
|
}
|