From 8b2ccf363ac6894c21e256844948c8327645f0db Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Sun, 17 Nov 2019 22:51:59 -0500 Subject: mostly fixed --- src/commands/meme/history.rs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/commands/meme/history.rs') diff --git a/src/commands/meme/history.rs b/src/commands/meme/history.rs index 6c03bef..5921e1a 100644 --- a/src/commands/meme/history.rs +++ b/src/commands/meme/history.rs @@ -2,8 +2,17 @@ use diesel::{ NotFound, result::Error as DieselError, }; +use log::{ + debug, + error, + info, +}; use serenity::{ - framework::standard::Args, + framework::standard::{ + Args, + CommandResult, + macros::command, + }, model::channel::Message, prelude::*, }; @@ -12,8 +21,12 @@ use timeago::{ TimeUnit, }; +use anyhow::anyhow; +use lazy_static::lazy_static; + use crate::{ db::{ + self, connection, InvocationRecord, Meme, @@ -38,7 +51,7 @@ static CLEAN_DATE_FORMAT: &'static str = "%b %-e %Y"; #[command] #[aliases("what")] -pub fn wat(ctx: &mut Context, msg: &Message, _: Args) -> Result<()> { +pub fn wat(ctx: &mut Context, msg: &Message, _: Args) -> CommandResult { let conn = connection()?; let record = match InvocationRecord::last(&conn) { @@ -80,7 +93,7 @@ pub fn wat(ctx: &mut Context, msg: &Message, _: Args) -> Result<()> { } #[command] -pub fn history(ctx: &mut Context, msg: &Message, mut args: Args) -> Result<()> { +pub fn history(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult { use itertools::Itertools; lazy_static! { @@ -143,7 +156,7 @@ pub fn history(ctx: &mut Context, msg: &Message, mut args: Args) -> Result<()> { #[command] #[aliases("stat")] -pub fn stats(ctx: &mut Context, msg: &Message, _: Args) -> Result<()> { +pub fn stats(ctx: &mut Context, msg: &Message, _: Args) -> CommandResult { use db; use serenity::model::{ id::UserId, @@ -206,7 +219,7 @@ and *{}* was the most-memed overall ({})"#, } #[command] -pub fn memers(ctx: &mut Context, msg: &Message, _args: Args) -> Result<()> { +pub fn memers(ctx: &mut Context, msg: &Message, _args: Args) -> CommandResult { use db; use itertools::Itertools; use serenity::model::{ @@ -240,7 +253,7 @@ pub fn memers(ctx: &mut Context, msg: &Message, _args: Args) -> Result<()> { } #[command] -pub fn query(ctx: &mut Context, msg: &Message, mut args: Args) -> Result<()> { +pub fn query(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult { use std::borrow::Borrow; use itertools::Itertools; -- cgit v1.3.1