From 38e2767f9977647b07a192b86166a1eecbb51e0f Mon Sep 17 00:00:00 2001 From: jellywx Date: Tue, 10 Nov 2020 22:55:29 +0000 Subject: [PATCH] fixed `$look time`. fixed pause message --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/commands/reminder_cmds.rs | 23 +++++++++++++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fdf2cbe..4759615 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1175,7 +1175,7 @@ dependencies = [ [[package]] name = "reminder_rs" -version = "1.2.0" +version = "1.2.1" dependencies = [ "Inflector", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index a1d60df..c6a8026 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder_rs" -version = "1.2.0" +version = "1.2.1" authors = ["jellywx "] edition = "2018" diff --git a/src/commands/reminder_cmds.rs b/src/commands/reminder_cmds.rs index 13d93b3..6e8abec 100644 --- a/src/commands/reminder_cmds.rs +++ b/src/commands/reminder_cmds.rs @@ -152,15 +152,26 @@ async fn pause(ctx: &Context, msg: &Message, args: String) { match pause_until { Ok(timestamp) => { + let dt = NaiveDateTime::from_timestamp(timestamp, 0); + channel.paused = true; - channel.paused_until = Some(NaiveDateTime::from_timestamp(timestamp, 0)); + channel.paused_until = Some(dt); channel.commit_changes(&pool).await; - let _ = msg - .channel_id - .say(&ctx, user_data.response(&pool, "pause/paused_until").await) - .await; + let content = user_data + .response(&pool, "pause/paused_until") + .await + .replace( + "{}", + &user_data + .timezone() + .timestamp(timestamp, 0) + .format("%Y-%m-%d %H:%M:%S") + .to_string(), + ); + + let _ = msg.channel_id.say(&ctx, content).await; } Err(_) => { @@ -530,7 +541,7 @@ LIMIT TimeDisplayType::Absolute => user_data .timezone() .timestamp(reminder.time as i64, 0) - .format("%Y-%m-%D %H:%M:%S") + .format("%Y-%m-%d %H:%M:%S") .to_string(), TimeDisplayType::Relative => { let now = SystemTime::now()