Prevent banned users from using call commands

This commit is contained in:
2025-08-14 23:56:55 -03:00
parent fb7eba11bb
commit 7eb2a99b69
3 changed files with 24 additions and 8 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ use std::fmt::Debug;
use async_trait::async_trait;
use thiserror::Error;
use crate::framework::commands::{arguments::Argument, context::CommandContext};
use crate::framework::commands::{arguments::Argument, context::CommandContext, permissions::Permission};
pub mod arguments;
pub mod context;
@@ -38,8 +38,8 @@ pub trait Command<T>: Send + Sync + Debug {
fn arguments(&self) -> &'static [Argument] {
&[]
}
fn permissions(&self) -> &'static [Box<dyn permissions::Permission<T> + Send + Sync>] {
&[]
fn permissions(&self) -> Vec<Box<dyn Permission<T> + Send + Sync + 'static>> {
vec![]
}
/// Returns the command name + all its aliases.
+1 -3
View File
@@ -39,9 +39,7 @@ impl<T: Send + Sync + 'static> OnMessageHandler<T> for CommandRunner {
.await
.inspect_err(|e| log::error!("Permission check failed: {e}"))?
{
return Err(
format!("The check for permission {permission:?} failed").into()
);
return Ok(());
}
}