mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
implement random commands, dont keep the subcommands only the flags
This commit is contained in:
parent
c00ff2f371
commit
c92c3f84f0
13 changed files with 82 additions and 24 deletions
|
|
@ -1 +1,11 @@
|
|||
use command_parser::token::TokensIterator;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub fn group() -> (&'static str, [&'static str; 1]) {
|
||||
("group", ["g"])
|
||||
}
|
||||
|
||||
pub fn targeted() -> TokensIterator {
|
||||
tokens!(group(), GroupRef)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ pub fn all() -> impl Iterator<Item = Command> {
|
|||
.chain(config::cmds())
|
||||
.chain(fun::cmds())
|
||||
.chain(switch::cmds())
|
||||
.chain(random::cmds())
|
||||
.map(|cmd| {
|
||||
cmd.flag(("plaintext", ["pt"]))
|
||||
.flag(("raw", ["r"]))
|
||||
|
|
|
|||
|
|
@ -1 +1,14 @@
|
|||
use super::*;
|
||||
|
||||
pub fn cmds() -> impl Iterator<Item = Command> {
|
||||
let random = ("random", ["rand"]);
|
||||
let group = group::group();
|
||||
|
||||
[
|
||||
command!(random => "random_self").flag(group),
|
||||
command!(system::targeted(), random => "system_random").flag(group),
|
||||
command!(group::targeted(), random => "group_random_member"),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|cmd| cmd.flag(("all", ["a"])))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,22 @@
|
|||
use command_parser::token::TokensIterator;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub fn cmds() -> impl Iterator<Item = Command> {
|
||||
edit()
|
||||
}
|
||||
|
||||
pub fn system() -> (&'static str, [&'static str; 1]) {
|
||||
("system", ["s"])
|
||||
}
|
||||
|
||||
pub fn targeted() -> TokensIterator {
|
||||
tokens!(system(), SystemRef)
|
||||
}
|
||||
|
||||
pub fn edit() -> impl Iterator<Item = Command> {
|
||||
let system = ("system", ["s"]);
|
||||
let system_target = tokens!(system, SystemRef);
|
||||
let system = system();
|
||||
let system_target = targeted();
|
||||
|
||||
let system_new = tokens!(system, ("new", ["n"]));
|
||||
let system_new_cmd = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue