aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2019-03-03 03:35:05 -0500
committerNathan Perry <avaglir@gmail.com>2019-03-03 03:35:05 -0500
commita597151e2086e12814fea12abe1a4c31d0ca1f7f (patch)
tree72d49618f89e0ae7c0816efb62222201273cd3ae /src/commands
parente277e52cbec7bd178337019df7840691845d683d (diff)
show invocations in stats
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/meme.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/commands/meme.rs b/src/commands/meme.rs
index 58b7d63..42a4051 100644
--- a/src/commands/meme.rs
+++ b/src/commands/meme.rs
@@ -295,17 +295,33 @@ pub fn delmeme(_: &mut Context, msg: &Message, mut args: Args) -> Result<()> {
pub fn stats(_: &mut Context, msg: &Message, _: Args) -> Result<()> {
use db;
+ use chrono;
let conn = connection()?;
let stats = db::stats(&conn)?;
let s = format!(
- "{} memes total\n{} memes with audio ({:0.1}%)\n{} memes with images ({:0.1}%)",
+ r#"
+{} memes total
+{} memes with audio ({:0.1}%)
+{} memes with images ({:0.1}%)
+
+started recording meme invocations on {} ({})
+{} total meme invocations recorded
+{} of which were random ({:0.1}%)
+and {} were audio ({:0.1}%)"#,
stats.memes_overall,
stats.audio_memes,
(stats.audio_memes as f64) / (stats.memes_overall as f64) * 100.,
stats.image_memes,
(stats.image_memes as f64) / (stats.memes_overall as f64) * 100.,
+ stats.started_recording.date(),
+ TIME_FORMATTER.convert((chrono::Utc::now() - stats.started_recording).to_std().unwrap()),
+ stats.total_meme_invocations,
+ stats.random_meme_invocations,
+ (stats.random_meme_invocations as f64) / (stats.total_meme_invocations as f64) * 100.,
+ stats.audio_meme_invocations,
+ (stats.audio_meme_invocations as f64) / (stats.total_meme_invocations as f64) * 100.,
);
send(msg.channel_id, s, msg.tts)
}