mirror of
https://github.com/arthur-pbty/shadowbot.git
synced 2026-06-03 23:36:25 +02:00
Refactor command handling and permissions management
- Updated examples formatting in SetpermCommand and LeaveSettingsCommand for consistency. - Consolidated the handling of guild targets into a new utility file (servertarget.rs). - Moved the del command logic to a new utility file (del.rs) for better organization. - Enhanced the set command functionalities by creating a dedicated set.rs file, improving readability and maintainability. - Removed deprecated servertarget.rs and del.rs files from the commands directory. - Improved the help command structure for better readability and maintainability. - Added new utility files for permissions and server target handling to streamline command processing.
This commit is contained in:
@@ -78,7 +78,8 @@ pub async fn handle_autopublishon(ctx: &Context, msg: &Message, args: &[&str]) {
|
|||||||
.and_then(|value| parse_channel_id(value))
|
.and_then(|value| parse_channel_id(value))
|
||||||
.unwrap_or(msg.channel_id);
|
.unwrap_or(msg.channel_id);
|
||||||
|
|
||||||
let result = db::add_autopublish_channel(&pool, bot_id, guild_id_i64, channel_id.get() as i64).await;
|
let result =
|
||||||
|
db::add_autopublish_channel(&pool, bot_id, guild_id_i64, channel_id.get() as i64).await;
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
send_embed(
|
send_embed(
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ impl crate::commands::command_contract::CommandSpec for AutopublishoffCommand {
|
|||||||
category: "automation",
|
category: "automation",
|
||||||
params: "[#canal]",
|
params: "[#canal]",
|
||||||
description: "Desactive la publication automatique des annonces sur un salon.",
|
description: "Desactive la publication automatique des annonces sur un salon.",
|
||||||
examples: &["+autopublishoff", "+autopublishoff #annonces", "+help autopublishoff"],
|
examples: &[
|
||||||
|
"+autopublishoff",
|
||||||
|
"+autopublishoff #annonces",
|
||||||
|
"+help autopublishoff",
|
||||||
|
],
|
||||||
default_aliases: &["apboff"],
|
default_aliases: &["apboff"],
|
||||||
allow_in_dm: false,
|
allow_in_dm: false,
|
||||||
default_permission: 5,
|
default_permission: 5,
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ impl crate::commands::command_contract::CommandSpec for AutopublishonCommand {
|
|||||||
category: "automation",
|
category: "automation",
|
||||||
params: "[#canal]",
|
params: "[#canal]",
|
||||||
description: "Active la publication automatique des annonces sur un salon.",
|
description: "Active la publication automatique des annonces sur un salon.",
|
||||||
examples: &["+autopublishon", "+autopublishon #annonces", "+help autopublishon"],
|
examples: &[
|
||||||
|
"+autopublishon",
|
||||||
|
"+autopublishon #annonces",
|
||||||
|
"+help autopublishon",
|
||||||
|
],
|
||||||
default_aliases: &["apbon"],
|
default_aliases: &["apbon"],
|
||||||
allow_in_dm: false,
|
allow_in_dm: false,
|
||||||
default_permission: 5,
|
default_permission: 5,
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ pub async fn handle_piconlyadd(ctx: &Context, msg: &Message, args: &[&str]) {
|
|||||||
.and_then(|raw| parse_channel_id(raw))
|
.and_then(|raw| parse_channel_id(raw))
|
||||||
.unwrap_or(msg.channel_id);
|
.unwrap_or(msg.channel_id);
|
||||||
|
|
||||||
let result = db::add_piconly_channel(&pool, bot_id, guild_id_i64, channel_id.get() as i64).await;
|
let result =
|
||||||
|
db::add_piconly_channel(&pool, bot_id, guild_id_i64, channel_id.get() as i64).await;
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
send_embed(
|
send_embed(
|
||||||
@@ -210,7 +211,8 @@ pub async fn handle_piconlydel(ctx: &Context, msg: &Message, args: &[&str]) {
|
|||||||
.and_then(|raw| parse_channel_id(raw))
|
.and_then(|raw| parse_channel_id(raw))
|
||||||
.unwrap_or(msg.channel_id);
|
.unwrap_or(msg.channel_id);
|
||||||
|
|
||||||
let result = db::remove_piconly_channel(&pool, bot_id, guild_id_i64, channel_id.get() as i64).await;
|
let result =
|
||||||
|
db::remove_piconly_channel(&pool, bot_id, guild_id_i64, channel_id.get() as i64).await;
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
send_embed(
|
send_embed(
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ impl crate::commands::command_contract::CommandSpec for SetpermCommand {
|
|||||||
category: "botconfig",
|
category: "botconfig",
|
||||||
params: "<permission/commande> <role/membre>",
|
params: "<permission/commande> <role/membre>",
|
||||||
description: "Attribue un niveau ACL ou un acces commande a un role ou membre.",
|
description: "Attribue un niveau ACL ou un acces commande a un role ou membre.",
|
||||||
examples: &["+setperm 6 @Moderateur", "+setperm mute @Role", "+help setperm"],
|
examples: &[
|
||||||
|
"+setperm 6 @Moderateur",
|
||||||
|
"+setperm mute @Role",
|
||||||
|
"+help setperm",
|
||||||
|
],
|
||||||
default_aliases: &["stp"],
|
default_aliases: &["stp"],
|
||||||
allow_in_dm: false,
|
allow_in_dm: false,
|
||||||
default_permission: 9,
|
default_permission: 9,
|
||||||
|
|||||||
@@ -143,10 +143,7 @@ impl crate::commands::command_contract::CommandSpec for LeaveSettingsCommand {
|
|||||||
category: "config",
|
category: "config",
|
||||||
params: "[on/off] [salon] [message]",
|
params: "[on/off] [salon] [message]",
|
||||||
description: "Configure les actions a executer quand un membre quitte le serveur.",
|
description: "Configure les actions a executer quand un membre quitte le serveur.",
|
||||||
examples: &[
|
examples: &["+leavesettings", "+leavesettings on #logs {user} a quitte"],
|
||||||
"+leavesettings",
|
|
||||||
"+leavesettings on #logs {user} a quitte",
|
|
||||||
],
|
|
||||||
default_aliases: &["lset"],
|
default_aliases: &["lset"],
|
||||||
allow_in_dm: false,
|
allow_in_dm: false,
|
||||||
default_permission: 5,
|
default_permission: 5,
|
||||||
|
|||||||
@@ -103,10 +103,7 @@ impl crate::commands::command_contract::CommandSpec for SetBoostembedCommand {
|
|||||||
category: "config",
|
category: "config",
|
||||||
params: "<title|description|color> <valeur>",
|
params: "<title|description|color> <valeur>",
|
||||||
description: "Configure le titre, la description et la couleur de l embed boost.",
|
description: "Configure le titre, la description et la couleur de l embed boost.",
|
||||||
examples: &[
|
examples: &["+setboostembed title Merci", "+setboostembed color #FF66CC"],
|
||||||
"+setboostembed title Merci",
|
|
||||||
"+setboostembed color #FF66CC",
|
|
||||||
],
|
|
||||||
default_aliases: &["sboostembed"],
|
default_aliases: &["sboostembed"],
|
||||||
allow_in_dm: false,
|
allow_in_dm: false,
|
||||||
default_permission: 6,
|
default_permission: 6,
|
||||||
|
|||||||
+36
-23
@@ -2,13 +2,14 @@ use crate::commands::command_contract::{CommandMetadata, CommandSpec};
|
|||||||
|
|
||||||
#[path = "roles/addrole.rs"]
|
#[path = "roles/addrole.rs"]
|
||||||
pub mod addrole;
|
pub mod addrole;
|
||||||
|
#[path = "../utils/admin_common.rs"]
|
||||||
pub mod admin_common;
|
pub mod admin_common;
|
||||||
|
#[path = "../utils/admin_service.rs"]
|
||||||
pub mod admin_service;
|
pub mod admin_service;
|
||||||
|
#[path = "../utils/advanced_tools.rs"]
|
||||||
pub mod advanced_tools;
|
pub mod advanced_tools;
|
||||||
#[path = "perms/alias.rs"]
|
#[path = "perms/alias.rs"]
|
||||||
pub mod alias;
|
pub mod alias;
|
||||||
#[path = "perms/unalias.rs"]
|
|
||||||
pub mod unalias;
|
|
||||||
#[path = "info/alladmins.rs"]
|
#[path = "info/alladmins.rs"]
|
||||||
pub mod alladmins;
|
pub mod alladmins;
|
||||||
#[path = "info/allbots.rs"]
|
#[path = "info/allbots.rs"]
|
||||||
@@ -29,6 +30,7 @@ pub mod antispam;
|
|||||||
pub mod autobackup;
|
pub mod autobackup;
|
||||||
#[path = "config/autoconfiglog.rs"]
|
#[path = "config/autoconfiglog.rs"]
|
||||||
pub mod autoconfiglog;
|
pub mod autoconfiglog;
|
||||||
|
#[path = "../utils/automod_service.rs"]
|
||||||
pub mod automod_service;
|
pub mod automod_service;
|
||||||
#[path = "automation/autopublish.rs"]
|
#[path = "automation/autopublish.rs"]
|
||||||
pub mod autopublish;
|
pub mod autopublish;
|
||||||
@@ -60,7 +62,9 @@ pub mod boosters;
|
|||||||
pub mod boostlog;
|
pub mod boostlog;
|
||||||
#[path = "owner/botadmins.rs"]
|
#[path = "owner/botadmins.rs"]
|
||||||
pub mod botadmins;
|
pub mod botadmins;
|
||||||
|
#[path = "../utils/botconfig_common.rs"]
|
||||||
pub mod botconfig_common;
|
pub mod botconfig_common;
|
||||||
|
#[path = "../utils/botconfig_service.rs"]
|
||||||
pub mod botconfig_service;
|
pub mod botconfig_service;
|
||||||
#[path = "channel/bringall.rs"]
|
#[path = "channel/bringall.rs"]
|
||||||
pub mod bringall;
|
pub mod bringall;
|
||||||
@@ -70,10 +74,10 @@ pub mod button;
|
|||||||
pub mod calc;
|
pub mod calc;
|
||||||
#[path = "botconfig/change.rs"]
|
#[path = "botconfig/change.rs"]
|
||||||
pub mod change;
|
pub mod change;
|
||||||
#[path = "botconfig/changereset.rs"]
|
|
||||||
pub mod changereset;
|
|
||||||
#[path = "botconfig/changeall.rs"]
|
#[path = "botconfig/changeall.rs"]
|
||||||
pub mod changeall;
|
pub mod changeall;
|
||||||
|
#[path = "botconfig/changereset.rs"]
|
||||||
|
pub mod changereset;
|
||||||
#[path = "info/channel.rs"]
|
#[path = "info/channel.rs"]
|
||||||
pub mod channel;
|
pub mod channel;
|
||||||
#[path = "fun/choose.rs"]
|
#[path = "fun/choose.rs"]
|
||||||
@@ -102,18 +106,20 @@ pub mod clear_sanctions;
|
|||||||
pub mod close;
|
pub mod close;
|
||||||
#[path = "mod/cmute.rs"]
|
#[path = "mod/cmute.rs"]
|
||||||
pub mod cmute;
|
pub mod cmute;
|
||||||
|
#[path = "../utils/command_contract.rs"]
|
||||||
pub mod command_contract;
|
pub mod command_contract;
|
||||||
|
#[path = "../utils/common.rs"]
|
||||||
pub mod common;
|
pub mod common;
|
||||||
#[path = "botconfig/compet.rs"]
|
#[path = "botconfig/compet.rs"]
|
||||||
pub mod compet;
|
pub mod compet;
|
||||||
#[path = "automation/create.rs"]
|
#[path = "automation/create.rs"]
|
||||||
pub mod create;
|
pub mod create;
|
||||||
#[path = "perms/del.rs"]
|
#[path = "../utils/del.rs"]
|
||||||
pub mod del;
|
pub mod del;
|
||||||
#[path = "perms/delperm.rs"]
|
|
||||||
pub mod delperm;
|
|
||||||
#[path = "mod/delsanction.rs"]
|
#[path = "mod/delsanction.rs"]
|
||||||
pub mod del_sanction;
|
pub mod del_sanction;
|
||||||
|
#[path = "perms/delperm.rs"]
|
||||||
|
pub mod delperm;
|
||||||
#[path = "roles/delrole.rs"]
|
#[path = "roles/delrole.rs"]
|
||||||
pub mod delrole;
|
pub mod delrole;
|
||||||
#[path = "roles/derank.rs"]
|
#[path = "roles/derank.rs"]
|
||||||
@@ -164,7 +170,9 @@ pub mod loading;
|
|||||||
pub mod lock;
|
pub mod lock;
|
||||||
#[path = "channel/lockall.rs"]
|
#[path = "channel/lockall.rs"]
|
||||||
pub mod lockall;
|
pub mod lockall;
|
||||||
|
#[path = "../utils/logs_command_helpers.rs"]
|
||||||
pub mod logs_command_helpers;
|
pub mod logs_command_helpers;
|
||||||
|
#[path = "../utils/logs_service.rs"]
|
||||||
pub mod logs_service;
|
pub mod logs_service;
|
||||||
#[path = "botconfig/mainprefix.rs"]
|
#[path = "botconfig/mainprefix.rs"]
|
||||||
pub mod mainprefix;
|
pub mod mainprefix;
|
||||||
@@ -174,8 +182,11 @@ pub mod massiverole;
|
|||||||
pub mod member;
|
pub mod member;
|
||||||
#[path = "config/messagelog.rs"]
|
#[path = "config/messagelog.rs"]
|
||||||
pub mod messagelog;
|
pub mod messagelog;
|
||||||
|
#[path = "../utils/moderation_channel_helpers.rs"]
|
||||||
pub mod moderation_channel_helpers;
|
pub mod moderation_channel_helpers;
|
||||||
|
#[path = "../utils/moderation_sanction_helpers.rs"]
|
||||||
pub mod moderation_sanction_helpers;
|
pub mod moderation_sanction_helpers;
|
||||||
|
#[path = "../utils/moderation_tools.rs"]
|
||||||
pub mod moderation_tools;
|
pub mod moderation_tools;
|
||||||
#[path = "config/modlog.rs"]
|
#[path = "config/modlog.rs"]
|
||||||
pub mod modlog;
|
pub mod modlog;
|
||||||
@@ -209,7 +220,9 @@ pub mod online;
|
|||||||
pub mod owner;
|
pub mod owner;
|
||||||
#[path = "perms/perms.rs"]
|
#[path = "perms/perms.rs"]
|
||||||
pub mod perms;
|
pub mod perms;
|
||||||
|
#[path = "../utils/perms_helpers.rs"]
|
||||||
pub mod perms_helpers;
|
pub mod perms_helpers;
|
||||||
|
#[path = "../utils/perms_service.rs"]
|
||||||
pub mod perms_service;
|
pub mod perms_service;
|
||||||
#[path = "info/pic.rs"]
|
#[path = "info/pic.rs"]
|
||||||
pub mod pic;
|
pub mod pic;
|
||||||
@@ -261,16 +274,22 @@ pub mod sanctions;
|
|||||||
pub mod say;
|
pub mod say;
|
||||||
#[path = "info/serverbanner.rs"]
|
#[path = "info/serverbanner.rs"]
|
||||||
pub mod serverbanner;
|
pub mod serverbanner;
|
||||||
|
#[path = "info/serverinfo.rs"]
|
||||||
|
pub mod serverinfo;
|
||||||
#[path = "info/serverlist.rs"]
|
#[path = "info/serverlist.rs"]
|
||||||
pub mod serverlist;
|
pub mod serverlist;
|
||||||
#[path = "info/serverpic.rs"]
|
#[path = "info/serverpic.rs"]
|
||||||
pub mod serverpic;
|
pub mod serverpic;
|
||||||
#[path = "info/servertarget.rs"]
|
#[path = "../utils/servertarget.rs"]
|
||||||
pub mod servertarget;
|
pub mod servertarget;
|
||||||
#[path = "info/serverinfo.rs"]
|
#[path = "../utils/set.rs"]
|
||||||
pub mod serverinfo;
|
|
||||||
#[path = "botconfig/set.rs"]
|
|
||||||
pub mod set;
|
pub mod set;
|
||||||
|
#[path = "config/setboostembed.rs"]
|
||||||
|
pub mod set_boostembed;
|
||||||
|
#[path = "config/setmodlogs.rs"]
|
||||||
|
pub mod set_modlogs;
|
||||||
|
#[path = "mod/setmuterole.rs"]
|
||||||
|
pub mod set_muterole;
|
||||||
#[path = "botconfig/setbanner.rs"]
|
#[path = "botconfig/setbanner.rs"]
|
||||||
pub mod setbanner;
|
pub mod setbanner;
|
||||||
#[path = "botconfig/setname.rs"]
|
#[path = "botconfig/setname.rs"]
|
||||||
@@ -281,12 +300,6 @@ pub mod setperm;
|
|||||||
pub mod setpic;
|
pub mod setpic;
|
||||||
#[path = "botconfig/setprofil.rs"]
|
#[path = "botconfig/setprofil.rs"]
|
||||||
pub mod setprofil;
|
pub mod setprofil;
|
||||||
#[path = "config/setboostembed.rs"]
|
|
||||||
pub mod set_boostembed;
|
|
||||||
#[path = "config/setmodlogs.rs"]
|
|
||||||
pub mod set_modlogs;
|
|
||||||
#[path = "mod/setmuterole.rs"]
|
|
||||||
pub mod set_muterole;
|
|
||||||
#[path = "botconfig/shadowbot.rs"]
|
#[path = "botconfig/shadowbot.rs"]
|
||||||
pub mod shadowbot;
|
pub mod shadowbot;
|
||||||
#[path = "info/showpics.rs"]
|
#[path = "info/showpics.rs"]
|
||||||
@@ -329,6 +342,8 @@ pub mod ticket_member;
|
|||||||
pub mod tickets;
|
pub mod tickets;
|
||||||
#[path = "mod/timeout.rs"]
|
#[path = "mod/timeout.rs"]
|
||||||
pub mod timeout;
|
pub mod timeout;
|
||||||
|
#[path = "perms/unalias.rs"]
|
||||||
|
pub mod unalias;
|
||||||
#[path = "mod/unban.rs"]
|
#[path = "mod/unban.rs"]
|
||||||
pub mod unban;
|
pub mod unban;
|
||||||
#[path = "mod/unbanall.rs"]
|
#[path = "mod/unbanall.rs"]
|
||||||
@@ -556,12 +571,10 @@ pub fn command_metadata_by_key(key: &str) -> Option<CommandMetadata> {
|
|||||||
let normalized = key.to_lowercase();
|
let normalized = key.to_lowercase();
|
||||||
let compact = normalized.replace('_', "");
|
let compact = normalized.replace('_', "");
|
||||||
|
|
||||||
all_command_metadata()
|
all_command_metadata().into_iter().find(|meta| {
|
||||||
.into_iter()
|
meta.name.eq_ignore_ascii_case(&normalized)
|
||||||
.find(|meta| {
|
|| meta.name.replace('_', "").eq_ignore_ascii_case(&compact)
|
||||||
meta.name.eq_ignore_ascii_case(&normalized)
|
})
|
||||||
|| meta.name.replace('_', "").eq_ignore_ascii_case(&compact)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resolve_default_alias(alias: &str) -> Option<&'static str> {
|
pub fn resolve_default_alias(alias: &str) -> Option<&'static str> {
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ pub async fn handle_alias(ctx: &Context, msg: &Message, args: &[&str]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let command = args[0].trim_start_matches('+').to_lowercase();
|
let command = args[0].trim_start_matches('+').to_lowercase();
|
||||||
let is_known = all_command_keys().iter().any(|candidate| candidate == &command)
|
let is_known = all_command_keys()
|
||||||
|
.iter()
|
||||||
|
.any(|candidate| candidate == &command)
|
||||||
|| crate::commands::command_metadata_by_key(&command).is_some();
|
|| crate::commands::command_metadata_by_key(&command).is_some();
|
||||||
if !is_known {
|
if !is_known {
|
||||||
let embed = serenity::builder::CreateEmbed::new()
|
let embed = serenity::builder::CreateEmbed::new()
|
||||||
|
|||||||
+12
-38
@@ -135,28 +135,10 @@ fn help_page_for_command(
|
|||||||
"modlog" | "messagelog" | "voicelog" | "boostlog" | "rolelog" | "raidlog"
|
"modlog" | "messagelog" | "voicelog" | "boostlog" | "rolelog" | "raidlog"
|
||||||
| "autoconfiglog" | "nolog" | "joinsettings" | "boostembed" | "setmodlogs"
|
| "autoconfiglog" | "nolog" | "joinsettings" | "boostembed" | "setmodlogs"
|
||||||
| "setboostembed" | "leavesettings" | "viewlogs" => "logs",
|
| "setboostembed" | "leavesettings" | "viewlogs" => "logs",
|
||||||
"warn"
|
"warn" | "mute" | "tempmute" | "unmute" | "cmute" | "tempcmute" | "uncmute"
|
||||||
| "mute"
|
| "mutelist" | "unmuteall" | "kick" | "ban" | "tempban" | "unban" | "banlist"
|
||||||
| "tempmute"
|
| "unbanall" | "sanctions" | "delsanction" | "clearsanctions" | "clearallsanctions"
|
||||||
| "unmute"
|
| "cleanup" | "renew" | "clearmessages" => "moderation",
|
||||||
| "cmute"
|
|
||||||
| "tempcmute"
|
|
||||||
| "uncmute"
|
|
||||||
| "mutelist"
|
|
||||||
| "unmuteall"
|
|
||||||
| "kick"
|
|
||||||
| "ban"
|
|
||||||
| "tempban"
|
|
||||||
| "unban"
|
|
||||||
| "banlist"
|
|
||||||
| "unbanall"
|
|
||||||
| "sanctions"
|
|
||||||
| "delsanction"
|
|
||||||
| "clearsanctions"
|
|
||||||
| "clearallsanctions"
|
|
||||||
| "cleanup"
|
|
||||||
| "renew"
|
|
||||||
| "clearmessages" => "moderation",
|
|
||||||
"addrole" | "delrole" | "derank" | "massiverole" | "unmassiverole" | "temprole"
|
"addrole" | "delrole" | "derank" | "massiverole" | "unmassiverole" | "temprole"
|
||||||
| "untemprole" | "sync" => "roles",
|
| "untemprole" | "sync" => "roles",
|
||||||
"lock" | "unlock" | "lockall" | "unlockall" | "hide" | "unhide" | "hideall"
|
"lock" | "unlock" | "lockall" | "unlockall" | "hide" | "unhide" | "hideall"
|
||||||
@@ -164,19 +146,13 @@ fn help_page_for_command(
|
|||||||
"giveaway" | "end" | "reroll" | "choose" | "calc" | "emoji" | "embed" | "say"
|
"giveaway" | "end" | "reroll" | "choose" | "calc" | "emoji" | "embed" | "say"
|
||||||
| "create" | "newsticker" | "button" | "autoreact" | "snipe" | "loading" | "backup"
|
| "create" | "newsticker" | "button" | "autoreact" | "snipe" | "loading" | "backup"
|
||||||
| "autobackup" => "outils",
|
| "autobackup" => "outils",
|
||||||
"shadowbot" | "setname" | "setpic" | "setbanner" | "setprofil" | "setperm"
|
"shadowbot" | "setname" | "setpic" | "setbanner" | "setprofil" | "setperm" | "theme"
|
||||||
| "theme" | "playto" | "listen" | "watch" | "compet" | "stream"
|
| "playto" | "listen" | "watch" | "compet" | "stream" | "removeactivity" | "online"
|
||||||
| "removeactivity" | "online" | "idle" | "dnd" | "invisible" | "change"
|
| "idle" | "dnd" | "invisible" | "change" | "changereset" | "changeall" => "bot",
|
||||||
| "changereset" | "changeall" => {
|
"owner" | "unowner" | "clearowners" | "bl" | "unbl" | "blinfo" | "clearbl" | "allbots"
|
||||||
"bot"
|
| "alladmins" | "botadmins" | "mainprefix" | "prefix" | "mp" | "mpsettings" | "mpsent"
|
||||||
}
|
| "mpdelete" | "invite" | "leave" | "discussion" => "administration",
|
||||||
"owner" | "unowner" | "clearowners" | "bl" | "unbl" | "blinfo" | "clearbl"
|
"perms" | "delperm" | "clearperms" | "allperms" | "alias" | "help" | "helpsetting" => {
|
||||||
| "allbots" | "alladmins" | "botadmins" | "mainprefix" | "prefix" | "mp"
|
|
||||||
| "mpsettings" | "mpsent" | "mpdelete" | "invite" | "leave" | "discussion" => {
|
|
||||||
"administration"
|
|
||||||
}
|
|
||||||
"perms" | "delperm" | "clearperms" | "allperms" | "alias" | "help"
|
|
||||||
| "helpsetting" => {
|
|
||||||
"permissions"
|
"permissions"
|
||||||
}
|
}
|
||||||
_ => match meta.category {
|
_ => match meta.category {
|
||||||
@@ -410,9 +386,7 @@ fn help_lookup_to_key(input: &str) -> Option<&'static str> {
|
|||||||
"newsticker" => Some("newsticker"),
|
"newsticker" => Some("newsticker"),
|
||||||
"piconly" => Some("piconly"),
|
"piconly" => Some("piconly"),
|
||||||
"piconly add" | "piconlyadd" => Some("piconlyadd"),
|
"piconly add" | "piconlyadd" => Some("piconlyadd"),
|
||||||
"piconly del" | "piconly remove" | "piconly delete" | "piconlydel" => {
|
"piconly del" | "piconly remove" | "piconly delete" | "piconlydel" => Some("piconlydel"),
|
||||||
Some("piconlydel")
|
|
||||||
}
|
|
||||||
"massiverole" => Some("massiverole"),
|
"massiverole" => Some("massiverole"),
|
||||||
"unmassiverole" => Some("unmassiverole"),
|
"unmassiverole" => Some("unmassiverole"),
|
||||||
"noderank" => Some("noderank"),
|
"noderank" => Some("noderank"),
|
||||||
|
|||||||
+15
-16
@@ -9,22 +9,21 @@ use crate::commands::{
|
|||||||
addrole, alias, ancien, antilink, antimassmention, antiraideautoconfig, antispam, autobackup,
|
addrole, alias, ancien, antilink, antimassmention, antiraideautoconfig, antispam, autobackup,
|
||||||
autoconfiglog, autopublish, autopublishoff, autopublishon, autoreact, backup, badwords, ban,
|
autoconfiglog, autopublish, autopublishoff, autopublishon, autoreact, backup, badwords, ban,
|
||||||
banlist, banner, bl, blinfo, boostembed, boosters, boostlog, bringall, button, calc, change,
|
banlist, banner, bl, blinfo, boostembed, boosters, boostlog, bringall, button, calc, change,
|
||||||
changeall, changereset,
|
changeall, changereset, channel, choose, claim, cleanup, clear_all_sanctions, clear_badwords,
|
||||||
channel, choose, claim, cleanup, clear_all_sanctions, clear_badwords, clear_bl, clear_limit,
|
clear_bl, clear_limit, clear_messages, clear_owners, clear_perms, clear_sanctions, close,
|
||||||
clear_messages, clear_owners, clear_perms, clear_sanctions, close, cmute, compet, create,
|
cmute, compet, create, del_sanction, delperm, delrole, derank, discussion, dnd, embed, emoji,
|
||||||
del_sanction, delperm, delrole, derank, discussion, dnd, embed, emoji, end, endgiveaway,
|
end, endgiveaway, giveaway, help, helpsetting, hide, hideall, idle, invisible, invite, join,
|
||||||
giveaway, help, helpsetting, hide, hideall, idle, invisible, invite, join, kick, leave,
|
kick, leave, leave_settings, link, listen, loading, lock, lockall, mainprefix, massiverole,
|
||||||
leave_settings, link, listen, loading, lock, lockall, mainprefix, massiverole, member,
|
member, messagelog, modlog, mp, mpdelete, mpsent, mpsettings, mute, mutelist, muterole,
|
||||||
messagelog, modlog, mp, mpdelete, mpsent, mpsettings, mute, mutelist, muterole, newsticker,
|
newsticker, noderank, noderankadd, noderankdel, nolog, online, owner, perms, pic, piconly,
|
||||||
noderank, noderankadd, noderankdel, nolog, online, owner, perms, pic, piconly, piconlyadd,
|
piconlyadd, piconlydel, ping, playto, prefix, public, punish, punishadd, punishdel,
|
||||||
piconlydel, ping, playto, prefix, public, punish, punishadd, punishdel, punishsetup,
|
punishsetup, raidlog, rename, renew, reroll, resetantiraide, role, rolelog, rolemembers,
|
||||||
raidlog, rename, renew, reroll, resetantiraide, role, rolelog, rolemembers, rolemenu,
|
rolemenu, sanctions, say, serverbanner, serverinfo, serverlist, serverpic, set_boostembed,
|
||||||
sanctions, say, serverbanner, serverinfo, serverlist, serverpic, set_boostembed,
|
set_modlogs, set_muterole, setbanner, setname, setperm, setpic, setprofil, shadowbot, showpics,
|
||||||
set_modlogs, set_muterole, setbanner, setname, setperm, setpic, setprofil, shadowbot,
|
slowmode, snipe, spam, stream, strikes, suggestion, suggestionsettings, sync, tempban,
|
||||||
showpics, slowmode, snipe, spam, stream, strikes, suggestion, suggestionsettings, sync,
|
tempcmute, tempmute, temprole, tempvoc, tempvoc_cmd, theme, ticket, ticket_member, tickets,
|
||||||
tempban, tempcmute, tempmute, temprole, tempvoc, tempvoc_cmd, theme, ticket, ticket_member,
|
timeout, unalias, unban, unbanall, unbl, uncmute, unhide, unhideall, unlock, unlockall,
|
||||||
tickets, timeout, unban, unbanall, unbl, uncmute, unhide, unhideall, unlock, unlockall,
|
unmassiverole, unmute, unmuteall, unowner, untemprole, user, viewlogs, vocinfo, voicekick,
|
||||||
unalias, unmassiverole, unmute, unmuteall, unowner, untemprole, user, viewlogs, vocinfo, voicekick,
|
|
||||||
voicelog, voicemove, warn, watch,
|
voicelog, voicemove, warn, watch,
|
||||||
};
|
};
|
||||||
use crate::commands::{alladmins, allbots, allperms, botadmins};
|
use crate::commands::{alladmins, allbots, allperms, botadmins};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
pub mod channel_event;
|
pub mod channel_event;
|
||||||
pub mod guild_create_event;
|
pub mod guild_create_event;
|
||||||
pub mod guild_member_event;
|
pub mod guild_member_event;
|
||||||
|
#[path = "../utils/events_handler.rs"]
|
||||||
pub mod handler;
|
pub mod handler;
|
||||||
pub mod interaction_create_event;
|
pub mod interaction_create_event;
|
||||||
pub mod message_delete_event;
|
pub mod message_delete_event;
|
||||||
|
|||||||
@@ -49,4 +49,3 @@ pub async fn handle_del(ctx: &Context, msg: &Message, args: &[&str]) {
|
|||||||
.color(0x57F287);
|
.color(0x57F287);
|
||||||
send_embed(ctx, msg, embed).await;
|
send_embed(ctx, msg, embed).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,10 +34,7 @@ pub fn parse_user_or_role(input: &str) -> Option<(&'static str, u64)> {
|
|||||||
|
|
||||||
pub fn normalize_command_name(input: &str) -> String {
|
pub fn normalize_command_name(input: &str) -> String {
|
||||||
let normalized = input.trim_start_matches('+').to_lowercase();
|
let normalized = input.trim_start_matches('+').to_lowercase();
|
||||||
let underscored = normalized
|
let underscored = normalized.split_whitespace().collect::<Vec<_>>().join("_");
|
||||||
.split_whitespace()
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join("_");
|
|
||||||
let compact = underscored.replace('_', "");
|
let compact = underscored.replace('_', "");
|
||||||
|
|
||||||
let known = crate::permissions::all_command_keys();
|
let known = crate::permissions::all_command_keys();
|
||||||
|
|||||||
@@ -286,4 +286,3 @@ pub async fn handle_setprofil(ctx: &Context, msg: &Message, args: &[&str]) {
|
|||||||
};
|
};
|
||||||
send_embed(ctx, msg, embed).await;
|
send_embed(ctx, msg, embed).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user