fixed some messages not sending

This commit is contained in:
jude 2020-10-04 16:17:13 +01:00
parent 836b77d14e
commit db9b0ef2b1
2 changed files with 4 additions and 5 deletions

View File

@ -736,7 +736,7 @@ async fn remind_command(ctx: &Context, msg: &Message, args: String, command: Rem
Err(ReminderError::NotEnoughArgs) Err(ReminderError::NotEnoughArgs)
}; };
let str_response = response.to_response() let str_response = user_data.response(&pool, &response.to_response()).await
.replacen("{location}", &scope_id.mention(), 1) .replacen("{location}", &scope_id.mention(), 1)
.replacen("{offset}", &time_parser.map(|tp| tp.displacement().ok()).flatten().unwrap_or(-1).to_string(), 1) .replacen("{offset}", &time_parser.map(|tp| tp.displacement().ok()).flatten().unwrap_or(-1).to_string(), 1)
.replacen("{min_interval}", &MIN_INTERVAL.to_string(), 1) .replacen("{min_interval}", &MIN_INTERVAL.to_string(), 1)
@ -837,7 +837,6 @@ async fn natural(ctx: &Context, msg: &Message, args: String) -> CommandResult {
None None
}).flatten(); }).flatten();
} }
} }
if location_ids.len() == 1 { if location_ids.len() == 1 {
@ -853,8 +852,7 @@ async fn natural(ctx: &Context, msg: &Message, args: String) -> CommandResult {
interval, interval,
&content).await; &content).await;
let str_response = user_data.response(&pool, &res.to_response_natural()).await
let str_response = res.to_response_natural()
.replacen("{location}", &location_id.mention(), 1) .replacen("{location}", &location_id.mention(), 1)
.replacen("{offset}", &(timestamp as u64 - since_epoch.as_secs()).to_string(), 1) .replacen("{offset}", &(timestamp as u64 - since_epoch.as_secs()).to_string(), 1)
.replacen("{min_interval}", &MIN_INTERVAL.to_string(), 1) .replacen("{min_interval}", &MIN_INTERVAL.to_string(), 1)

View File

@ -102,6 +102,7 @@ impl TimeParser {
} }
} }
pub fn string_displacement()
fn process_explicit(&self) -> Result<i64, InvalidTime> { fn process_explicit(&self) -> Result<i64, InvalidTime> {
let segments = self.time_string.matches('-').count(); let segments = self.time_string.matches('-').count();