feat(commands/moderation): updating the clear to be on help menu

This commit is contained in:
Raphael 2026-02-16 15:27:07 +01:00
parent 5cd072e0e7
commit 87e8467daf
No known key found for this signature in database

View file

@ -1,25 +1,24 @@
use crate::commands::{CommandEntry, SlashCommand}; use std::sync::atomic::AtomicU64;
use crate::commands::{CommandCategory, CommandEntry, SlashCommand};
use crate::config::EmojiConfig; use crate::config::EmojiConfig;
use serenity::all::{ use serenity::all::{
ChannelType, CommandInteraction, CommandOption, CommandOptionType, Context, CreateCommand, CreateCommandOption, CreateInteractionResponse, CreateInteractionResponseMessage, EditInteractionResponse, GetMessages, InteractionContext, Message, MessageId, Permissions
CommandInteraction,
CommandOption,
CommandOptionType,
Context,
CreateCommand,
CreateCommandOption,
CreateInteractionResponse,
CreateInteractionResponseMessage,
EditInteractionResponse,
GetMessages,
Message,
MessageId,
Permissions
}; };
use sqlx::PgPool; use sqlx::PgPool;
pub struct Clear; pub struct Clear {
pub command_id: AtomicU64,
}
impl Clear {
pub fn new() -> Self {
Self {
command_id: AtomicU64::new(0),
}
}
}
#[serenity::async_trait] #[serenity::async_trait]
impl SlashCommand for Clear { impl SlashCommand for Clear {
@ -31,6 +30,14 @@ impl SlashCommand for Clear {
"Clear X message (X given in the parameters)" "Clear X message (X given in the parameters)"
} }
fn category(&self) -> &'static CommandCategory {
&CommandCategory::Moderation
}
fn command_id_ref(&self) -> &AtomicU64 {
&self.command_id
}
fn register(&self) -> CreateCommand { fn register(&self) -> CreateCommand {
println!("\t✅ | {}", self.name()); println!("\t✅ | {}", self.name());
let mut options: Vec<CreateCommandOption> = Vec::new(); let mut options: Vec<CreateCommandOption> = Vec::new();
@ -45,6 +52,9 @@ impl SlashCommand for Clear {
.description(self.description()) .description(self.description())
.default_member_permissions(Permissions::MANAGE_MESSAGES) .default_member_permissions(Permissions::MANAGE_MESSAGES)
.set_options(options) .set_options(options)
.contexts(vec![
InteractionContext::Guild,
])
} }
async fn run( async fn run(
@ -91,5 +101,5 @@ impl SlashCommand for Clear {
} }
inventory::submit! { inventory::submit! {
CommandEntry { create: || Box::new(Clear) } CommandEntry { create: || Box::new(Clear::new()) }
} }