mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
add x alias for edit -regex
This commit is contained in:
parent
0a3b15eb45
commit
516eaa5292
3 changed files with 29 additions and 5 deletions
|
|
@ -1,4 +1,7 @@
|
|||
use command_parser::parameter::{MESSAGE_LINK, MESSAGE_REF};
|
||||
use command_parser::{
|
||||
parameter::{MESSAGE_LINK, MESSAGE_REF},
|
||||
token::TokensIterator,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
|
@ -11,6 +14,8 @@ pub fn cmds() -> impl IntoIterator<Item = Command> {
|
|||
|
||||
let edit = ("edit", ["e"]);
|
||||
let new_content_param = Optional(Remainder(("new_content", OpaqueString)));
|
||||
let edit_short_subcmd = tokens!(Optional(MESSAGE_LINK), new_content_param);
|
||||
|
||||
let apply_edit = |cmd: Command| {
|
||||
cmd.flag(("append", ["a"]))
|
||||
.flag(("prepend", ["p"]))
|
||||
|
|
@ -20,14 +25,17 @@ pub fn cmds() -> impl IntoIterator<Item = Command> {
|
|||
.flag(("clear-attachments", ["clear-attachment", "ca"]))
|
||||
.help("Edits a previously proxied message")
|
||||
};
|
||||
let make_edit_cmd = |tokens: TokensIterator| apply_edit(command!(tokens => "message_edit"));
|
||||
|
||||
[
|
||||
apply_edit(command!(edit, Optional(MESSAGE_LINK), new_content_param => "message_edit")),
|
||||
make_edit_cmd(tokens!(edit, edit_short_subcmd)),
|
||||
// this one always does regex
|
||||
make_edit_cmd(tokens!("x", edit_short_subcmd)).flag_value("regex", None),
|
||||
command!(reproxy, Optional(("msg", MESSAGE_REF)), ("member", MemberRef) => "message_reproxy")
|
||||
.help("Reproxies a previously proxied message with a different member"),
|
||||
command!(message, author => "message_author").help("Shows the author of a proxied message"),
|
||||
command!(message, delete => "message_delete").help("Deletes a proxied message"),
|
||||
apply_edit(command!(message, edit, new_content_param => "message_edit")),
|
||||
make_edit_cmd(tokens!(message, edit, new_content_param)),
|
||||
command!(message => "message_info")
|
||||
.flag(delete)
|
||||
.flag(author)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue