fix for bulk setting reminders
This commit is contained in:
parent
b08848d272
commit
a380c1f139
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1175,7 +1175,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "reminder_rs"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
dependencies = [
|
||||
"Inflector",
|
||||
"async-trait",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "reminder_rs"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
authors = ["jellywx <judesouthworth@pm.me>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -1071,6 +1071,7 @@ async fn natural(ctx: &Context, msg: &Message, args: String) {
|
||||
content = captures.name("msg").unwrap().as_str();
|
||||
|
||||
let mentions = captures.name("mentions").unwrap().as_str();
|
||||
|
||||
location_ids = REGEX_CHANNEL_USER
|
||||
.captures_iter(mentions)
|
||||
.map(|i| {
|
||||
@ -1154,7 +1155,7 @@ async fn natural(ctx: &Context, msg: &Message, args: String) {
|
||||
|
||||
let _ = msg.channel_id.say(&ctx, &str_response).await;
|
||||
} else {
|
||||
let mut issue_count = 0_u8;
|
||||
let mut ok_count = 0_u8;
|
||||
|
||||
for location in location_ids {
|
||||
let res = create_reminder(
|
||||
@ -1170,14 +1171,14 @@ async fn natural(ctx: &Context, msg: &Message, args: String) {
|
||||
.await;
|
||||
|
||||
if res.is_ok() {
|
||||
issue_count += 1;
|
||||
ok_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
let content = user_data
|
||||
.response(&pool, "natural/bulk_set")
|
||||
.await
|
||||
.replace("{count}", &issue_count.to_string());
|
||||
.replace("{}", &ok_count.to_string());
|
||||
|
||||
let _ = msg.channel_id.say(&ctx, content).await;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ lazy_static! {
|
||||
pub static ref REGEX_COMMANDS: Regex = Regex::new(r#"([a-z]+)"#).unwrap();
|
||||
pub static ref REGEX_ALIAS: Regex =
|
||||
Regex::new(r#"(?P<name>[\S]{1,12})(?:(?: (?P<cmd>.*)$)|$)"#).unwrap();
|
||||
pub static ref REGEX_CHANNEL_USER: Regex = Regex::new(r#"^\s*<(#|@)(?:!)?(\d+)>\s*$"#).unwrap();
|
||||
pub static ref REGEX_CHANNEL_USER: Regex = Regex::new(r#"\s*<(#|@)(?:!)?(\d+)>\s*"#).unwrap();
|
||||
pub static ref MIN_INTERVAL: i64 = env::var("MIN_INTERVAL")
|
||||
.ok()
|
||||
.map(|inner| inner.parse::<i64>().ok())
|
||||
|
Loading…
Reference in New Issue
Block a user