implement proxied message and permcheck commands

This commit is contained in:
dusk 2025-10-03 02:21:12 +00:00
parent 2b304457cc
commit e4f38c76a9
No known key found for this signature in database
19 changed files with 233 additions and 155 deletions

View file

@ -1 +0,0 @@

View file

@ -1 +1,16 @@
use super::*;
pub fn debug() -> (&'static str, [&'static str; 1]) {
("debug", ["dbg"])
}
pub fn cmds() -> impl Iterator<Item = Command> {
let debug = debug();
let perms = ("permissions", ["perms", "permcheck"]);
[
command!(debug, perms, ("channel", ["ch"]), ChannelRef => "permcheck_channel"),
command!(debug, perms, ("guild", ["g"]), GuildRef => "permcheck_guild"),
command!(debug, ("proxy", ["proxying", "proxycheck"]), MessageRef => "message_proxy_check"),
]
.into_iter()
}

View file

@ -3,6 +3,7 @@ use super::*;
pub fn cmds() -> impl Iterator<Item = Command> {
let help = ("help", ["h"]);
[
command!("explain" => "explain"),
command!(help => "help")
.flag(("foo", OpaqueString)) // todo: just for testing
.help("Shows the help command"),

View file

@ -1,7 +1,6 @@
pub mod admin;
pub mod api;
pub mod autoproxy;
pub mod checks;
pub mod commands;
pub mod config;
pub mod dashboard;
@ -33,6 +32,8 @@ pub fn all() -> impl Iterator<Item = Command> {
.chain(random::cmds())
.chain(api::cmds())
.chain(autoproxy::cmds())
.chain(debug::cmds())
.chain(message::cmds())
.map(|cmd| {
cmd.hidden_flag(("plaintext", ["pt"]))
.hidden_flag(("raw", ["r"]))

View file

@ -1 +1,32 @@
use super::*;
pub fn cmds() -> impl Iterator<Item = Command> {
let message = tokens!(("message", ["msg", "messageinfo"]), MessageRef);
let edit = tokens!(("edit", ["e"]), ("new_content", OpaqueStringRemainder));
let apply_edit = |cmd: Command| {
cmd.flag(("append", ["a"]))
.flag(("prepend", ["p"]))
.flag(("regex", ["r"]))
.flag(("mutate-space", ["ms"]))
.flag(("clear-embeds", ["ce"]))
.flag(("clear-attachments", ["ca"]))
.help("Edits a proxied message")
};
[
command!(message => "message_info")
.flag(("delete", ["d"]))
.flag(("author", ["a"]))
.help("Shows information about a proxied message"),
command!(message, ("author", ["sender"]) => "message_author")
.help("Shows the author of a proxied message"),
command!(message, ("delete", ["del"]) => "message_delete")
.help("Deletes a proxied message"),
apply_edit(command!(message, edit => "message_edit")),
apply_edit(command!(edit => "message_edit")),
command!(("reproxy", ["rp", "crimes", "crime"]), MessageRef => "message_reproxy")
.help("Reproxies a message with a different member"),
]
.into_iter()
}