diff --git a/src/commands/addrole.rs b/src/commands/admin/addrole.rs similarity index 96% rename from src/commands/addrole.rs rename to src/commands/admin/addrole.rs index c4b73ac..6347ae1 100644 --- a/src/commands/addrole.rs +++ b/src/commands/admin/addrole.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for AddroleCommand { examples: &["+addrole @User @Membre"], alias_source_key: "addrole", default_aliases: &["ar"], + default_permission: 8, } } } diff --git a/src/commands/autobackup.rs b/src/commands/admin/autobackup.rs similarity index 96% rename from src/commands/autobackup.rs rename to src/commands/admin/autobackup.rs index cea0170..7c00f0c 100644 --- a/src/commands/autobackup.rs +++ b/src/commands/admin/autobackup.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for AutoBackupCommand { examples: &["+autobackup serveur 3", "+autobackup emoji 7"], alias_source_key: "autobackup", default_aliases: &["abkp"], + default_permission: 8, } } } diff --git a/src/commands/autoconfiglog.rs b/src/commands/admin/autoconfiglog.rs similarity index 96% rename from src/commands/autoconfiglog.rs rename to src/commands/admin/autoconfiglog.rs index 28581f7..e5a8082 100644 --- a/src/commands/autoconfiglog.rs +++ b/src/commands/admin/autoconfiglog.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for AutoconfiglogCommand { examples: &["+autoconfiglog"], alias_source_key: "autoconfiglog", default_aliases: &["acl"], + default_permission: 8, } } } diff --git a/src/commands/autopublish.rs b/src/commands/admin/autopublish.rs similarity index 100% rename from src/commands/autopublish.rs rename to src/commands/admin/autopublish.rs diff --git a/src/commands/autoreact.rs b/src/commands/admin/autoreact.rs similarity index 96% rename from src/commands/autoreact.rs rename to src/commands/admin/autoreact.rs index ddc05c1..2577884 100644 --- a/src/commands/autoreact.rs +++ b/src/commands/admin/autoreact.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for AutoReactCommand { examples: &["+autoreact add #general 😀", "+autoreact list"], alias_source_key: "autoreact", default_aliases: &["ar", "reactauto"], + default_permission: 8, } } } diff --git a/src/commands/backup.rs b/src/commands/admin/backup.rs similarity index 96% rename from src/commands/backup.rs rename to src/commands/admin/backup.rs index cf50d7a..c4a898a 100644 --- a/src/commands/backup.rs +++ b/src/commands/admin/backup.rs @@ -26,6 +26,7 @@ impl crate::commands::command_contract::CommandSpec for BackupCommand { ], alias_source_key: "backup", default_aliases: &["bkp"], + default_permission: 8, } } } diff --git a/src/commands/ban.rs b/src/commands/admin/ban.rs similarity index 96% rename from src/commands/ban.rs rename to src/commands/admin/ban.rs index 32710d3..6a45a93 100644 --- a/src/commands/ban.rs +++ b/src/commands/admin/ban.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for BanCommand { examples: &["+ban @User"], alias_source_key: "ban", default_aliases: &["b"], + default_permission: 8, } } } diff --git a/src/commands/banlist.rs b/src/commands/admin/banlist.rs similarity index 96% rename from src/commands/banlist.rs rename to src/commands/admin/banlist.rs index 2f644cf..fc1f71c 100644 --- a/src/commands/banlist.rs +++ b/src/commands/admin/banlist.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for BanlistCommand { examples: &["+banlist"], alias_source_key: "banlist", default_aliases: &["bls"], + default_permission: 8, } } } diff --git a/src/commands/bl.rs b/src/commands/admin/bl.rs similarity index 98% rename from src/commands/bl.rs rename to src/commands/admin/bl.rs index 629c51a..72a697a 100644 --- a/src/commands/bl.rs +++ b/src/commands/admin/bl.rs @@ -87,6 +87,7 @@ impl crate::commands::command_contract::CommandSpec for BlCommand { examples: &["+bl", "+help bl"], alias_source_key: "bl", default_aliases: &["bls"], + default_permission: 9, } } } diff --git a/src/commands/blinfo.rs b/src/commands/admin/blinfo.rs similarity index 98% rename from src/commands/blinfo.rs rename to src/commands/admin/blinfo.rs index baad3b5..1a53503 100644 --- a/src/commands/blinfo.rs +++ b/src/commands/admin/blinfo.rs @@ -92,6 +92,7 @@ impl crate::commands::command_contract::CommandSpec for BlinfoCommand { examples: &["+blinfo", "+bo", "+help blinfo"], alias_source_key: "blinfo", default_aliases: &["bli"], + default_permission: 9, } } } diff --git a/src/commands/boostembed.rs b/src/commands/admin/boostembed.rs similarity index 96% rename from src/commands/boostembed.rs rename to src/commands/admin/boostembed.rs index 8119c82..849b4b4 100644 --- a/src/commands/boostembed.rs +++ b/src/commands/admin/boostembed.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for BoostembedCommand { examples: &["+boostembed on", "+boostembed test"], alias_source_key: "boostembed", default_aliases: &["bembed"], + default_permission: 8, } } } diff --git a/src/commands/boostlog.rs b/src/commands/admin/boostlog.rs similarity index 96% rename from src/commands/boostlog.rs rename to src/commands/admin/boostlog.rs index e94124b..aa070d1 100644 --- a/src/commands/boostlog.rs +++ b/src/commands/admin/boostlog.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for BoostlogCommand { examples: &["+boostlog on #logs", "+boostlog off"], alias_source_key: "boostlog", default_aliases: &["blog"], + default_permission: 8, } } } diff --git a/src/commands/bringall.rs b/src/commands/admin/bringall.rs similarity index 96% rename from src/commands/bringall.rs rename to src/commands/admin/bringall.rs index 2866f95..8e0f7c4 100644 --- a/src/commands/bringall.rs +++ b/src/commands/admin/bringall.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for BringAllCommand { examples: &["+bringall #Event", "+bringall"], alias_source_key: "bringall", default_aliases: &["ball", "vbring"], + default_permission: 8, } } } diff --git a/src/commands/button.rs b/src/commands/admin/button.rs similarity index 96% rename from src/commands/button.rs rename to src/commands/admin/button.rs index 51c3640..3362e2d 100644 --- a/src/commands/button.rs +++ b/src/commands/admin/button.rs @@ -25,6 +25,7 @@ impl crate::commands::command_contract::CommandSpec for ButtonCommand { ], alias_source_key: "button", default_aliases: &["btn"], + default_permission: 8, } } } diff --git a/src/commands/claim.rs b/src/commands/admin/claim.rs similarity index 100% rename from src/commands/claim.rs rename to src/commands/admin/claim.rs diff --git a/src/commands/cleanup.rs b/src/commands/admin/cleanup.rs similarity index 96% rename from src/commands/cleanup.rs rename to src/commands/admin/cleanup.rs index ca0c1c3..5d5d534 100644 --- a/src/commands/cleanup.rs +++ b/src/commands/admin/cleanup.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for CleanupCommand { examples: &["+cleanup #General"], alias_source_key: "cleanup", default_aliases: &["vclean", "vcleanup"], + default_permission: 8, } } } diff --git a/src/commands/clear_all_sanctions.rs b/src/commands/admin/clear_all_sanctions.rs similarity index 96% rename from src/commands/clear_all_sanctions.rs rename to src/commands/admin/clear_all_sanctions.rs index cb63ba1..1b47f21 100644 --- a/src/commands/clear_all_sanctions.rs +++ b/src/commands/admin/clear_all_sanctions.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for ClearAllSanctionsCommand examples: &["+clear all sanctions"], alias_source_key: "clear_all_sanctions", default_aliases: &["casanctions"], + default_permission: 8, } } } diff --git a/src/commands/clear_bl.rs b/src/commands/admin/clear_bl.rs similarity index 98% rename from src/commands/clear_bl.rs rename to src/commands/admin/clear_bl.rs index 56f10d1..1ab89f5 100644 --- a/src/commands/clear_bl.rs +++ b/src/commands/admin/clear_bl.rs @@ -48,6 +48,7 @@ impl crate::commands::command_contract::CommandSpec for ClearBlCommand { examples: &["+clear bl", "+cl", "+help clear bl"], alias_source_key: "clear_bl", default_aliases: &["cbl"], + default_permission: 9, } } } diff --git a/src/commands/clear_messages.rs b/src/commands/admin/clear_messages.rs similarity index 96% rename from src/commands/clear_messages.rs rename to src/commands/admin/clear_messages.rs index 950a8a2..35a06b9 100644 --- a/src/commands/clear_messages.rs +++ b/src/commands/admin/clear_messages.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for ClearMessagesCommand { examples: &["+clear 20", "+clear 20 @User"], alias_source_key: "clear_messages", default_aliases: &["purge"], + default_permission: 8, } } } diff --git a/src/commands/clear_owners.rs b/src/commands/admin/clear_owners.rs similarity index 98% rename from src/commands/clear_owners.rs rename to src/commands/admin/clear_owners.rs index 850aaa2..ceb6bff 100644 --- a/src/commands/clear_owners.rs +++ b/src/commands/admin/clear_owners.rs @@ -48,6 +48,7 @@ impl crate::commands::command_contract::CommandSpec for ClearOwnersCommand { examples: &["+clear owners", "+cs", "+help clear owners"], alias_source_key: "clear_owners", default_aliases: &["cro"], + default_permission: 9, } } } diff --git a/src/commands/clear_sanctions.rs b/src/commands/admin/clear_sanctions.rs similarity index 96% rename from src/commands/clear_sanctions.rs rename to src/commands/admin/clear_sanctions.rs index 5a3b689..4793c0a 100644 --- a/src/commands/clear_sanctions.rs +++ b/src/commands/admin/clear_sanctions.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for ClearSanctionsCommand { examples: &["+clear sanctions @User"], alias_source_key: "clear_sanctions", default_aliases: &["csanctions"], + default_permission: 8, } } } diff --git a/src/commands/close.rs b/src/commands/admin/close.rs similarity index 100% rename from src/commands/close.rs rename to src/commands/admin/close.rs diff --git a/src/commands/cmute.rs b/src/commands/admin/cmute.rs similarity index 96% rename from src/commands/cmute.rs rename to src/commands/admin/cmute.rs index 105bc80..8b96536 100644 --- a/src/commands/cmute.rs +++ b/src/commands/admin/cmute.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for CmuteCommand { examples: &["+cmute @User"], alias_source_key: "cmute", default_aliases: &["cm"], + default_permission: 8, } } } diff --git a/src/commands/create.rs b/src/commands/admin/create.rs similarity index 96% rename from src/commands/create.rs rename to src/commands/admin/create.rs index 624bc89..9c610f1 100644 --- a/src/commands/create.rs +++ b/src/commands/admin/create.rs @@ -25,6 +25,7 @@ impl crate::commands::command_contract::CommandSpec for CreateCommand { ], alias_source_key: "create", default_aliases: &["mkemoji", "ce"], + default_permission: 8, } } } diff --git a/src/commands/del_sanction.rs b/src/commands/admin/del_sanction.rs similarity index 96% rename from src/commands/del_sanction.rs rename to src/commands/admin/del_sanction.rs index 9786eff..ff7ba99 100644 --- a/src/commands/del_sanction.rs +++ b/src/commands/admin/del_sanction.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for DelSanctionCommand { examples: &["+del sanction @User 1"], alias_source_key: "del_sanction", default_aliases: &["delsanction"], + default_permission: 8, } } } diff --git a/src/commands/delrole.rs b/src/commands/admin/delrole.rs similarity index 96% rename from src/commands/delrole.rs rename to src/commands/admin/delrole.rs index 4af6ab4..9f366aa 100644 --- a/src/commands/delrole.rs +++ b/src/commands/admin/delrole.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for DelroleCommand { examples: &["+delrole @User @Membre"], alias_source_key: "delrole", default_aliases: &["dr"], + default_permission: 8, } } } diff --git a/src/commands/derank.rs b/src/commands/admin/derank.rs similarity index 96% rename from src/commands/derank.rs rename to src/commands/admin/derank.rs index b3ddd2d..22da247 100644 --- a/src/commands/derank.rs +++ b/src/commands/admin/derank.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for DerankCommand { examples: &["+derank @User"], alias_source_key: "derank", default_aliases: &["drk"], + default_permission: 8, } } } diff --git a/src/commands/embed.rs b/src/commands/admin/embed.rs similarity index 96% rename from src/commands/embed.rs rename to src/commands/admin/embed.rs index 83434ba..7dfded9 100644 --- a/src/commands/embed.rs +++ b/src/commands/admin/embed.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for EmbedCommand { examples: &["+embed"], alias_source_key: "embed", default_aliases: &["emb"], + default_permission: 8, } } } diff --git a/src/commands/end.rs b/src/commands/admin/end.rs similarity index 96% rename from src/commands/end.rs rename to src/commands/admin/end.rs index 0f5c0d5..87c767a 100644 --- a/src/commands/end.rs +++ b/src/commands/admin/end.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for EndCommand { examples: &["+end giveaway 123456789012345678"], alias_source_key: "end", default_aliases: &["gend"], + default_permission: 0, } } } diff --git a/src/commands/giveaway.rs b/src/commands/admin/giveaway.rs similarity index 96% rename from src/commands/giveaway.rs rename to src/commands/admin/giveaway.rs index d00eba3..7e2243e 100644 --- a/src/commands/giveaway.rs +++ b/src/commands/admin/giveaway.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for GiveawayCommand { examples: &["+giveaway"], alias_source_key: "giveaway", default_aliases: &["gstart", "gw"], + default_permission: 8, } } } diff --git a/src/commands/hide.rs b/src/commands/admin/hide.rs similarity index 96% rename from src/commands/hide.rs rename to src/commands/admin/hide.rs index 1ad9e6c..8af51de 100644 --- a/src/commands/hide.rs +++ b/src/commands/admin/hide.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for HideCommand { examples: &["+hide", "+hide #general"], alias_source_key: "hide", default_aliases: &["hd"], + default_permission: 8, } } } diff --git a/src/commands/hideall.rs b/src/commands/admin/hideall.rs similarity index 96% rename from src/commands/hideall.rs rename to src/commands/admin/hideall.rs index d10aa34..2943d5c 100644 --- a/src/commands/hideall.rs +++ b/src/commands/admin/hideall.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for HideallCommand { examples: &["+hideall"], alias_source_key: "hideall", default_aliases: &["hda"], + default_permission: 8, } } } diff --git a/src/commands/invite.rs b/src/commands/admin/invite.rs similarity index 98% rename from src/commands/invite.rs rename to src/commands/admin/invite.rs index f679d0c..afc1da0 100644 --- a/src/commands/invite.rs +++ b/src/commands/admin/invite.rs @@ -79,6 +79,7 @@ impl crate::commands::command_contract::CommandSpec for InviteCommand { examples: &["+invite", "+ie", "+help invite"], alias_source_key: "invite", default_aliases: &["ivt"], + default_permission: 8, } } } diff --git a/src/commands/join.rs b/src/commands/admin/join.rs similarity index 96% rename from src/commands/join.rs rename to src/commands/admin/join.rs index 4db3e3b..b699deb 100644 --- a/src/commands/join.rs +++ b/src/commands/admin/join.rs @@ -24,6 +24,7 @@ impl crate::commands::command_contract::CommandSpec for JoinCommand { ], alias_source_key: "join", default_aliases: &["jset"], + default_permission: 8, } } } diff --git a/src/commands/kick.rs b/src/commands/admin/kick.rs similarity index 96% rename from src/commands/kick.rs rename to src/commands/admin/kick.rs index 5e61dad..61d5e0d 100644 --- a/src/commands/kick.rs +++ b/src/commands/admin/kick.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for KickCommand { examples: &["+kick @User"], alias_source_key: "kick", default_aliases: &["k"], + default_permission: 8, } } } diff --git a/src/commands/leave.rs b/src/commands/admin/leave.rs similarity index 97% rename from src/commands/leave.rs rename to src/commands/admin/leave.rs index 888e152..ccf01be 100644 --- a/src/commands/leave.rs +++ b/src/commands/admin/leave.rs @@ -43,6 +43,7 @@ impl crate::commands::command_contract::CommandSpec for LeaveCommand { examples: &["+leave", "+le", "+help leave"], alias_source_key: "leave", default_aliases: &["lvg"], + default_permission: 9, } } } diff --git a/src/commands/leave_settings.rs b/src/commands/admin/leave_settings.rs similarity index 97% rename from src/commands/leave_settings.rs rename to src/commands/admin/leave_settings.rs index 8ee395c..dfe0084 100644 --- a/src/commands/leave_settings.rs +++ b/src/commands/admin/leave_settings.rs @@ -25,6 +25,7 @@ impl crate::commands::command_contract::CommandSpec for LeaveSettingsCommand { ], alias_source_key: "leave_settings", default_aliases: &["lset"], + default_permission: 8, } } } diff --git a/src/commands/lock.rs b/src/commands/admin/lock.rs similarity index 96% rename from src/commands/lock.rs rename to src/commands/admin/lock.rs index aa00765..eba31fd 100644 --- a/src/commands/lock.rs +++ b/src/commands/admin/lock.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for LockCommand { examples: &["+lock", "+lock #general"], alias_source_key: "lock", default_aliases: &["lk"], + default_permission: 8, } } } diff --git a/src/commands/lockall.rs b/src/commands/admin/lockall.rs similarity index 96% rename from src/commands/lockall.rs rename to src/commands/admin/lockall.rs index 7f1e7d5..98164e4 100644 --- a/src/commands/lockall.rs +++ b/src/commands/admin/lockall.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for LockallCommand { examples: &["+lockall"], alias_source_key: "lockall", default_aliases: &["lka"], + default_permission: 8, } } } diff --git a/src/commands/massiverole.rs b/src/commands/admin/massiverole.rs similarity index 96% rename from src/commands/massiverole.rs rename to src/commands/admin/massiverole.rs index ba63889..ba248a9 100644 --- a/src/commands/massiverole.rs +++ b/src/commands/admin/massiverole.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for MassiveRoleCommand { examples: &["+massiverole @VIP", "+massiverole @VIP @Membres"], alias_source_key: "massiverole", default_aliases: &["mrole", "mr"], + default_permission: 8, } } } diff --git a/src/commands/messagelog.rs b/src/commands/admin/messagelog.rs similarity index 96% rename from src/commands/messagelog.rs rename to src/commands/admin/messagelog.rs index 684a7e3..0b3b905 100644 --- a/src/commands/messagelog.rs +++ b/src/commands/admin/messagelog.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for MessagelogCommand { examples: &["+messagelog on #logs", "+messagelog off"], alias_source_key: "messagelog", default_aliases: &["msglog"], + default_permission: 8, } } } diff --git a/src/commands/modlog.rs b/src/commands/admin/modlog.rs similarity index 96% rename from src/commands/modlog.rs rename to src/commands/admin/modlog.rs index 16b57fb..eaf2da7 100644 --- a/src/commands/modlog.rs +++ b/src/commands/admin/modlog.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for ModlogCommand { examples: &["+modlog on #logs", "+modlog off"], alias_source_key: "modlog", default_aliases: &["mlog"], + default_permission: 8, } } } diff --git a/src/commands/mute.rs b/src/commands/admin/mute.rs similarity index 96% rename from src/commands/mute.rs rename to src/commands/admin/mute.rs index c128006..0bf69da 100644 --- a/src/commands/mute.rs +++ b/src/commands/admin/mute.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for MuteCommand { examples: &["+mute @User abus"], alias_source_key: "mute", default_aliases: &["tmute"], + default_permission: 8, } } } diff --git a/src/commands/mutelist.rs b/src/commands/admin/mutelist.rs similarity index 96% rename from src/commands/mutelist.rs rename to src/commands/admin/mutelist.rs index 584a076..63fbe1e 100644 --- a/src/commands/mutelist.rs +++ b/src/commands/admin/mutelist.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for MutelistCommand { examples: &["+mutelist"], alias_source_key: "mutelist", default_aliases: &["ml"], + default_permission: 8, } } } diff --git a/src/commands/newsticker.rs b/src/commands/admin/newsticker.rs similarity index 96% rename from src/commands/newsticker.rs rename to src/commands/admin/newsticker.rs index 30e37a0..ed44891 100644 --- a/src/commands/newsticker.rs +++ b/src/commands/admin/newsticker.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for NewStickerCommand { examples: &["+newsticker cool_pack"], alias_source_key: "newsticker", default_aliases: &["stcreate", "nst"], + default_permission: 8, } } } diff --git a/src/commands/nolog.rs b/src/commands/admin/nolog.rs similarity index 96% rename from src/commands/nolog.rs rename to src/commands/admin/nolog.rs index 6cd374f..9e01541 100644 --- a/src/commands/nolog.rs +++ b/src/commands/admin/nolog.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for NologCommand { examples: &["+nolog add #secret all", "+nolog del #secret message"], alias_source_key: "nolog", default_aliases: &["nlg"], + default_permission: 8, } } } diff --git a/src/commands/owner.rs b/src/commands/admin/owner.rs similarity index 98% rename from src/commands/owner.rs rename to src/commands/admin/owner.rs index c331879..21e69ba 100644 --- a/src/commands/owner.rs +++ b/src/commands/admin/owner.rs @@ -54,6 +54,7 @@ impl crate::commands::command_contract::CommandSpec for OwnerCommand { examples: &["+owner", "+or", "+help owner"], alias_source_key: "owner", default_aliases: &["own"], + default_permission: 9, } } } diff --git a/src/commands/raidlog.rs b/src/commands/admin/raidlog.rs similarity index 96% rename from src/commands/raidlog.rs rename to src/commands/admin/raidlog.rs index 20f0e0b..71a8889 100644 --- a/src/commands/raidlog.rs +++ b/src/commands/admin/raidlog.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for RaidlogCommand { examples: &["+raidlog #logs", "+raidlog off"], alias_source_key: "raidlog", default_aliases: &["rdlog"], + default_permission: 8, } } } diff --git a/src/commands/rename.rs b/src/commands/admin/rename.rs similarity index 100% rename from src/commands/rename.rs rename to src/commands/admin/rename.rs diff --git a/src/commands/renew.rs b/src/commands/admin/renew.rs similarity index 96% rename from src/commands/renew.rs rename to src/commands/admin/renew.rs index cce69b5..631a48e 100644 --- a/src/commands/renew.rs +++ b/src/commands/admin/renew.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for RenewCommand { examples: &["+renew", "+renew #general"], alias_source_key: "renew", default_aliases: &["nuke", "rebuildch"], + default_permission: 8, } } } diff --git a/src/commands/reroll.rs b/src/commands/admin/reroll.rs similarity index 96% rename from src/commands/reroll.rs rename to src/commands/admin/reroll.rs index f937108..32b21d9 100644 --- a/src/commands/reroll.rs +++ b/src/commands/admin/reroll.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for RerollCommand { examples: &["+reroll"], alias_source_key: "reroll", default_aliases: &["rro", "greroll"], + default_permission: 8, } } } diff --git a/src/commands/rolelog.rs b/src/commands/admin/rolelog.rs similarity index 96% rename from src/commands/rolelog.rs rename to src/commands/admin/rolelog.rs index 680e54d..fe83af5 100644 --- a/src/commands/rolelog.rs +++ b/src/commands/admin/rolelog.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for RolelogCommand { examples: &["+rolelog on #logs", "+rolelog off"], alias_source_key: "rolelog", default_aliases: &["rlog"], + default_permission: 8, } } } diff --git a/src/commands/sanctions.rs b/src/commands/admin/sanctions.rs similarity index 96% rename from src/commands/sanctions.rs rename to src/commands/admin/sanctions.rs index 3b8f7de..ad7daca 100644 --- a/src/commands/sanctions.rs +++ b/src/commands/admin/sanctions.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for SanctionsCommand { examples: &["+sanctions @User"], alias_source_key: "sanctions", default_aliases: &["sanct"], + default_permission: 8, } } } diff --git a/src/commands/say.rs b/src/commands/admin/say.rs similarity index 97% rename from src/commands/say.rs rename to src/commands/admin/say.rs index 1647807..8f6ed13 100644 --- a/src/commands/say.rs +++ b/src/commands/admin/say.rs @@ -36,6 +36,7 @@ impl crate::commands::command_contract::CommandSpec for SayCommand { examples: &["+say", "+sy", "+help say"], alias_source_key: "say", default_aliases: &["sym"], + default_permission: 8, } } } diff --git a/src/commands/set_boostembed.rs b/src/commands/admin/set_boostembed.rs similarity index 96% rename from src/commands/set_boostembed.rs rename to src/commands/admin/set_boostembed.rs index 8663aa9..2fe9b46 100644 --- a/src/commands/set_boostembed.rs +++ b/src/commands/admin/set_boostembed.rs @@ -25,6 +25,7 @@ impl crate::commands::command_contract::CommandSpec for SetBoostembedCommand { ], alias_source_key: "set_boostembed", default_aliases: &["sboostembed"], + default_permission: 8, } } } diff --git a/src/commands/set_modlogs.rs b/src/commands/admin/set_modlogs.rs similarity index 96% rename from src/commands/set_modlogs.rs rename to src/commands/admin/set_modlogs.rs index 2933c6e..67d8516 100644 --- a/src/commands/set_modlogs.rs +++ b/src/commands/admin/set_modlogs.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for SetModlogsCommand { examples: &["+set modlogs", "+set modlogs warn off"], alias_source_key: "set_modlogs", default_aliases: &["smodlog"], + default_permission: 8, } } } diff --git a/src/commands/suggestion.rs b/src/commands/admin/suggestion.rs similarity index 100% rename from src/commands/suggestion.rs rename to src/commands/admin/suggestion.rs diff --git a/src/commands/sync.rs b/src/commands/admin/sync.rs similarity index 96% rename from src/commands/sync.rs rename to src/commands/admin/sync.rs index 3c4b992..36b9fdf 100644 --- a/src/commands/sync.rs +++ b/src/commands/admin/sync.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for SyncCommand { examples: &["+sync all", "+sync #general"], alias_source_key: "sync", default_aliases: &["chsync"], + default_permission: 8, } } } diff --git a/src/commands/tempban.rs b/src/commands/admin/tempban.rs similarity index 96% rename from src/commands/tempban.rs rename to src/commands/admin/tempban.rs index b5a0142..3a69eff 100644 --- a/src/commands/tempban.rs +++ b/src/commands/admin/tempban.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for TempbanCommand { examples: &["+tempban @User 1d"], alias_source_key: "tempban", default_aliases: &["tb"], + default_permission: 8, } } } diff --git a/src/commands/tempcmute.rs b/src/commands/admin/tempcmute.rs similarity index 96% rename from src/commands/tempcmute.rs rename to src/commands/admin/tempcmute.rs index 536f175..29142cd 100644 --- a/src/commands/tempcmute.rs +++ b/src/commands/admin/tempcmute.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for TempcmuteCommand { examples: &["+tempcmute @User 5m"], alias_source_key: "tempcmute", default_aliases: &["tcm"], + default_permission: 8, } } } diff --git a/src/commands/tempmute.rs b/src/commands/admin/tempmute.rs similarity index 96% rename from src/commands/tempmute.rs rename to src/commands/admin/tempmute.rs index 94b351a..3213aee 100644 --- a/src/commands/tempmute.rs +++ b/src/commands/admin/tempmute.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for TempmuteCommand { examples: &["+tempmute @User 10m"], alias_source_key: "tempmute", default_aliases: &["tm"], + default_permission: 8, } } } diff --git a/src/commands/temprole.rs b/src/commands/admin/temprole.rs similarity index 96% rename from src/commands/temprole.rs rename to src/commands/admin/temprole.rs index 333c52a..d2162a2 100644 --- a/src/commands/temprole.rs +++ b/src/commands/admin/temprole.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for TempRoleCommand { examples: &["+temprole @User @VIP 2h"], alias_source_key: "temprole", default_aliases: &["trole", "tmprole"], + default_permission: 8, } } } diff --git a/src/commands/tempvoc.rs b/src/commands/admin/tempvoc.rs similarity index 100% rename from src/commands/tempvoc.rs rename to src/commands/admin/tempvoc.rs diff --git a/src/commands/tempvoc_cmd.rs b/src/commands/admin/tempvoc_cmd.rs similarity index 100% rename from src/commands/tempvoc_cmd.rs rename to src/commands/admin/tempvoc_cmd.rs diff --git a/src/commands/ticket.rs b/src/commands/admin/ticket.rs similarity index 100% rename from src/commands/ticket.rs rename to src/commands/admin/ticket.rs diff --git a/src/commands/ticket_member.rs b/src/commands/admin/ticket_member.rs similarity index 100% rename from src/commands/ticket_member.rs rename to src/commands/admin/ticket_member.rs diff --git a/src/commands/tickets.rs b/src/commands/admin/tickets.rs similarity index 100% rename from src/commands/tickets.rs rename to src/commands/admin/tickets.rs diff --git a/src/commands/unban.rs b/src/commands/admin/unban.rs similarity index 96% rename from src/commands/unban.rs rename to src/commands/admin/unban.rs index 093421d..64349a0 100644 --- a/src/commands/unban.rs +++ b/src/commands/admin/unban.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for UnbanCommand { examples: &["+unban @User"], alias_source_key: "unban", default_aliases: &["ub"], + default_permission: 8, } } } diff --git a/src/commands/unbanall.rs b/src/commands/admin/unbanall.rs similarity index 96% rename from src/commands/unbanall.rs rename to src/commands/admin/unbanall.rs index 4b7504b..ec098fc 100644 --- a/src/commands/unbanall.rs +++ b/src/commands/admin/unbanall.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for UnbanAllCommand { examples: &["+unbanall"], alias_source_key: "unbanall", default_aliases: &["uball", "clearbans"], + default_permission: 8, } } } diff --git a/src/commands/unbl.rs b/src/commands/admin/unbl.rs similarity index 98% rename from src/commands/unbl.rs rename to src/commands/admin/unbl.rs index b22d490..98f1ad8 100644 --- a/src/commands/unbl.rs +++ b/src/commands/admin/unbl.rs @@ -74,6 +74,7 @@ impl crate::commands::command_contract::CommandSpec for UnblCommand { examples: &["+unbl", "+ul", "+help unbl"], alias_source_key: "unbl", default_aliases: &["unb"], + default_permission: 9, } } } diff --git a/src/commands/uncmute.rs b/src/commands/admin/uncmute.rs similarity index 96% rename from src/commands/uncmute.rs rename to src/commands/admin/uncmute.rs index d2c3f8c..035b390 100644 --- a/src/commands/uncmute.rs +++ b/src/commands/admin/uncmute.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for UncmuteCommand { examples: &["+uncmute @User"], alias_source_key: "uncmute", default_aliases: &["ucm"], + default_permission: 8, } } } diff --git a/src/commands/unhide.rs b/src/commands/admin/unhide.rs similarity index 96% rename from src/commands/unhide.rs rename to src/commands/admin/unhide.rs index 4960e2b..95aded9 100644 --- a/src/commands/unhide.rs +++ b/src/commands/admin/unhide.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for UnhideCommand { examples: &["+unhide", "+unhide #general"], alias_source_key: "unhide", default_aliases: &["uhd"], + default_permission: 8, } } } diff --git a/src/commands/unhideall.rs b/src/commands/admin/unhideall.rs similarity index 96% rename from src/commands/unhideall.rs rename to src/commands/admin/unhideall.rs index 741d9a8..90a3512 100644 --- a/src/commands/unhideall.rs +++ b/src/commands/admin/unhideall.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for UnhideallCommand { examples: &["+unhideall"], alias_source_key: "unhideall", default_aliases: &["uhda"], + default_permission: 8, } } } diff --git a/src/commands/unlock.rs b/src/commands/admin/unlock.rs similarity index 96% rename from src/commands/unlock.rs rename to src/commands/admin/unlock.rs index d90d224..7609294 100644 --- a/src/commands/unlock.rs +++ b/src/commands/admin/unlock.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for UnlockCommand { examples: &["+unlock", "+unlock #general"], alias_source_key: "unlock", default_aliases: &["ulk"], + default_permission: 8, } } } diff --git a/src/commands/unlockall.rs b/src/commands/admin/unlockall.rs similarity index 96% rename from src/commands/unlockall.rs rename to src/commands/admin/unlockall.rs index be92b87..e8ca248 100644 --- a/src/commands/unlockall.rs +++ b/src/commands/admin/unlockall.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for UnlockallCommand { examples: &["+unlockall"], alias_source_key: "unlockall", default_aliases: &["ulka"], + default_permission: 8, } } } diff --git a/src/commands/unmassiverole.rs b/src/commands/admin/unmassiverole.rs similarity index 96% rename from src/commands/unmassiverole.rs rename to src/commands/admin/unmassiverole.rs index 8dbeddc..de8c0f6 100644 --- a/src/commands/unmassiverole.rs +++ b/src/commands/admin/unmassiverole.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for UnMassiveRoleCommand { examples: &["+unmassiverole @VIP", "+unmassiverole @VIP @Membres"], alias_source_key: "unmassiverole", default_aliases: &["umrole", "umr"], + default_permission: 8, } } } diff --git a/src/commands/unmute.rs b/src/commands/admin/unmute.rs similarity index 96% rename from src/commands/unmute.rs rename to src/commands/admin/unmute.rs index 2b63c75..5856cc9 100644 --- a/src/commands/unmute.rs +++ b/src/commands/admin/unmute.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for UnmuteCommand { examples: &["+unmute @User"], alias_source_key: "unmute", default_aliases: &["um"], + default_permission: 8, } } } diff --git a/src/commands/unmuteall.rs b/src/commands/admin/unmuteall.rs similarity index 96% rename from src/commands/unmuteall.rs rename to src/commands/admin/unmuteall.rs index 4ad69de..3afa3a7 100644 --- a/src/commands/unmuteall.rs +++ b/src/commands/admin/unmuteall.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for UnmuteallCommand { examples: &["+unmuteall"], alias_source_key: "unmuteall", default_aliases: &["uma"], + default_permission: 8, } } } diff --git a/src/commands/unowner.rs b/src/commands/admin/unowner.rs similarity index 98% rename from src/commands/unowner.rs rename to src/commands/admin/unowner.rs index 50c7b8a..4389435 100644 --- a/src/commands/unowner.rs +++ b/src/commands/admin/unowner.rs @@ -83,6 +83,7 @@ impl crate::commands::command_contract::CommandSpec for UnownerCommand { examples: &["+unowner", "+ur", "+help unowner"], alias_source_key: "unowner", default_aliases: &["uow"], + default_permission: 9, } } } diff --git a/src/commands/untemprole.rs b/src/commands/admin/untemprole.rs similarity index 96% rename from src/commands/untemprole.rs rename to src/commands/admin/untemprole.rs index b59d41c..5a28168 100644 --- a/src/commands/untemprole.rs +++ b/src/commands/admin/untemprole.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for UnTempRoleCommand { examples: &["+untemprole @User @VIP"], alias_source_key: "untemprole", default_aliases: &["untrole", "deltrole"], + default_permission: 8, } } } diff --git a/src/commands/voicekick.rs b/src/commands/admin/voicekick.rs similarity index 96% rename from src/commands/voicekick.rs rename to src/commands/admin/voicekick.rs index 5edb46b..3fa9f97 100644 --- a/src/commands/voicekick.rs +++ b/src/commands/admin/voicekick.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for VoiceKickCommand { examples: &["+voicekick @User", "+voicekick @U1 @U2"], alias_source_key: "voicekick", default_aliases: &["vk", "vdisconnect"], + default_permission: 8, } } } diff --git a/src/commands/voicelog.rs b/src/commands/admin/voicelog.rs similarity index 96% rename from src/commands/voicelog.rs rename to src/commands/admin/voicelog.rs index 48bb553..79d7028 100644 --- a/src/commands/voicelog.rs +++ b/src/commands/admin/voicelog.rs @@ -21,6 +21,7 @@ impl crate::commands::command_contract::CommandSpec for VoicelogCommand { examples: &["+voicelog on #logs", "+voicelog off"], alias_source_key: "voicelog", default_aliases: &["vlog"], + default_permission: 8, } } } diff --git a/src/commands/voicemove.rs b/src/commands/admin/voicemove.rs similarity index 96% rename from src/commands/voicemove.rs rename to src/commands/admin/voicemove.rs index f1f2cde..41e5249 100644 --- a/src/commands/voicemove.rs +++ b/src/commands/admin/voicemove.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for VoiceMoveCommand { examples: &["+voicemove #General #Event"], alias_source_key: "voicemove", default_aliases: &["vmove", "vmoveall"], + default_permission: 8, } } } diff --git a/src/commands/warn.rs b/src/commands/admin/warn.rs similarity index 96% rename from src/commands/warn.rs rename to src/commands/admin/warn.rs index 205a602..effadee 100644 --- a/src/commands/warn.rs +++ b/src/commands/admin/warn.rs @@ -18,6 +18,7 @@ impl crate::commands::command_contract::CommandSpec for WarnCommand { examples: &["+warn @User spam"], alias_source_key: "warn", default_aliases: &["avert"], + default_permission: 8, } } } diff --git a/src/commands/command_contract.rs b/src/commands/command_contract.rs index 4bbcb76..697baf7 100644 --- a/src/commands/command_contract.rs +++ b/src/commands/command_contract.rs @@ -3,6 +3,7 @@ pub struct CommandMetadata { pub key: &'static str, pub command: &'static str, pub category: &'static str, + pub default_permission: u8, pub params: &'static str, pub summary: &'static str, pub description: &'static str, diff --git a/src/commands/alladmins.rs b/src/commands/general/alladmins.rs similarity index 99% rename from src/commands/alladmins.rs rename to src/commands/general/alladmins.rs index b160173..7576c61 100644 --- a/src/commands/alladmins.rs +++ b/src/commands/general/alladmins.rs @@ -145,6 +145,7 @@ impl crate::commands::command_contract::CommandSpec for AlladminsCommand { examples: &["+alladmins", "+as", "+help alladmins"], alias_source_key: "alladmins", default_aliases: &["aad"], + default_permission: 0, } } } diff --git a/src/commands/allbots.rs b/src/commands/general/allbots.rs similarity index 99% rename from src/commands/allbots.rs rename to src/commands/general/allbots.rs index 341446b..9884d7f 100644 --- a/src/commands/allbots.rs +++ b/src/commands/general/allbots.rs @@ -128,6 +128,7 @@ impl crate::commands::command_contract::CommandSpec for AllbotsCommand { examples: &["+allbots", "+as", "+help allbots"], alias_source_key: "allbots", default_aliases: &["abt"], + default_permission: 0, } } } diff --git a/src/commands/banner.rs b/src/commands/general/banner.rs similarity index 98% rename from src/commands/banner.rs rename to src/commands/general/banner.rs index c007b04..6f2000a 100644 --- a/src/commands/banner.rs +++ b/src/commands/general/banner.rs @@ -73,6 +73,7 @@ impl crate::commands::command_contract::CommandSpec for BannerCommand { examples: &["+banner", "+br", "+help banner"], alias_source_key: "banner", default_aliases: &["bnr"], + default_permission: 0, } } } diff --git a/src/commands/boosters.rs b/src/commands/general/boosters.rs similarity index 99% rename from src/commands/boosters.rs rename to src/commands/general/boosters.rs index 83083bf..6738132 100644 --- a/src/commands/boosters.rs +++ b/src/commands/general/boosters.rs @@ -140,6 +140,7 @@ impl crate::commands::command_contract::CommandSpec for BoostersCommand { examples: &["+boosters", "+bs", "+help boosters"], alias_source_key: "boosters", default_aliases: &["bst"], + default_permission: 0, } } } diff --git a/src/commands/botadmins.rs b/src/commands/general/botadmins.rs similarity index 99% rename from src/commands/botadmins.rs rename to src/commands/general/botadmins.rs index 8c1db44..2ea04dc 100644 --- a/src/commands/botadmins.rs +++ b/src/commands/general/botadmins.rs @@ -144,6 +144,7 @@ impl crate::commands::command_contract::CommandSpec for BotadminsCommand { examples: &["+botadmins", "+bs", "+help botadmins"], alias_source_key: "botadmins", default_aliases: &["bad"], + default_permission: 0, } } } diff --git a/src/commands/calc.rs b/src/commands/general/calc.rs similarity index 98% rename from src/commands/calc.rs rename to src/commands/general/calc.rs index fdde5f3..9fed8cf 100644 --- a/src/commands/calc.rs +++ b/src/commands/general/calc.rs @@ -103,6 +103,7 @@ impl crate::commands::command_contract::CommandSpec for CalcCommand { examples: &["+calc", "+cc", "+help calc"], alias_source_key: "calc", default_aliases: &["clc"], + default_permission: 0, } } } diff --git a/src/commands/channel.rs b/src/commands/general/channel.rs similarity index 99% rename from src/commands/channel.rs rename to src/commands/general/channel.rs index 39513e1..ac26077 100644 --- a/src/commands/channel.rs +++ b/src/commands/general/channel.rs @@ -107,6 +107,7 @@ impl crate::commands::command_contract::CommandSpec for ChannelCommand { examples: &["+channel", "+cl", "+help channel"], alias_source_key: "channel", default_aliases: &["chl"], + default_permission: 0, } } } diff --git a/src/commands/choose.rs b/src/commands/general/choose.rs similarity index 96% rename from src/commands/choose.rs rename to src/commands/general/choose.rs index 4bed721..6d1a8b7 100644 --- a/src/commands/choose.rs +++ b/src/commands/general/choose.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for ChooseCommand { examples: &["+choose rouge | bleu | vert"], alias_source_key: "choose", default_aliases: &["pick", "random"], + default_permission: 8, } } } diff --git a/src/commands/emoji.rs b/src/commands/general/emoji.rs similarity index 98% rename from src/commands/emoji.rs rename to src/commands/general/emoji.rs index 3425650..906a0e7 100644 --- a/src/commands/emoji.rs +++ b/src/commands/general/emoji.rs @@ -92,6 +92,7 @@ impl crate::commands::command_contract::CommandSpec for EmojiCommand { examples: &["+emoji", "+ei", "+help emoji"], alias_source_key: "emoji", default_aliases: &["emj"], + default_permission: 0, } } } diff --git a/src/commands/help.rs b/src/commands/general/help.rs similarity index 97% rename from src/commands/help.rs rename to src/commands/general/help.rs index 5c75643..3cece1c 100644 --- a/src/commands/help.rs +++ b/src/commands/general/help.rs @@ -17,7 +17,6 @@ use crate::db::{ DbPoolKey, get_help_aliases_enabled, get_help_perms_enabled, get_help_type, list_command_aliases, }; -use crate::permissions; #[derive(Clone, Copy, Debug, PartialEq, Eq)] enum HelpLayout { @@ -55,6 +54,7 @@ struct HelpPage { struct CommandDoc { key: &'static str, command: &'static str, + default_permission: u8, params: &'static str, summary: &'static str, description: &'static str, @@ -161,8 +161,8 @@ fn help_page_for_command( "owner" | "unowner" | "clear_owners" | "bl" | "unbl" | "blinfo" | "clear_bl" | "allbots" | "alladmins" | "botadmins" | "mainprefix" | "prefix" | "mp" | "invite" | "leave" | "discussion" => "administration", - "perms" | "del" | "clear_perms" | "allperms" | "alias" | "help" | "helptype" - | "helpalias" => "permissions", + "perms" | "del" | "clear_perms" | "allperms" | "alias" | "help" + | "helpsetting" => "permissions", _ => match meta.category { "general" => "infos", "profile" => "bot", @@ -311,6 +311,7 @@ fn command_doc(key: &str) -> Option { Some(CommandDoc { key: meta.key, command: meta.command, + default_permission: meta.default_permission, params: meta.params, summary: meta.summary, description: meta.description, @@ -418,7 +419,7 @@ fn help_lookup_to_key(input: &str) -> Option<&'static str> { "del perm" => Some("del_perm"), "clear perms" => Some("clear_perms"), "alias" => Some("alias"), - "helpsetting" => Some("helpsetting"), + "helpsetting" | "helpetting" => Some("helpsetting"), _ => None, }; @@ -474,7 +475,7 @@ fn help_page_content( let summary = meta.summary; let alias_key = meta.alias_source_key; let permission = if perms_enabled { - format!(" {}", format_permission_level(permissions::default_permission(meta.key))) + format!(" {}", format_permission_level(meta.default_permission)) } else { String::new() }; @@ -740,18 +741,26 @@ pub async fn handle_help(ctx: &Context, msg: &Message, args: &[&str]) { .collect::>() .join("\n"); - let embed = CreateEmbed::new() + let mut embed = CreateEmbed::new() .title(format!("Aide commande · +{}", doc.command)) .description(doc.description) .field("Commande", format!("`+{}`", doc.command), false) .field("Clé ACL", format!("`{}`", doc.key), false) .field("Catégorie", help_page_title_for_command_key(doc.key), false) - .field("Permission", permission_level_description(permissions::default_permission(doc.key)), false) .field("Alias", alias_text, false) .field("Paramètres", doc.params, false) .field("Résumé", doc.summary, false) - .field("Exemples", truncate_text(&examples, 1024), false) - .color(crate::commands::common::theme_color(ctx).await); + .field("Exemples", truncate_text(&examples, 1024), false); + + if state.perms_enabled { + embed = embed.field( + "Permission", + permission_level_description(doc.default_permission), + false, + ); + } + + embed = embed.color(crate::commands::common::theme_color(ctx).await); let _ = msg .channel_id @@ -794,6 +803,7 @@ impl crate::commands::command_contract::CommandSpec for HelpCommand { examples: &["+help", "+hp", "+help help"], alias_source_key: "help", default_aliases: &["hp"], + default_permission: 0, } } } diff --git a/src/commands/loading.rs b/src/commands/general/loading.rs similarity index 96% rename from src/commands/loading.rs rename to src/commands/general/loading.rs index 1c33287..6e74fe1 100644 --- a/src/commands/loading.rs +++ b/src/commands/general/loading.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for LoadingCommand { examples: &["+loading 10s Traitement en cours"], alias_source_key: "loading", default_aliases: &["loadbar", "bar"], + default_permission: 8, } } } diff --git a/src/commands/member.rs b/src/commands/general/member.rs similarity index 98% rename from src/commands/member.rs rename to src/commands/general/member.rs index 5fae9e5..8b43a39 100644 --- a/src/commands/member.rs +++ b/src/commands/general/member.rs @@ -86,6 +86,7 @@ impl crate::commands::command_contract::CommandSpec for MemberCommand { examples: &["+member", "+mr", "+help member"], alias_source_key: "member", default_aliases: &["mbr"], + default_permission: 0, } } } diff --git a/src/commands/pic.rs b/src/commands/general/pic.rs similarity index 98% rename from src/commands/pic.rs rename to src/commands/general/pic.rs index 886a246..65f084a 100644 --- a/src/commands/pic.rs +++ b/src/commands/general/pic.rs @@ -73,6 +73,7 @@ impl crate::commands::command_contract::CommandSpec for PicCommand { examples: &["+pic", "+pc", "+help pic"], alias_source_key: "pic", default_aliases: &["pfp"], + default_permission: 0, } } } diff --git a/src/commands/ping.rs b/src/commands/general/ping.rs similarity index 98% rename from src/commands/ping.rs rename to src/commands/general/ping.rs index 5430bce..d79a19f 100644 --- a/src/commands/ping.rs +++ b/src/commands/general/ping.rs @@ -59,6 +59,7 @@ impl crate::commands::command_contract::CommandSpec for PingCommand { examples: &["+ping", "+pg", "+help ping"], alias_source_key: "ping", default_aliases: &["pg"], + default_permission: 0, } } } diff --git a/src/commands/role.rs b/src/commands/general/role.rs similarity index 98% rename from src/commands/role.rs rename to src/commands/general/role.rs index f668bdc..e7fafc3 100644 --- a/src/commands/role.rs +++ b/src/commands/general/role.rs @@ -101,6 +101,7 @@ impl crate::commands::command_contract::CommandSpec for RoleCommand { examples: &["+role", "+re", "+help role"], alias_source_key: "role", default_aliases: &["rol"], + default_permission: 0, } } } diff --git a/src/commands/rolemembers.rs b/src/commands/general/rolemembers.rs similarity index 98% rename from src/commands/rolemembers.rs rename to src/commands/general/rolemembers.rs index b09059a..ce5bad6 100644 --- a/src/commands/rolemembers.rs +++ b/src/commands/general/rolemembers.rs @@ -95,6 +95,7 @@ impl crate::commands::command_contract::CommandSpec for RolemembersCommand { examples: &["+rolemembers", "+rs", "+help rolemembers"], alias_source_key: "rolemembers", default_aliases: &["rmb"], + default_permission: 0, } } } diff --git a/src/commands/server.rs b/src/commands/general/server.rs similarity index 99% rename from src/commands/server.rs rename to src/commands/general/server.rs index 993cfeb..ddc20f6 100644 --- a/src/commands/server.rs +++ b/src/commands/general/server.rs @@ -166,6 +166,7 @@ impl crate::commands::command_contract::CommandSpec for ServerCommand { examples: &["+server", "+sr", "+help server"], alias_source_key: "server", default_aliases: &["srv"], + default_permission: 0, } } } diff --git a/src/commands/serverinfo.rs b/src/commands/general/serverinfo.rs similarity index 98% rename from src/commands/serverinfo.rs rename to src/commands/general/serverinfo.rs index da00528..5d6e863 100644 --- a/src/commands/serverinfo.rs +++ b/src/commands/general/serverinfo.rs @@ -67,6 +67,7 @@ impl crate::commands::command_contract::CommandSpec for ServerinfoCommand { examples: &["+serverinfo", "+so", "+help serverinfo"], alias_source_key: "serverinfo", default_aliases: &["svi"], + default_permission: 0, } } } diff --git a/src/commands/shadowbot.rs b/src/commands/general/shadowbot.rs similarity index 97% rename from src/commands/shadowbot.rs rename to src/commands/general/shadowbot.rs index 251081d..f083e64 100644 --- a/src/commands/shadowbot.rs +++ b/src/commands/general/shadowbot.rs @@ -31,6 +31,7 @@ impl crate::commands::command_contract::CommandSpec for ShadowbotCommand { examples: &["+shadowbot", "+st", "+help shadowbot"], alias_source_key: "shadowbot", default_aliases: &["sbt"], + default_permission: 0, } } } diff --git a/src/commands/showpics.rs b/src/commands/general/showpics.rs similarity index 100% rename from src/commands/showpics.rs rename to src/commands/general/showpics.rs diff --git a/src/commands/snipe.rs b/src/commands/general/snipe.rs similarity index 98% rename from src/commands/snipe.rs rename to src/commands/general/snipe.rs index ce0cfb9..1c8f980 100644 --- a/src/commands/snipe.rs +++ b/src/commands/general/snipe.rs @@ -78,6 +78,7 @@ impl crate::commands::command_contract::CommandSpec for SnipeCommand { examples: &["+snipe", "+se", "+help snipe"], alias_source_key: "snipe", default_aliases: &["snp"], + default_permission: 0, } } } diff --git a/src/commands/user.rs b/src/commands/general/user.rs similarity index 98% rename from src/commands/user.rs rename to src/commands/general/user.rs index 4e8c77a..802b146 100644 --- a/src/commands/user.rs +++ b/src/commands/general/user.rs @@ -73,6 +73,7 @@ impl crate::commands::command_contract::CommandSpec for UserCommand { examples: &["+user", "+ur", "+help user"], alias_source_key: "user", default_aliases: &["usr"], + default_permission: 0, } } } diff --git a/src/commands/vocinfo.rs b/src/commands/general/vocinfo.rs similarity index 98% rename from src/commands/vocinfo.rs rename to src/commands/general/vocinfo.rs index 9897320..d9972c3 100644 --- a/src/commands/vocinfo.rs +++ b/src/commands/general/vocinfo.rs @@ -77,6 +77,7 @@ impl crate::commands::command_contract::CommandSpec for VocinfoCommand { examples: &["+vocinfo", "+vo", "+help vocinfo"], alias_source_key: "vocinfo", default_aliases: &["vci"], + default_permission: 0, } } } diff --git a/src/commands/helpsetting.rs b/src/commands/helpsetting.rs deleted file mode 100644 index 5823802..0000000 --- a/src/commands/helpsetting.rs +++ /dev/null @@ -1,180 +0,0 @@ -use serenity::model::prelude::*; -use serenity::prelude::*; - -use crate::commands::common::send_embed; -use crate::db::{ - DbPoolKey, get_help_aliases_enabled, get_help_perms_enabled, get_help_type, - set_help_aliases_enabled, set_help_perms_enabled, set_help_type, -}; - -pub async fn handle_helpsetting(ctx: &Context, msg: &Message, args: &[&str]) { - let bot_id = ctx.cache.current_user().id; - let Some(pool) = pool(ctx).await else { - let embed = serenity::builder::CreateEmbed::new() - .title("Erreur") - .description("DB indisponible.") - .color(0xED4245); - send_embed(ctx, msg, embed).await; - return; - }; - - if args.is_empty() { - let help_type = get_help_type(&pool, bot_id) - .await - .ok() - .flatten() - .unwrap_or_else(|| "button".to_string()); - let help_aliases = get_help_aliases_enabled(&pool, bot_id) - .await - .ok() - .flatten() - .unwrap_or(true); - let help_perms = get_help_perms_enabled(&pool, bot_id) - .await - .ok() - .flatten() - .unwrap_or(true); - - let embed = serenity::builder::CreateEmbed::new() - .title("Configuration de l'aide") - .description("Paramètres actuels:") - .field("Mode d'affichage", format!("`{}`", help_type), true) - .field("Aliases", format!("`{}`", if help_aliases { "on" } else { "off" }), true) - .field( - "Permissions", - format!("`{}`", if help_perms { "on" } else { "off" }), - true, - ) - .color(0x5865F2); - send_embed(ctx, msg, embed).await; - return; - } - - match args[0].to_lowercase().as_str() { - "type" | "mode" => { - if args.len() < 2 { - let embed = serenity::builder::CreateEmbed::new() - .title("Erreur") - .description("Usage: `+helpsetting type `") - .color(0xED4245); - send_embed(ctx, msg, embed).await; - return; - } - - let normalized = match args[1].to_lowercase().as_str() { - "button" => "button", - "select" => "select", - "hybrid" => "hybrid", - _ => { - let embed = serenity::builder::CreateEmbed::new() - .title("Erreur") - .description("Valeurs valides: `button`, `select`, `hybrid`") - .color(0xED4245); - send_embed(ctx, msg, embed).await; - return; - } - }; - - let _ = set_help_type(&pool, bot_id, normalized).await; - let embed = serenity::builder::CreateEmbed::new() - .title("Mode de help mis à jour") - .description(format!("Nouveau mode: `{}`", normalized)) - .color(0x57F287); - send_embed(ctx, msg, embed).await; - } - "aliases" | "alias" => { - if args.len() < 2 { - let embed = serenity::builder::CreateEmbed::new() - .title("Erreur") - .description("Usage: `+helpsetting aliases `") - .color(0xED4245); - send_embed(ctx, msg, embed).await; - return; - } - - let enabled = match args[1].to_lowercase().as_str() { - "on" | "true" | "yes" => true, - "off" | "false" | "no" => false, - _ => { - let embed = serenity::builder::CreateEmbed::new() - .title("Erreur") - .description("Valeurs valides: `on`, `off`") - .color(0xED4245); - send_embed(ctx, msg, embed).await; - return; - } - }; - - let _ = set_help_aliases_enabled(&pool, bot_id, enabled).await; - let embed = serenity::builder::CreateEmbed::new() - .title("Aliases de help mis à jour") - .description(format!("Aliases: `{}`", if enabled { "on" } else { "off" })) - .color(0x57F287); - send_embed(ctx, msg, embed).await; - } - "perms" | "permissions" => { - if args.len() < 2 { - let embed = serenity::builder::CreateEmbed::new() - .title("Erreur") - .description("Usage: `+helpsetting perms `") - .color(0xED4245); - send_embed(ctx, msg, embed).await; - return; - } - - let enabled = match args[1].to_lowercase().as_str() { - "on" | "true" | "yes" => true, - "off" | "false" | "no" => false, - _ => { - let embed = serenity::builder::CreateEmbed::new() - .title("Erreur") - .description("Valeurs valides: `on`, `off`") - .color(0xED4245); - send_embed(ctx, msg, embed).await; - return; - } - }; - - let _ = set_help_perms_enabled(&pool, bot_id, enabled).await; - let embed = serenity::builder::CreateEmbed::new() - .title("Affichage des permissions mis à jour") - .description(format!( - "Permissions: `{}`", - if enabled { "on" } else { "off" } - )) - .color(0x57F287); - send_embed(ctx, msg, embed).await; - } - _ => { - let embed = serenity::builder::CreateEmbed::new() - .title("Erreur") - .description("Sous-commandes: `type`, `aliases`, `perms`") - .color(0xED4245); - send_embed(ctx, msg, embed).await; - } - } -} - -async fn pool(ctx: &Context) -> Option { - let data = ctx.data.read().await; - data.get::().cloned() -} - -pub struct HelpsettingCommand; -pub static COMMAND_DESCRIPTOR: HelpsettingCommand = HelpsettingCommand; - -impl crate::commands::command_contract::CommandSpec for HelpsettingCommand { - fn metadata(&self) -> crate::commands::command_contract::CommandMetadata { - crate::commands::command_contract::CommandMetadata { - key: "helpsetting", - command: "helpsetting", - category: "permissions", - params: " [value]", - summary: "Configure l'affichage du système d'aide", - description: "Permet de configurer le mode d'affichage, l'affichage des alias et l'affichage des permissions du système d'aide.", - examples: &["+helpsetting", "+helpsetting type hybrid", "+helpsetting perms off"], - alias_source_key: "helpsetting", - default_aliases: &["hs"], - } - } -} diff --git a/src/commands/viewlogs.rs b/src/commands/logs/viewlogs.rs similarity index 99% rename from src/commands/viewlogs.rs rename to src/commands/logs/viewlogs.rs index 20811dd..e73fe27 100644 --- a/src/commands/viewlogs.rs +++ b/src/commands/logs/viewlogs.rs @@ -259,6 +259,7 @@ impl crate::commands::command_contract::CommandSpec for ViewLogsCommand { examples: &["+viewlogs", "+viewlogs 2"], alias_source_key: "viewlogs", default_aliases: &["vlogs", "audit"], + default_permission: 0, } } } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 9d34297..d51c13c 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,146 +1,278 @@ use crate::commands::command_contract::{CommandMetadata, CommandSpec}; +#[path = "admin/addrole.rs"] pub mod addrole; pub mod admin_common; pub mod admin_service; pub mod advanced_tools; +#[path = "permissions/alias.rs"] pub mod alias; +#[path = "general/alladmins.rs"] pub mod alladmins; +#[path = "general/allbots.rs"] pub mod allbots; +#[path = "permissions/allperms.rs"] pub mod allperms; +#[path = "admin/autobackup.rs"] pub mod autobackup; +#[path = "admin/autoconfiglog.rs"] pub mod autoconfiglog; +#[path = "admin/autoreact.rs"] pub mod autoreact; +#[path = "admin/backup.rs"] pub mod backup; +#[path = "admin/ban.rs"] pub mod ban; +#[path = "admin/banlist.rs"] pub mod banlist; +#[path = "general/banner.rs"] pub mod banner; +#[path = "admin/bl.rs"] pub mod bl; +#[path = "admin/blinfo.rs"] pub mod blinfo; +#[path = "admin/boostembed.rs"] pub mod boostembed; +#[path = "general/boosters.rs"] pub mod boosters; +#[path = "admin/boostlog.rs"] pub mod boostlog; +#[path = "general/botadmins.rs"] pub mod botadmins; pub mod botconfig_common; pub mod botconfig_service; +#[path = "admin/bringall.rs"] pub mod bringall; +#[path = "admin/button.rs"] pub mod button; +#[path = "general/calc.rs"] pub mod calc; +#[path = "permissions/change.rs"] pub mod change; +#[path = "permissions/changeall.rs"] pub mod changeall; +#[path = "general/channel.rs"] pub mod channel; +#[path = "general/choose.rs"] pub mod choose; +#[path = "admin/cleanup.rs"] pub mod cleanup; +#[path = "admin/clear_all_sanctions.rs"] pub mod clear_all_sanctions; +#[path = "admin/clear_bl.rs"] pub mod clear_bl; +#[path = "admin/clear_messages.rs"] pub mod clear_messages; +#[path = "admin/clear_owners.rs"] pub mod clear_owners; +#[path = "permissions/clear_perms.rs"] pub mod clear_perms; +#[path = "admin/clear_sanctions.rs"] pub mod clear_sanctions; +#[path = "admin/cmute.rs"] pub mod cmute; pub mod command_contract; pub mod common; +#[path = "profile/compet.rs"] pub mod compet; +#[path = "admin/create.rs"] pub mod create; +#[path = "permissions/del.rs"] pub mod del; +#[path = "admin/del_sanction.rs"] pub mod del_sanction; +#[path = "admin/delrole.rs"] pub mod delrole; +#[path = "admin/derank.rs"] pub mod derank; +#[path = "profile/discussion.rs"] pub mod discussion; +#[path = "profile/dnd.rs"] pub mod dnd; +#[path = "admin/embed.rs"] pub mod embed; +#[path = "general/emoji.rs"] pub mod emoji; +#[path = "admin/end.rs"] pub mod end; +#[path = "admin/giveaway.rs"] pub mod giveaway; +#[path = "general/help.rs"] pub mod help; +#[path = "permissions/helpsetting.rs"] pub mod helpsetting; +#[path = "admin/hide.rs"] pub mod hide; +#[path = "admin/hideall.rs"] pub mod hideall; +#[path = "profile/idle.rs"] pub mod idle; +#[path = "profile/invisible.rs"] pub mod invisible; +#[path = "admin/invite.rs"] pub mod invite; +#[path = "admin/join.rs"] pub mod join; +#[path = "admin/kick.rs"] pub mod kick; +#[path = "admin/leave.rs"] pub mod leave; +#[path = "admin/leave_settings.rs"] pub mod leave_settings; +#[path = "profile/listen.rs"] pub mod listen; +#[path = "general/loading.rs"] pub mod loading; +#[path = "admin/lock.rs"] pub mod lock; +#[path = "admin/lockall.rs"] pub mod lockall; pub mod logs_service; +#[path = "permissions/mainprefix.rs"] pub mod mainprefix; +#[path = "admin/massiverole.rs"] pub mod massiverole; +#[path = "general/member.rs"] pub mod member; +#[path = "admin/messagelog.rs"] pub mod messagelog; pub mod moderation_tools; +#[path = "admin/modlog.rs"] pub mod modlog; +#[path = "profile/mp.rs"] pub mod mp; +#[path = "admin/mute.rs"] pub mod mute; +#[path = "admin/mutelist.rs"] pub mod mutelist; +#[path = "admin/newsticker.rs"] pub mod newsticker; +#[path = "admin/nolog.rs"] pub mod nolog; +#[path = "profile/online.rs"] pub mod online; +#[path = "admin/owner.rs"] pub mod owner; +#[path = "permissions/perms.rs"] pub mod perms; pub mod perms_service; +#[path = "general/pic.rs"] pub mod pic; +#[path = "general/ping.rs"] pub mod ping; +#[path = "profile/playto.rs"] pub mod playto; +#[path = "permissions/prefix.rs"] pub mod prefix; +#[path = "admin/raidlog.rs"] pub mod raidlog; +#[path = "profile/remove_activity.rs"] pub mod remove_activity; +#[path = "admin/renew.rs"] pub mod renew; +#[path = "admin/reroll.rs"] pub mod reroll; +#[path = "general/role.rs"] pub mod role; +#[path = "admin/rolelog.rs"] pub mod rolelog; +#[path = "general/rolemembers.rs"] pub mod rolemembers; +#[path = "admin/sanctions.rs"] pub mod sanctions; +#[path = "admin/say.rs"] pub mod say; +#[path = "general/server.rs"] pub mod server; +#[path = "general/serverinfo.rs"] pub mod serverinfo; +#[path = "profile/set.rs"] pub mod set; +#[path = "admin/set_boostembed.rs"] pub mod set_boostembed; +#[path = "admin/set_modlogs.rs"] pub mod set_modlogs; +#[path = "general/shadowbot.rs"] pub mod shadowbot; +#[path = "general/snipe.rs"] pub mod snipe; +#[path = "profile/stream.rs"] pub mod stream; +#[path = "admin/sync.rs"] pub mod sync; +#[path = "admin/tempban.rs"] pub mod tempban; +#[path = "admin/tempcmute.rs"] pub mod tempcmute; +#[path = "admin/tempmute.rs"] pub mod tempmute; +#[path = "admin/temprole.rs"] pub mod temprole; +#[path = "profile/theme.rs"] pub mod theme; +#[path = "admin/unban.rs"] pub mod unban; +#[path = "admin/unbanall.rs"] pub mod unbanall; +#[path = "admin/unbl.rs"] pub mod unbl; +#[path = "admin/uncmute.rs"] pub mod uncmute; +#[path = "admin/unhide.rs"] pub mod unhide; +#[path = "admin/unhideall.rs"] pub mod unhideall; +#[path = "admin/unlock.rs"] pub mod unlock; +#[path = "admin/unlockall.rs"] pub mod unlockall; +#[path = "admin/unmassiverole.rs"] pub mod unmassiverole; +#[path = "admin/unmute.rs"] pub mod unmute; +#[path = "admin/unmuteall.rs"] pub mod unmuteall; +#[path = "admin/unowner.rs"] pub mod unowner; +#[path = "admin/untemprole.rs"] pub mod untemprole; +#[path = "general/user.rs"] pub mod user; +#[path = "logs/viewlogs.rs"] pub mod viewlogs; +#[path = "general/vocinfo.rs"] pub mod vocinfo; +#[path = "admin/voicekick.rs"] pub mod voicekick; +#[path = "admin/ticket.rs"] pub mod ticket; +#[path = "admin/tickets.rs"] pub mod tickets; +#[path = "general/showpics.rs"] pub mod showpics; +#[path = "admin/suggestion.rs"] pub mod suggestion; +#[path = "admin/autopublish.rs"] pub mod autopublish; +#[path = "admin/tempvoc.rs"] pub mod tempvoc; +#[path = "admin/tempvoc_cmd.rs"] pub mod tempvoc_cmd; +#[path = "admin/voicelog.rs"] pub mod voicelog; +#[path = "admin/voicemove.rs"] pub mod voicemove; +#[path = "admin/warn.rs"] pub mod warn; +#[path = "admin/claim.rs"] pub mod claim; +#[path = "admin/close.rs"] pub mod close; +#[path = "admin/rename.rs"] pub mod rename; +#[path = "admin/ticket_member.rs"] pub mod ticket_member; +#[path = "profile/watch.rs"] pub mod watch; pub fn all_command_metadata() -> Vec { diff --git a/src/commands/alias.rs b/src/commands/permissions/alias.rs similarity index 99% rename from src/commands/alias.rs rename to src/commands/permissions/alias.rs index e50baaa..d3bc8f6 100644 --- a/src/commands/alias.rs +++ b/src/commands/permissions/alias.rs @@ -132,6 +132,7 @@ impl crate::commands::command_contract::CommandSpec for AliasCommand { examples: &["+alias", "+as", "+help alias"], alias_source_key: "alias", default_aliases: &["als"], + default_permission: 9, } } } diff --git a/src/commands/allperms.rs b/src/commands/permissions/allperms.rs similarity index 96% rename from src/commands/allperms.rs rename to src/commands/permissions/allperms.rs index 799d316..4911c5d 100644 --- a/src/commands/allperms.rs +++ b/src/commands/permissions/allperms.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for AllpermsCommand { examples: &["+allperms", "+as", "+help allperms"], alias_source_key: "allperms", default_aliases: &["apm"], + default_permission: 8, } } } diff --git a/src/commands/change.rs b/src/commands/permissions/change.rs similarity index 96% rename from src/commands/change.rs rename to src/commands/permissions/change.rs index a79c3f8..5890017 100644 --- a/src/commands/change.rs +++ b/src/commands/permissions/change.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for ChangeCommand { examples: &["+change", "+ce", "+help change"], alias_source_key: "change", default_aliases: &["chg"], + default_permission: 9, } } } diff --git a/src/commands/changeall.rs b/src/commands/permissions/changeall.rs similarity index 96% rename from src/commands/changeall.rs rename to src/commands/permissions/changeall.rs index 96a0ae4..2589576 100644 --- a/src/commands/changeall.rs +++ b/src/commands/permissions/changeall.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for ChangeallCommand { examples: &["+changeall", "+cl", "+help changeall"], alias_source_key: "changeall", default_aliases: &["cga"], + default_permission: 9, } } } diff --git a/src/commands/clear_perms.rs b/src/commands/permissions/clear_perms.rs similarity index 96% rename from src/commands/clear_perms.rs rename to src/commands/permissions/clear_perms.rs index 023d1da..e12f5b0 100644 --- a/src/commands/clear_perms.rs +++ b/src/commands/permissions/clear_perms.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for ClearPermsCommand { examples: &["+clear perms", "+cs", "+help clear perms"], alias_source_key: "clear_perms", default_aliases: &["cpm"], + default_permission: 9, } } } diff --git a/src/commands/del.rs b/src/commands/permissions/del.rs similarity index 96% rename from src/commands/del.rs rename to src/commands/permissions/del.rs index 463a8ce..670a75b 100644 --- a/src/commands/del.rs +++ b/src/commands/permissions/del.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for DelCommand { examples: &["+del", "+dl", "+help del"], alias_source_key: "del", default_aliases: &["dlp"], + default_permission: 0, } } } diff --git a/src/commands/helpalias.rs b/src/commands/permissions/helpalias.rs similarity index 98% rename from src/commands/helpalias.rs rename to src/commands/permissions/helpalias.rs index e46311b..c9112d2 100644 --- a/src/commands/helpalias.rs +++ b/src/commands/permissions/helpalias.rs @@ -76,6 +76,7 @@ impl crate::commands::command_contract::CommandSpec for HelpaliasCommand { examples: &["+helpalias", "+hs", "+help helpalias"], alias_source_key: "helpalias", default_aliases: &["hal"], + default_permission: 0, } } } diff --git a/src/commands/permissions/helpsetting.rs b/src/commands/permissions/helpsetting.rs new file mode 100644 index 0000000..70b0e37 --- /dev/null +++ b/src/commands/permissions/helpsetting.rs @@ -0,0 +1,403 @@ +use serenity::builder::{ + CreateActionRow, CreateButton, CreateEmbed, CreateInteractionResponse, + CreateInteractionResponseMessage, CreateMessage, CreateSelectMenu, CreateSelectMenuKind, + CreateSelectMenuOption, +}; +use serenity::model::application::ComponentInteractionDataKind; +use serenity::model::prelude::*; +use serenity::prelude::*; + +use crate::commands::common::send_embed; +use crate::db::{ + DbPoolKey, get_help_aliases_enabled, get_help_perms_enabled, get_help_type, + set_help_aliases_enabled, set_help_perms_enabled, set_help_type, +}; + +#[derive(Clone)] +struct HelpSettingsData { + layout: String, + aliases_enabled: bool, + perms_enabled: bool, +} + +fn normalize_layout(value: &str) -> Option<&'static str> { + match value.to_lowercase().as_str() { + "button" => Some("button"), + "select" => Some("select"), + "hybrid" => Some("hybrid"), + _ => None, + } +} + +fn owner_id_from_custom_id(custom_id: &str) -> Option { + custom_id.rsplit(':').next()?.parse::().ok() +} + +fn mode_from_custom_id(custom_id: &str) -> Option<&str> { + let parts = custom_id.split(':').collect::>(); + if parts.len() != 4 || parts[0] != "helpsetting" || parts[1] != "setmode" { + return None; + } + Some(parts[2]) +} + +async fn pool(ctx: &Context) -> Option { + let data = ctx.data.read().await; + data.get::().cloned() +} + +async fn read_settings(pool: &sqlx::PgPool, bot_id: UserId) -> HelpSettingsData { + let layout = get_help_type(pool, bot_id) + .await + .ok() + .flatten() + .unwrap_or_else(|| "button".to_string()); + let aliases_enabled = get_help_aliases_enabled(pool, bot_id) + .await + .ok() + .flatten() + .unwrap_or(true); + let perms_enabled = get_help_perms_enabled(pool, bot_id) + .await + .ok() + .flatten() + .unwrap_or(true); + + HelpSettingsData { + layout, + aliases_enabled, + perms_enabled, + } +} + +fn build_embed(settings: &HelpSettingsData) -> CreateEmbed { + CreateEmbed::new() + .title("Configuration de l'aide") + .description("Tu peux modifier ces paramètres via boutons ou menu select.") + .field("Mode d'affichage", format!("`{}`", settings.layout), true) + .field( + "Aliases", + format!("`{}`", if settings.aliases_enabled { "on" } else { "off" }), + true, + ) + .field( + "Permissions", + format!("`{}`", if settings.perms_enabled { "on" } else { "off" }), + true, + ) + .color(0x5865F2) +} + +fn build_components(owner_id: UserId, settings: &HelpSettingsData) -> Vec { + let mode_button_style = if settings.layout == "button" { + ButtonStyle::Success + } else { + ButtonStyle::Secondary + }; + let mode_select_style = if settings.layout == "select" { + ButtonStyle::Success + } else { + ButtonStyle::Secondary + }; + let mode_hybrid_style = if settings.layout == "hybrid" { + ButtonStyle::Success + } else { + ButtonStyle::Secondary + }; + + let aliases_style = if settings.aliases_enabled { + ButtonStyle::Success + } else { + ButtonStyle::Danger + }; + let perms_style = if settings.perms_enabled { + ButtonStyle::Success + } else { + ButtonStyle::Danger + }; + + let mode_row = CreateActionRow::Buttons(vec![ + CreateButton::new(format!("helpsetting:setmode:button:{}", owner_id.get())) + .label("Mode Button") + .style(mode_button_style), + CreateButton::new(format!("helpsetting:setmode:select:{}", owner_id.get())) + .label("Mode Select") + .style(mode_select_style), + CreateButton::new(format!("helpsetting:setmode:hybrid:{}", owner_id.get())) + .label("Mode Hybrid") + .style(mode_hybrid_style), + ]); + + let toggle_row = CreateActionRow::Buttons(vec![ + CreateButton::new(format!("helpsetting:toggle:aliases:{}", owner_id.get())) + .label(if settings.aliases_enabled { + "Aliases: on" + } else { + "Aliases: off" + }) + .style(aliases_style), + CreateButton::new(format!("helpsetting:toggle:perms:{}", owner_id.get())) + .label(if settings.perms_enabled { + "Perms: on" + } else { + "Perms: off" + }) + .style(perms_style), + CreateButton::new(format!("helpsetting:refresh:{}", owner_id.get())) + .label("Rafraîchir") + .style(ButtonStyle::Primary), + ]); + + let quick_options = vec![ + CreateSelectMenuOption::new("Mode button", "mode:button"), + CreateSelectMenuOption::new("Mode select", "mode:select"), + CreateSelectMenuOption::new("Mode hybrid", "mode:hybrid"), + CreateSelectMenuOption::new("Aliases on", "aliases:on"), + CreateSelectMenuOption::new("Aliases off", "aliases:off"), + CreateSelectMenuOption::new("Perms on", "perms:on"), + CreateSelectMenuOption::new("Perms off", "perms:off"), + ]; + + let quick_menu = CreateSelectMenu::new( + format!("helpsetting:quick:{}", owner_id.get()), + CreateSelectMenuKind::String { + options: quick_options, + }, + ) + .placeholder("Action rapide (select)"); + + vec![mode_row, toggle_row, CreateActionRow::SelectMenu(quick_menu)] +} + +async fn send_settings_panel( + ctx: &Context, + msg: &Message, + pool: &sqlx::PgPool, + bot_id: UserId, + owner_id: UserId, +) { + let settings = read_settings(pool, bot_id).await; + let embed = build_embed(&settings); + let components = build_components(owner_id, &settings); + + let _ = msg + .channel_id + .send_message( + &ctx.http, + CreateMessage::new().embed(embed).components(components), + ) + .await; +} + +async fn apply_quick_action(pool: &sqlx::PgPool, bot_id: UserId, action: &str) { + match action { + "mode:button" => { + let _ = set_help_type(pool, bot_id, "button").await; + } + "mode:select" => { + let _ = set_help_type(pool, bot_id, "select").await; + } + "mode:hybrid" => { + let _ = set_help_type(pool, bot_id, "hybrid").await; + } + "aliases:on" => { + let _ = set_help_aliases_enabled(pool, bot_id, true).await; + } + "aliases:off" => { + let _ = set_help_aliases_enabled(pool, bot_id, false).await; + } + "perms:on" => { + let _ = set_help_perms_enabled(pool, bot_id, true).await; + } + "perms:off" => { + let _ = set_help_perms_enabled(pool, bot_id, false).await; + } + _ => {} + } +} + +pub async fn handle_component_interaction(ctx: &Context, component: &ComponentInteraction) -> bool { + let custom_id = &component.data.custom_id; + if !custom_id.starts_with("helpsetting:") { + return false; + } + + let Some(owner_id) = owner_id_from_custom_id(custom_id) else { + return false; + }; + + if component.user.id.get() != owner_id { + let _ = component + .create_response( + &ctx.http, + CreateInteractionResponse::Message( + CreateInteractionResponseMessage::new() + .content("Seul l'auteur de la commande peut utiliser ces contrôles.") + .ephemeral(true), + ), + ) + .await; + return true; + } + + let bot_id = ctx.cache.current_user().id; + let Some(pool) = pool(ctx).await else { + let _ = component + .create_response( + &ctx.http, + CreateInteractionResponse::Message( + CreateInteractionResponseMessage::new() + .content("DB indisponible.") + .ephemeral(true), + ), + ) + .await; + return true; + }; + + if custom_id.starts_with("helpsetting:setmode:") { + if let Some(mode) = mode_from_custom_id(custom_id).and_then(normalize_layout) { + let _ = set_help_type(&pool, bot_id, mode).await; + } + } else if custom_id.starts_with("helpsetting:toggle:aliases:") { + let settings = read_settings(&pool, bot_id).await; + let _ = set_help_aliases_enabled(&pool, bot_id, !settings.aliases_enabled).await; + } else if custom_id.starts_with("helpsetting:toggle:perms:") { + let settings = read_settings(&pool, bot_id).await; + let _ = set_help_perms_enabled(&pool, bot_id, !settings.perms_enabled).await; + } else if custom_id.starts_with("helpsetting:quick:") { + if let ComponentInteractionDataKind::StringSelect { values } = &component.data.kind { + if let Some(action) = values.first() { + apply_quick_action(&pool, bot_id, action).await; + } + } + } + + let settings = read_settings(&pool, bot_id).await; + let embed = build_embed(&settings); + let components = build_components(component.user.id, &settings); + + let _ = component + .create_response( + &ctx.http, + CreateInteractionResponse::UpdateMessage( + CreateInteractionResponseMessage::new() + .embed(embed) + .components(components), + ), + ) + .await; + + true +} + +pub async fn handle_helpsetting(ctx: &Context, msg: &Message, args: &[&str]) { + let bot_id = ctx.cache.current_user().id; + let Some(pool) = pool(ctx).await else { + let embed = CreateEmbed::new() + .title("Erreur") + .description("DB indisponible.") + .color(0xED4245); + send_embed(ctx, msg, embed).await; + return; + }; + + if args.is_empty() { + send_settings_panel(ctx, msg, &pool, bot_id, msg.author.id).await; + return; + } + + match args[0].to_lowercase().as_str() { + "type" | "mode" => { + let Some(value) = args.get(1).and_then(|value| normalize_layout(value)) else { + let embed = CreateEmbed::new() + .title("Erreur") + .description("Usage: `+helpsetting type `") + .color(0xED4245); + send_embed(ctx, msg, embed).await; + return; + }; + let _ = set_help_type(&pool, bot_id, value).await; + send_settings_panel(ctx, msg, &pool, bot_id, msg.author.id).await; + } + "aliases" | "alias" => { + let Some(value) = args.get(1) else { + let embed = CreateEmbed::new() + .title("Erreur") + .description("Usage: `+helpsetting aliases `") + .color(0xED4245); + send_embed(ctx, msg, embed).await; + return; + }; + let enabled = match value.to_lowercase().as_str() { + "on" | "true" | "yes" => true, + "off" | "false" | "no" => false, + _ => { + let embed = CreateEmbed::new() + .title("Erreur") + .description("Valeurs valides: `on`, `off`") + .color(0xED4245); + send_embed(ctx, msg, embed).await; + return; + } + }; + let _ = set_help_aliases_enabled(&pool, bot_id, enabled).await; + send_settings_panel(ctx, msg, &pool, bot_id, msg.author.id).await; + } + "perms" | "permissions" => { + let Some(value) = args.get(1) else { + let embed = CreateEmbed::new() + .title("Erreur") + .description("Usage: `+helpsetting perms `") + .color(0xED4245); + send_embed(ctx, msg, embed).await; + return; + }; + let enabled = match value.to_lowercase().as_str() { + "on" | "true" | "yes" => true, + "off" | "false" | "no" => false, + _ => { + let embed = CreateEmbed::new() + .title("Erreur") + .description("Valeurs valides: `on`, `off`") + .color(0xED4245); + send_embed(ctx, msg, embed).await; + return; + } + }; + let _ = set_help_perms_enabled(&pool, bot_id, enabled).await; + send_settings_panel(ctx, msg, &pool, bot_id, msg.author.id).await; + } + _ => { + let embed = CreateEmbed::new() + .title("Erreur") + .description("Sous-commandes: `type`, `aliases`, `perms`") + .color(0xED4245); + send_embed(ctx, msg, embed).await; + } + } +} + +pub struct HelpsettingCommand; +pub static COMMAND_DESCRIPTOR: HelpsettingCommand = HelpsettingCommand; + +impl crate::commands::command_contract::CommandSpec for HelpsettingCommand { + fn metadata(&self) -> crate::commands::command_contract::CommandMetadata { + crate::commands::command_contract::CommandMetadata { + key: "helpsetting", + command: "helpsetting", + category: "permissions", + params: "[type|aliases|perms] [value]", + summary: "Configure l'affichage du système d'aide", + description: "Permet de configurer le mode d'affichage, l'affichage des alias et l'affichage des permissions du système d'aide.", + examples: &[ + "+helpsetting", + "+helpsetting type hybrid", + "+helpsetting perms off", + ], + alias_source_key: "helpsetting", + default_aliases: &["hs", "helpetting"], + default_permission: 9, + } + } +} diff --git a/src/commands/helptype.rs b/src/commands/permissions/helptype.rs similarity index 98% rename from src/commands/helptype.rs rename to src/commands/permissions/helptype.rs index 9fd7ad2..8b9b562 100644 --- a/src/commands/helptype.rs +++ b/src/commands/permissions/helptype.rs @@ -73,6 +73,7 @@ impl crate::commands::command_contract::CommandSpec for HelptypeCommand { examples: &["+helptype", "+he", "+help helptype"], alias_source_key: "helptype", default_aliases: &["htp"], + default_permission: 0, } } } diff --git a/src/commands/mainprefix.rs b/src/commands/permissions/mainprefix.rs similarity index 96% rename from src/commands/mainprefix.rs rename to src/commands/permissions/mainprefix.rs index 5f2ed5c..baca192 100644 --- a/src/commands/mainprefix.rs +++ b/src/commands/permissions/mainprefix.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for MainprefixCommand { examples: &["+mainprefix", "+mx", "+help mainprefix"], alias_source_key: "mainprefix", default_aliases: &["mpx"], + default_permission: 9, } } } diff --git a/src/commands/perms.rs b/src/commands/permissions/perms.rs similarity index 96% rename from src/commands/perms.rs rename to src/commands/permissions/perms.rs index 3ee53d3..aab31df 100644 --- a/src/commands/perms.rs +++ b/src/commands/permissions/perms.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for PermsCommand { examples: &["+perms", "+ps", "+help perms"], alias_source_key: "perms", default_aliases: &["prm"], + default_permission: 8, } } } diff --git a/src/commands/prefix.rs b/src/commands/permissions/prefix.rs similarity index 96% rename from src/commands/prefix.rs rename to src/commands/permissions/prefix.rs index 5e639be..e513f6f 100644 --- a/src/commands/prefix.rs +++ b/src/commands/permissions/prefix.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for PrefixCommand { examples: &["+prefix", "+px", "+help prefix"], alias_source_key: "prefix", default_aliases: &["pfx"], + default_permission: 8, } } } diff --git a/src/commands/compet.rs b/src/commands/profile/compet.rs similarity index 96% rename from src/commands/compet.rs rename to src/commands/profile/compet.rs index 1bb23ee..7aade00 100644 --- a/src/commands/compet.rs +++ b/src/commands/profile/compet.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for CompetCommand { examples: &["+compet", "+ct", "+help compet"], alias_source_key: "compet", default_aliases: &["cpt"], + default_permission: 8, } } } diff --git a/src/commands/discussion.rs b/src/commands/profile/discussion.rs similarity index 98% rename from src/commands/discussion.rs rename to src/commands/profile/discussion.rs index 0f36262..aa0669f 100644 --- a/src/commands/discussion.rs +++ b/src/commands/profile/discussion.rs @@ -72,6 +72,7 @@ impl crate::commands::command_contract::CommandSpec for DiscussionCommand { examples: &["+discussion", "+dn", "+help discussion"], alias_source_key: "discussion", default_aliases: &["dsc"], + default_permission: 8, } } } diff --git a/src/commands/dnd.rs b/src/commands/profile/dnd.rs similarity index 96% rename from src/commands/dnd.rs rename to src/commands/profile/dnd.rs index 0bf800c..bdfdeb1 100644 --- a/src/commands/dnd.rs +++ b/src/commands/profile/dnd.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for DndCommand { examples: &["+dnd", "+dd", "+help dnd"], alias_source_key: "dnd", default_aliases: &["dnm"], + default_permission: 8, } } } diff --git a/src/commands/idle.rs b/src/commands/profile/idle.rs similarity index 96% rename from src/commands/idle.rs rename to src/commands/profile/idle.rs index 7dc09b8..82f671a 100644 --- a/src/commands/idle.rs +++ b/src/commands/profile/idle.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for IdleCommand { examples: &["+idle", "+ie", "+help idle"], alias_source_key: "idle", default_aliases: &["idl"], + default_permission: 8, } } } diff --git a/src/commands/invisible.rs b/src/commands/profile/invisible.rs similarity index 96% rename from src/commands/invisible.rs rename to src/commands/profile/invisible.rs index f3228ca..e42e4d8 100644 --- a/src/commands/invisible.rs +++ b/src/commands/profile/invisible.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for InvisibleCommand { examples: &["+invisible", "+ie", "+help invisible"], alias_source_key: "invisible", default_aliases: &["ivs"], + default_permission: 8, } } } diff --git a/src/commands/listen.rs b/src/commands/profile/listen.rs similarity index 96% rename from src/commands/listen.rs rename to src/commands/profile/listen.rs index 9b846d6..dcae0bd 100644 --- a/src/commands/listen.rs +++ b/src/commands/profile/listen.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for ListenCommand { examples: &["+listen", "+ln", "+help listen"], alias_source_key: "listen", default_aliases: &["lsn"], + default_permission: 8, } } } diff --git a/src/commands/mp.rs b/src/commands/profile/mp.rs similarity index 99% rename from src/commands/mp.rs rename to src/commands/profile/mp.rs index 418e5f9..8397c61 100644 --- a/src/commands/mp.rs +++ b/src/commands/profile/mp.rs @@ -469,6 +469,7 @@ impl crate::commands::command_contract::CommandSpec for MpCommand { examples: &["+mp", "+help mp"], alias_source_key: "mp", default_aliases: &["dmsg"], + default_permission: 8, } } } diff --git a/src/commands/online.rs b/src/commands/profile/online.rs similarity index 96% rename from src/commands/online.rs rename to src/commands/profile/online.rs index f27fdc8..21158fb 100644 --- a/src/commands/online.rs +++ b/src/commands/profile/online.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for OnlineCommand { examples: &["+online", "+oe", "+help online"], alias_source_key: "online", default_aliases: &["onl"], + default_permission: 8, } } } diff --git a/src/commands/playto.rs b/src/commands/profile/playto.rs similarity index 96% rename from src/commands/playto.rs rename to src/commands/profile/playto.rs index aff14ca..350eef7 100644 --- a/src/commands/playto.rs +++ b/src/commands/profile/playto.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for PlaytoCommand { examples: &["+playto", "+po", "+help playto"], alias_source_key: "playto", default_aliases: &["ply"], + default_permission: 8, } } } diff --git a/src/commands/remove_activity.rs b/src/commands/profile/remove_activity.rs similarity index 96% rename from src/commands/remove_activity.rs rename to src/commands/profile/remove_activity.rs index af35784..e5772cc 100644 --- a/src/commands/remove_activity.rs +++ b/src/commands/profile/remove_activity.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for RemoveActivityCommand { examples: &["+remove activity", "+ry", "+help remove activity"], alias_source_key: "remove_activity", default_aliases: &["rma"], + default_permission: 8, } } } diff --git a/src/commands/set.rs b/src/commands/profile/set.rs similarity index 99% rename from src/commands/set.rs rename to src/commands/profile/set.rs index 9b302a9..cb7c563 100644 --- a/src/commands/set.rs +++ b/src/commands/profile/set.rs @@ -254,6 +254,7 @@ impl crate::commands::command_contract::CommandSpec for SetCommand { examples: &["+set", "+st", "+help set"], alias_source_key: "set", default_aliases: &["cfg"], + default_permission: 8, } } } diff --git a/src/commands/stream.rs b/src/commands/profile/stream.rs similarity index 96% rename from src/commands/stream.rs rename to src/commands/profile/stream.rs index e4074b6..0c73fdb 100644 --- a/src/commands/stream.rs +++ b/src/commands/profile/stream.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for StreamCommand { examples: &["+stream", "+sm", "+help stream"], alias_source_key: "stream", default_aliases: &["stm"], + default_permission: 8, } } } diff --git a/src/commands/theme.rs b/src/commands/profile/theme.rs similarity index 98% rename from src/commands/theme.rs rename to src/commands/profile/theme.rs index 3117441..01d945f 100644 --- a/src/commands/theme.rs +++ b/src/commands/profile/theme.rs @@ -59,6 +59,7 @@ impl crate::commands::command_contract::CommandSpec for ThemeCommand { examples: &["+theme", "+te", "+help theme"], alias_source_key: "theme", default_aliases: &["thm"], + default_permission: 8, } } } diff --git a/src/commands/watch.rs b/src/commands/profile/watch.rs similarity index 96% rename from src/commands/watch.rs rename to src/commands/profile/watch.rs index 2426825..9fe07d9 100644 --- a/src/commands/watch.rs +++ b/src/commands/profile/watch.rs @@ -22,6 +22,7 @@ impl crate::commands::command_contract::CommandSpec for WatchCommand { examples: &["+watch", "+wh", "+help watch"], alias_source_key: "watch", default_aliases: &["wtc"], + default_permission: 8, } } } diff --git a/src/events/interaction_create_event.rs b/src/events/interaction_create_event.rs index d3b2114..9151517 100644 --- a/src/events/interaction_create_event.rs +++ b/src/events/interaction_create_event.rs @@ -1,7 +1,9 @@ use serenity::model::prelude::*; use serenity::prelude::*; -use crate::commands::{advanced_tools, help, mp, perms_service, suggestion, tempvoc, ticket}; +use crate::commands::{ + advanced_tools, help, helpsetting, mp, perms_service, suggestion, tempvoc, ticket, +}; pub async fn handle_interaction_create(ctx: &Context, interaction: &Interaction) { if let Interaction::Command(_) = interaction { @@ -27,6 +29,10 @@ pub async fn handle_interaction_create(ctx: &Context, interaction: &Interaction) return; } + if helpsetting::handle_component_interaction(ctx, component).await { + return; + } + if mp::handle_mp_component(ctx, component).await { return; } diff --git a/src/permissions.rs b/src/permissions.rs index 0276641..213061e 100644 --- a/src/permissions.rs +++ b/src/permissions.rs @@ -194,8 +194,8 @@ pub fn command_key(command: &str, args: &[&str]) -> String { } } "help" => "help".to_string(), - "helptype" => "helptype".to_string(), - "helpalias" => "helpalias".to_string(), + "helpsetting" => "helpsetting".to_string(), + "helpetting" => "helpsetting".to_string(), "alias" => "alias".to_string(), "modlog" => "modlog".to_string(), "messagelog" => "messagelog".to_string(), @@ -345,8 +345,7 @@ pub fn all_command_keys() -> Vec { "clear_perms", "allperms", "help", - "helptype", - "helpalias", + "helpsetting", "alias", "modlog", "messagelog", @@ -383,7 +382,7 @@ pub fn default_permission(command_key: &str) -> u8 { "set_modlogs" | "set_boostembed" => 8, "prefix" | "perms" | "allperms" => 8, "help" | "server_list" => 0, - "helptype" | "helpalias" | "alias" | "leave" => 9, + "helpsetting" | "alias" | "leave" => 9, "mp_settings" => 9, "mp" | "mp_sent" | "mp_delete" | "invite" | "discussion" => 8, "set"