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
+20 -2
View File
@@ -5,8 +5,10 @@ use twilight_model::id::Id;
use crate::{
database::models::{Call, Channel},
discord::sanitizing::SanitizeDiscordMarkdown,
framework::commands::{Command, CommandError, context::CommandContext},
groups::calls::get_display_profile,
framework::commands::{
Command, CommandError, context::CommandContext, permissions::Permission,
},
groups::calls::{get_display_profile, permissions::NotBannedPermission},
state::State,
utils::Bye,
};
@@ -38,6 +40,10 @@ impl Command<State> for CallCommand {
&["c"]
}
fn permissions(&self) -> Vec<Box<dyn Permission<State> + Send + Sync + 'static>> {
vec![Box::new(NotBannedPermission)]
}
async fn execute(
&self,
ctx: CommandContext<'_, State>,
@@ -124,6 +130,10 @@ impl Command<State> for SkipCommand {
&["s", "next"]
}
fn permissions(&self) -> Vec<Box<dyn Permission<State> + Send + Sync + 'static>> {
vec![Box::new(NotBannedPermission)]
}
async fn execute(
&self,
ctx: CommandContext<'_, State>,
@@ -226,6 +236,10 @@ impl Command<State> for HangupCommand {
&["h", "hang"]
}
fn permissions(&self) -> Vec<Box<dyn Permission<State> + Send + Sync + 'static>> {
vec![Box::new(NotBannedPermission)]
}
async fn execute(
&self,
ctx: CommandContext<'_, State>,
@@ -324,6 +338,10 @@ impl Command<State> for FriendRequestCommand {
"Shows your username to the other party and asks them to send you a friend request on Discord."
}
fn permissions(&self) -> Vec<Box<dyn Permission<State> + Send + Sync + 'static>> {
vec![Box::new(NotBannedPermission)]
}
async fn execute(
&self,
ctx: CommandContext<'_, State>,