pager improvements. deleting working

This commit is contained in:
2021-09-16 18:30:16 +01:00
parent b2207e308a
commit a9c91bee93
8 changed files with 527 additions and 190 deletions

View File

@ -4,11 +4,6 @@ pub mod errors;
mod helper;
pub mod look_flags;
use std::{
convert::{TryFrom, TryInto},
env,
};
use chrono::{NaiveDateTime, TimeZone};
use chrono_tz::Tz;
use serenity::{
@ -19,14 +14,13 @@ use sqlx::MySqlPool;
use crate::{
models::reminder::{
errors::InteractionError,
helper::longhand_displacement,
look_flags::{LookFlags, TimeDisplayType},
},
SQLPool,
};
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Reminder {
pub id: u32,
pub uid: String,
@ -284,6 +278,19 @@ WHERE
}
}
pub fn display_del(&self, count: usize, timezone: &Tz) -> String {
format!(
"**{}**: '{}' *<#{}>* at **{}**",
count + 1,
self.display_content(),
self.channel,
timezone
.timestamp(self.utc_time.timestamp(), 0)
.format("%Y-%m-%d %H:%M:%S")
.to_string()
)
}
pub fn display(&self, flags: &LookFlags, timezone: &Tz) -> String {
let time_display = match flags.time_display {
TimeDisplayType::Absolute => timezone