fixed formatting for reminders that are about to send in $look. fixed multiline reminders on natural that have a location or interval provided

This commit is contained in:
jude 2020-10-28 09:19:10 +00:00
parent 047795810e
commit afc06bda9f

View File

@ -50,7 +50,7 @@ use std::{
time::{SystemTime, UNIX_EPOCH}, time::{SystemTime, UNIX_EPOCH},
}; };
use regex::Regex; use regex::RegexBuilder;
fn shorthand_displacement(seconds: u64) -> String { fn shorthand_displacement(seconds: u64) -> String {
let (days, seconds) = seconds.div_rem(&DAY); let (days, seconds) = seconds.div_rem(&DAY);
@ -466,7 +466,7 @@ LIMIT
.unwrap() .unwrap()
.as_secs(); .as_secs();
longhand_displacement((reminder.time as u64).checked_sub(now).unwrap_or(0)) longhand_displacement((reminder.time as u64).checked_sub(now).unwrap_or(1))
} }
}; };
@ -1063,7 +1063,9 @@ async fn natural(ctx: &Context, msg: &Message, args: String) {
let mut interval = None; let mut interval = None;
if msg.guild_id.is_some() { if msg.guild_id.is_some() {
let re_match = Regex::new(&format!(r#"(?:\s*)(?P<msg>.*) {} (?P<mentions>((?:<@\d+>)|(?:<@!\d+>)|(?:<#\d+>)|(?:\s+))+)$"#, to_str)) let re_match = RegexBuilder::new(&format!(r#"(?:\s*)(?P<msg>.*) {} (?P<mentions>((?:<@\d+>)|(?:<@!\d+>)|(?:<#\d+>)|(?:\s+))+)$"#, to_str))
.dot_matches_new_line(true)
.build()
.unwrap() .unwrap()
.captures(msg_crop); .captures(msg_crop);
@ -1090,7 +1092,9 @@ async fn natural(ctx: &Context, msg: &Message, args: String) {
if check_subscription_on_message(&ctx, &msg).await { if check_subscription_on_message(&ctx, &msg).await {
let re_match = let re_match =
Regex::new(&format!(r#"(?P<msg>.*) {} (?P<interval>.*)$"#, every_str)) RegexBuilder::new(&format!(r#"(?P<msg>.*) {} (?P<interval>.*)$"#, every_str))
.dot_matches_new_line(true)
.build()
.unwrap() .unwrap()
.captures(content); .captures(content);