remove rest of the parsing in csharp bot

This commit is contained in:
dusk 2025-10-08 03:26:40 +00:00
parent 15ffd16c01
commit 479e0a59b5
No known key found for this signature in database
35 changed files with 242 additions and 409 deletions

View file

@ -16,6 +16,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Sets the deny flag on an abuse log entry"),
command!(abuselog, ("description", ["desc"]), log_param, Optional(("desc", OpaqueStringRemainder)) => format!("admin_abuselog_description_{}", log_param.name()))
.flag(("clear", ["c"]))
.flag(("yes", ["y"]))
.help("Sets the description of an abuse log entry"),
command!(abuselog, ("adduser", ["au"]), log_param => format!("admin_abuselog_add_user_{}", log_param.name()))
.help("Adds a user to an abuse log entry"),
@ -36,22 +37,31 @@ pub fn cmds() -> impl Iterator<Item = Command> {
[
command!(admin, ("updatesystemid", ["usid"]), SystemRef, ("new_hid", OpaqueString) => "admin_update_system_id")
.flag(("yes", ["y"]))
.help("Updates a system's ID"),
command!(admin, ("updatememberid", ["umid"]), MemberRef, ("new_hid", OpaqueString) => "admin_update_member_id")
.flag(("yes", ["y"]))
.help("Updates a member's ID"),
command!(admin, ("updategroupid", ["ugid"]), GroupRef, ("new_hid", OpaqueString) => "admin_update_group_id")
.flag(("yes", ["y"]))
.help("Updates a group's ID"),
command!(admin, ("rerollsystemid", ["rsid"]), SystemRef => "admin_reroll_system_id")
.flag(("yes", ["y"]))
.help("Rerolls a system's ID"),
command!(admin, ("rerollmemberid", ["rmid"]), MemberRef => "admin_reroll_member_id")
.flag(("yes", ["y"]))
.help("Rerolls a member's ID"),
command!(admin, ("rerollgroupid", ["rgid"]), GroupRef => "admin_reroll_group_id")
.flag(("yes", ["y"]))
.help("Rerolls a group's ID"),
command!(admin, ("updatememberlimit", ["uml"]), SystemRef, Optional(("limit", OpaqueInt)) => "admin_system_member_limit")
.flag(("yes", ["y"]))
.help("Updates a system's member limit"),
command!(admin, ("updategrouplimit", ["ugl"]), SystemRef, Optional(("limit", OpaqueInt)) => "admin_system_group_limit")
.flag(("yes", ["y"]))
.help("Updates a system's group limit"),
command!(admin, ("systemrecover", ["sr"]), ("token", OpaqueString), ("account", UserRef) => "admin_system_recover")
.flag(("yes", ["y"]))
.flag(("reroll-token", ["rt"]))
.help("Recovers a system"),
command!(admin, ("systemdelete", ["sd"]), SystemRef => "admin_system_delete")

View file

@ -21,9 +21,10 @@ pub fn cmds() -> impl Iterator<Item = Command> {
[command!(group_new, ("name", OpaqueString) => "group_new").help("Creates a new group")]
.into_iter();
let group_info_cmd =
[command!(group_target => "group_info").help("Shows information about a group")]
.into_iter();
let group_info_cmd = [command!(group_target => "group_info")
.flag(("all", ["a"]))
.help("Shows information about a group")]
.into_iter();
let group_name = tokens!(
group_target,
@ -159,9 +160,9 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_modify_members_cmd = [
command!(group_target, "add", Optional(MemberRefs) => "group_add_member")
.flag(("all", ["a"])),
.flag(("all", ["a"])).flag(("yes", ["y"])),
command!(group_target, ("remove", ["delete", "del", "rem"]), Optional(MemberRefs) => "group_remove_member")
.flag(("all", ["a"])),
.flag(("all", ["a"])).flag(("yes", ["y"])),
]
.into_iter();

View file

@ -2,7 +2,8 @@ use super::*;
pub fn cmds() -> impl Iterator<Item = Command> {
[
command!("import", Optional(("url", OpaqueStringRemainder)) => "import"),
command!("import", Optional(("url", OpaqueStringRemainder)) => "import")
.flag(("yes", ["y"])),
command!("export" => "export"),
]
.into_iter()

View file

@ -49,6 +49,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
[
command!(member_name => "member_name_show").help("Shows a member's name"),
command!(member_name, ("name", OpaqueStringRemainder) => "member_name_update")
.flag(("yes", ["y"]))
.help("Changes a member's name"),
]
.into_iter()

View file

@ -51,6 +51,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(log_channel, ("channel", ChannelRef) => "server_config_log_channel_set")
.help("Sets the log channel"),
command!(log_channel, ("clear", ["c"]) => "server_config_log_channel_clear")
.flag(("yes", ["y"]))
.help("Clears the log channel"),
]
.into_iter();

View file

@ -20,7 +20,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(switch, out => "switch_out"),
command!(switch, r#move, OpaqueString => "switch_move"), // TODO: datetime parsing
command!(switch, delete => "switch_delete").flag(("all", ["clear", "c"])),
command!(switch, edit, out => "switch_edit_out"),
command!(switch, edit, out => "switch_edit_out").flag(("yes", ["y"])),
command!(switch, edit, Optional(MemberRefs) => "switch_edit").flags(edit_flags),
command!(switch, copy, Optional(MemberRefs) => "switch_copy").flags(edit_flags),
command!(switch, ("commands", ["help"]) => "switch_commands"),

View file

@ -28,25 +28,33 @@ pub fn edit() -> impl Iterator<Item = Command> {
]
.into_iter();
let system_webhook_cmd = [command!(system, ("webhook", ["hook"]) => "system_webhook")
.help("Creates a webhook for your system")]
let system_webhook = tokens!(system, ("webhook", ["hook"]));
let system_webhook_cmd = [
command!(system_webhook => "system_webhook_show").help("Shows your system's webhook URL"),
command!(system_webhook, ("clear", ["c"]) => "system_webhook_clear")
.flag(("yes", ["y"]))
.help("Clears your system's webhook URL"),
command!(system_webhook, ("url", OpaqueString) => "system_webhook_set")
.help("Sets your system's webhook URL"),
]
.into_iter();
let system_info_cmd = [
command!(system => "system_info_self").help("Shows information about your system"),
command!(system_target, ("info", ["show", "view"]) => "system_info")
.help("Shows information about your system"),
]
.into_iter()
.map(|cmd| {
let add_info_flags = |cmd: Command| {
cmd.flag(("public", ["pub"]))
.flag(("private", ["priv"]))
.flag(("all", ["a"]))
});
};
let system_info_cmd_self = std::iter::once(add_info_flags(
command!(system => "system_info_self").help("Shows information about your system"),
));
let system_info_cmd = std::iter::once(add_info_flags(
command!(system_target, ("info", ["show", "view"]) => "system_info")
.help("Shows information about your system"),
));
let system_name = tokens!(system_target, "name");
let system_name_cmd =
[command!(system_name => "system_show_name").help("Shows the systems name")].into_iter();
std::iter::once(command!(system_name => "system_show_name").help("Shows the systems name"));
let system_name_self = tokens!(system, "name");
let system_name_self_cmd = [
@ -60,9 +68,10 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_server_name = tokens!(system_target, ("servername", ["sn", "guildname"]));
let system_server_name_cmd = [command!(system_server_name => "system_show_server_name")
.help("Shows the system's server name")]
.into_iter();
let system_server_name_cmd = std::iter::once(
command!(system_server_name => "system_show_server_name")
.help("Shows the system's server name"),
);
let system_server_name_self = tokens!(system, ("servername", ["sn", "guildname"]));
let system_server_name_self_cmd = [
@ -77,9 +86,10 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_description = tokens!(system_target, ("description", ["desc", "d"]));
let system_description_cmd = [command!(system_description => "system_show_description")
.help("Shows the system's description")]
.into_iter();
let system_description_cmd = std::iter::once(
command!(system_description => "system_show_description")
.help("Shows the system's description"),
);
let system_description_self = tokens!(system, ("description", ["desc", "d"]));
let system_description_self_cmd = [
@ -93,9 +103,9 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_color = tokens!(system_target, ("color", ["colour"]));
let system_color_cmd =
[command!(system_color => "system_show_color").help("Shows the system's color")]
.into_iter();
let system_color_cmd = std::iter::once(
command!(system_color => "system_show_color").help("Shows the system's color"),
);
let system_color_self = tokens!(system, ("color", ["colour"]));
let system_color_self_cmd = [
@ -110,7 +120,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_tag = tokens!(system_target, ("tag", ["suffix"]));
let system_tag_cmd =
[command!(system_tag => "system_show_tag").help("Shows the system's tag")].into_iter();
std::iter::once(command!(system_tag => "system_show_tag").help("Shows the system's tag"));
let system_tag_self = tokens!(system, ("tag", ["suffix"]));
let system_tag_self_cmd = [
@ -124,9 +134,10 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_server_tag = tokens!(system_target, ("servertag", ["st", "guildtag"]));
let system_server_tag_cmd = [command!(system_server_tag => "system_show_server_tag")
.help("Shows the system's server tag")]
.into_iter();
let system_server_tag_cmd = std::iter::once(
command!(system_server_tag => "system_show_server_tag")
.help("Shows the system's server tag"),
);
let system_server_tag_self = tokens!(system, ("servertag", ["st", "guildtag"]));
let system_server_tag_self_cmd = [
@ -141,9 +152,9 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_pronouns = tokens!(system_target, ("pronouns", ["prns"]));
let system_pronouns_cmd =
[command!(system_pronouns => "system_show_pronouns").help("Shows the system's pronouns")]
.into_iter();
let system_pronouns_cmd = std::iter::once(
command!(system_pronouns => "system_show_pronouns").help("Shows the system's pronouns"),
);
let system_pronouns_self = tokens!(system, ("pronouns", ["prns"]));
let system_pronouns_self_cmd = [
@ -158,9 +169,9 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_avatar = tokens!(system_target, ("avatar", ["pfp"]));
let system_avatar_cmd =
[command!(system_avatar => "system_show_avatar").help("Shows the system's avatar")]
.into_iter();
let system_avatar_cmd = std::iter::once(
command!(system_avatar => "system_show_avatar").help("Shows the system's avatar"),
);
let system_avatar_self = tokens!(system, ("avatar", ["pfp"]));
let system_avatar_self_cmd = [
@ -175,11 +186,10 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_server_avatar = tokens!(system_target, ("serveravatar", ["spfp"]));
let system_server_avatar_cmd = [
let system_server_avatar_cmd = std::iter::once(
command!(system_server_avatar => "system_show_server_avatar")
.help("Shows the system's server avatar"),
]
.into_iter();
);
let system_server_avatar_self = tokens!(system, ("serveravatar", ["spfp"]));
let system_server_avatar_self_cmd = [
@ -194,9 +204,9 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_banner = tokens!(system_target, ("banner", ["cover"]));
let system_banner_cmd =
[command!(system_banner => "system_show_banner").help("Shows the system's banner")]
.into_iter();
let system_banner_cmd = std::iter::once(
command!(system_banner => "system_show_banner").help("Shows the system's banner"),
);
let system_banner_self = tokens!(system, ("banner", ["cover"]));
let system_banner_self_cmd = [
@ -253,7 +263,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_link = [
command!("link", ("account", UserRef) => "system_link"),
command!("unlink", ("account", OpaqueString) => "system_unlink"),
command!("unlink", ("account", OpaqueString) => "system_unlink").flag(("yes", ["y"])),
]
.into_iter();
@ -286,10 +296,12 @@ pub fn edit() -> impl Iterator<Item = Command> {
.map(add_list_flags);
let system_display_id_self_cmd =
[command!(system, "id" => "system_display_id_self")].into_iter();
let system_display_id_cmd = [command!(system_target, "id" => "system_display_id")].into_iter();
std::iter::once(command!(system, "id" => "system_display_id_self"));
let system_display_id_cmd =
std::iter::once(command!(system_target, "id" => "system_display_id"));
system_new_cmd
system_info_cmd_self
.chain(system_new_cmd)
.chain(system_webhook_cmd)
.chain(system_name_self_cmd)
.chain(system_server_name_self_cmd)