time parser struct

This commit is contained in:
jude
2020-09-01 15:34:50 +01:00
parent c1a4092e3c
commit 74617d50a5
5 changed files with 166 additions and 42 deletions

View File

@ -72,7 +72,12 @@ async fn clock(ctx: &Context, msg: &Message, args: String) -> CommandResult {
let now = Utc::now().with_timezone(&tz);
let _ = msg.channel_id.say(&ctx, format!("Current time: **{}**", now.format("%H:%M:%S"))).await;
if args == "12".to_string() {
let _ = msg.channel_id.say(&ctx, format!("Current time: **{}**", now.format("%I:%M:%S %p"))).await;
}
else {
let _ = msg.channel_id.say(&ctx, format!("Current time: **{}**", now.format("%H:%M:%S"))).await;
}
Ok(())
}