Add support for extras, conditionally displaying commands in the help command, and start working on moderation commands

This commit is contained in:
2025-08-22 18:06:52 -03:00
parent 55ae1c8937
commit 8868b18be3
41 changed files with 1075 additions and 368 deletions
+10 -3
View File
@@ -4,6 +4,7 @@ use async_trait::async_trait;
use twilight_model::gateway::payload::incoming::InteractionCreate;
use crate::framework::{
commands::extras::ExtrasGetter,
events::traits::{EventResult, OnInteractionHandler},
runtime::Runtime,
};
@@ -12,11 +13,17 @@ use crate::framework::{
pub struct InteractionRunner;
#[async_trait]
impl<T> OnInteractionHandler<T> for InteractionRunner
impl<T, E> OnInteractionHandler<T, E> for InteractionRunner
where
T: Send + Sync + 'static,
E: Send + Sync + 'static,
{
async fn on_interaction(&self, event: &InteractionCreate, rt: Arc<Runtime<T>>) -> EventResult {
Ok(rt.registry.execute(event, rt.clone()).await?)
async fn on_interaction(
&self,
event: &InteractionCreate,
rt: Arc<Runtime<T, E>>,
extras: Arc<dyn ExtrasGetter<T, Extras = E>>,
) -> EventResult {
Ok(rt.registry.execute(event, rt.clone(), extras).await?)
}
}