Add InteractionRunner to on_interaction_handlers

This commit is contained in:
2025-08-12 23:15:52 -03:00
parent 0cdbe63c55
commit 09b875da97
2 changed files with 11 additions and 15 deletions
+8 -12
View File
@@ -3,24 +3,20 @@ 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,
use crate::framework::{
events::traits::{EventResult, OnInteractionHandler},
runtime::Runtime,
};
#[derive(Debug)]
pub struct InteractionRunner;
#[async_trait]
impl OnInteractionHandler<State> for InteractionRunner {
async fn on_interaction(
&self,
event: &InteractionCreate,
rt: Arc<Runtime<State>>,
) -> EventResult {
impl<T> OnInteractionHandler<T> for InteractionRunner
where
T: Send + Sync + 'static,
{
async fn on_interaction(&self, event: &InteractionCreate, rt: Arc<Runtime<T>>) -> EventResult {
Ok(rt.registry.execute(event, rt.clone()).await?)
}
}