aboutsummaryrefslogtreecommitdiff
path: root/src/commands/meme/history.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/meme/history.rs')
-rw-r--r--src/commands/meme/history.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/commands/meme/history.rs b/src/commands/meme/history.rs
index 68416e5..e3d0de3 100644
--- a/src/commands/meme/history.rs
+++ b/src/commands/meme/history.rs
@@ -3,13 +3,9 @@ use diesel::{
result::Error as DieselError,
NotFound,
};
+use grate::tracing;
use itertools::Itertools;
use lazy_static::lazy_static;
-use log::{
- debug,
- error,
- info,
-};
use serenity::{
futures::{
StreamExt,
@@ -58,7 +54,7 @@ pub async fn wat(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
Ok(x) => x,
Err(e) => {
if let Some(NotFound) = e.downcast_ref::<DieselError>() {
- info!("found no memes in history");
+ tracing::info!("found no memes in history");
util::reply(ctx, "no one has ever memed before").await?;
return Ok(());
@@ -89,7 +85,7 @@ pub async fn wat(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
},
Err(e) => {
if let Some(NotFound) = e.downcast_ref::<DieselError>() {
- info!("last meme not found in database");
+ tracing::info!("last meme not found in database");
util::reply(ctx, "heuueueeeeh?").await?;
return Ok(());
@@ -110,7 +106,10 @@ pub async fn history(ctx: PoiseContext<'_>, n: Option<usize>) -> anyhow::Result<
let n = n.unwrap_or(CONFIG.default_hist);
if n > CONFIG.max_hist {
- debug!("user requested more than MAX_HIST ({}) items from history", CONFIG.max_hist);
+ tracing::debug!(
+ "user requested more than MAX_HIST ({}) items from history",
+ CONFIG.max_hist
+ );
util::reply(ctx, "YER PUSHIN ME OVER THE FUCKIN LINE").await?;
}
@@ -122,13 +121,13 @@ pub async fn history(ctx: PoiseContext<'_>, n: Option<usize>) -> anyhow::Result<
};
if records.is_empty() {
- info!("no memes in history");
+ tracing::info!("no memes in history");
util::reply(ctx, "i don't remember anything :(").await?;
return Ok(());
}
- info!("reporting meme history (len {})", n);
+ tracing::info!("reporting meme history (len {})", n);
let resp = serenity::futures::stream::iter(records.into_iter().enumerate().rev())
.then(|(i, rec)| async move {
@@ -182,7 +181,7 @@ pub async fn history(ctx: PoiseContext<'_>, n: Option<usize>) -> anyhow::Result<
Err(e) => {
if let Some(variant) = e.downcast_ref::<DieselError>() {
if *variant != NotFound {
- error!("error encountered loading meme history: {}", e);
+ tracing::error!("error encountered loading meme history: {}", e);
}
}
@@ -213,7 +212,7 @@ pub async fn stats(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
let mut conn = connection().await?;
let stats = db::stats(&mut conn).await?;
- debug!("reporting stats");
+ tracing::debug!("reporting stats");
let rand_user: User = UserId::new(stats.most_random_meme_user).to_user(&ctx).await?;
let direct_user: User = UserId::new(stats.most_directly_named_meme_user).to_user(&ctx).await?;
@@ -408,7 +407,7 @@ pub async fn query(ctx: PoiseContext<'_>, rest: util::RestVec) -> anyhow::Result
.join("\n");
if result.is_empty() {
- info!("no memes matched query");
+ tracing::info!("no memes matched query");
util::reply(ctx, "no match").await?;
return Ok(());