modify commands categories

This commit is contained in:
Puechberty Arthur
2026-04-10 06:54:51 +02:00
parent e1016e0af1
commit b6d8953c46
126 changed files with 259 additions and 251 deletions
+52
View File
@@ -0,0 +1,52 @@
use serenity::model::prelude::*;
use serenity::prelude::*;
use crate::commands::admin_common::ensure_owner;
use crate::commands::common::send_embed;
use crate::db::{DbPoolKey, clear_blacklist};
pub async fn handle_clear_bl(ctx: &Context, msg: &Message) {
if ensure_owner(ctx, msg).await.is_err() {
return;
}
let bot_id = ctx.cache.current_user().id;
let pool = {
let data = ctx.data.read().await;
data.get::<DbPoolKey>().cloned()
};
let Some(pool) = pool else {
let embed = serenity::builder::CreateEmbed::new()
.title("Erreur")
.description("DB indisponible.")
.color(0xED4245);
send_embed(ctx, msg, embed).await;
return;
};
let count = clear_blacklist(&pool, bot_id).await.unwrap_or(0);
let embed = serenity::builder::CreateEmbed::new()
.title("Blacklist réinitialisée")
.description(format!("{} membre(s) retiré(s) de la blacklist.", count))
.color(0x57F287);
send_embed(ctx, msg, embed).await;
}
pub struct ClearBlCommand;
pub static COMMAND_DESCRIPTOR: ClearBlCommand = ClearBlCommand;
impl crate::commands::command_contract::CommandSpec for ClearBlCommand {
fn metadata(&self) -> crate::commands::command_contract::CommandMetadata {
crate::commands::command_contract::CommandMetadata {
name: "clear_bl",
category: "administration",
params: "aucun",
summary: "Vide la blacklist globale",
description: "Supprime toutes les entrees de la blacklist globale.",
examples: &["+clear bl", "+cl", "+help clear bl"],
default_aliases: &["cbl"],
default_permission: 9,
}
}
}