readded patreon checks to natural

This commit is contained in:
jellywx 2021-01-14 18:00:24 +00:00
parent 04232162f2
commit 4d7b957a91
3 changed files with 16 additions and 6 deletions

2
Cargo.lock generated
View File

@ -1314,7 +1314,7 @@ dependencies = [
[[package]] [[package]]
name = "reminder_rs" name = "reminder_rs"
version = "1.4.0-alpha" version = "1.4.0"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"chrono", "chrono",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "reminder_rs" name = "reminder_rs"
version = "1.4.0-alpha" version = "1.4.0"
authors = ["jellywx <judesouthworth@pm.me>"] authors = ["jellywx <judesouthworth@pm.me>"]
edition = "2018" edition = "2018"

View File

@ -1222,6 +1222,8 @@ async fn natural(ctx: &Context, msg: &Message, args: String) {
match REGEX_NATURAL_COMMAND.captures(&args) { match REGEX_NATURAL_COMMAND.captures(&args) {
Some(captures) => { Some(captures) => {
let subscribed = check_subscription_on_message(&ctx, msg).await;
let location_ids = if let Some(mentions) = captures.name("mentions").map(|m| m.as_str()) let location_ids = if let Some(mentions) = captures.name("mentions").map(|m| m.as_str())
{ {
parse_mention_list(mentions) parse_mention_list(mentions)
@ -1230,17 +1232,25 @@ async fn natural(ctx: &Context, msg: &Message, args: String) {
}; };
let expires = if let Some(expires_crop) = captures.name("expires") { let expires = if let Some(expires_crop) = captures.name("expires") {
if subscribed {
natural_parser(expires_crop.as_str(), &user_data.timezone).await natural_parser(expires_crop.as_str(), &user_data.timezone).await
} else { } else {
None None
}
} else {
None
}; };
let interval = if let Some(interval_crop) = captures.name("interval") { let interval = if let Some(interval_crop) = captures.name("interval") {
if subscribed {
natural_parser(interval_crop.as_str(), &user_data.timezone) natural_parser(interval_crop.as_str(), &user_data.timezone)
.await .await
.map(|i| i - since_epoch.as_secs() as i64) .map(|i| i - since_epoch.as_secs() as i64)
} else { } else {
None None
}
} else {
None
}; };
if let Some(timestamp) = if let Some(timestamp) =