1.4.6- natural arguments can now be on new lines and work properly

This commit is contained in:
2021-02-21 12:26:49 +00:00
parent 1820b5a17b
commit 3075e34fe1
4 changed files with 150 additions and 110 deletions

View File

@ -978,6 +978,22 @@ impl Content {
}
}
/*
#[command("countdown")]
#[permission_level(Managed)]
async fn countdown(ctx: &Context, msg: &Message, args: String) {
if !check_subscription_on_message(&ctx, &msg).await {
} else {
let (pool, lm) = get_ctx_data(&ctx).await;
let split_args = args.splitn(3, ' ').collect::<Vec<&str>>();
if split_args.len() == 3 {
} else {
}
}
}
*/
#[command("remind")]
#[permission_level(Managed)]
async fn remind(ctx: &Context, msg: &Message, args: String) {

View File

@ -57,14 +57,14 @@ lazy_static! {
.unwrap();
pub static ref REGEX_NATURAL_COMMAND_1: Regex = RegexBuilder::new(
r#"(?P<time>.*?) (?:send|say) (?P<msg>.*?)(?: to (?P<mentions>((?:<@\d+>)|(?:<@!\d+>)|(?:<#\d+>)|(?:\s+))+))?$"#
r#"(?P<time>.*?)(?:\s+)(?:send|say)(?:\s+)(?P<msg>.*?)(?:(?:\s+)to(?:\s+)(?P<mentions>((?:<@\d+>)|(?:<@!\d+>)|(?:<#\d+>)|(?:\s+))+))?$"#
)
.dot_matches_new_line(true)
.build()
.unwrap();
pub static ref REGEX_NATURAL_COMMAND_2: Regex = RegexBuilder::new(
r#"(?P<msg>.*) every (?P<interval>.*?)(?: (?:until|for) (?P<expires>.*?))?$"#
r#"(?P<msg>.*)(?:\s+)every(?:\s+)(?P<interval>.*?)(?:(?:\s+)(?:until|for)(?:\s+)(?P<expires>.*?))?$"#
)
.dot_matches_new_line(true)
.build()