From 622f150b704473da9781e453881c2fdde27f1577 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Tue, 7 Sep 2021 18:59:57 -0400 Subject: [PATCH] update bot framework Signed-off-by: Christine Dodrill --- Cargo.lock | 13 +++++++------ src/commands/furbooru.rs | 42 ++++++++++++++++++++-------------------- src/main.rs | 6 +++--- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd50e80..e5e80ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,10 +1231,11 @@ dependencies = [ [[package]] name = "robespierre" version = "0.1.0" -source = "git+https://github.com/dblanovschi/robespierre#445af603ee43a4878e04310d2028c0347379afc2" +source = "git+https://github.com/dblanovschi/robespierre#0806bc28e7cd06f258457f719ceb5d6408c3d010" dependencies = [ "async-std", "async-trait", + "futures", "robespierre-cache", "robespierre-events", "robespierre-fw-macros", @@ -1251,7 +1252,7 @@ dependencies = [ [[package]] name = "robespierre-cache" version = "0.1.0" -source = "git+https://github.com/dblanovschi/robespierre#445af603ee43a4878e04310d2028c0347379afc2" +source = "git+https://github.com/dblanovschi/robespierre#0806bc28e7cd06f258457f719ceb5d6408c3d010" dependencies = [ "async-trait", "robespierre-models", @@ -1261,7 +1262,7 @@ dependencies = [ [[package]] name = "robespierre-events" version = "0.1.0" -source = "git+https://github.com/dblanovschi/robespierre#445af603ee43a4878e04310d2028c0347379afc2" +source = "git+https://github.com/dblanovschi/robespierre#0806bc28e7cd06f258457f719ceb5d6408c3d010" dependencies = [ "async-std", "async-trait", @@ -1279,7 +1280,7 @@ dependencies = [ [[package]] name = "robespierre-fw-macros" version = "0.1.0" -source = "git+https://github.com/dblanovschi/robespierre#445af603ee43a4878e04310d2028c0347379afc2" +source = "git+https://github.com/dblanovschi/robespierre#0806bc28e7cd06f258457f719ceb5d6408c3d010" dependencies = [ "proc-macro2", "quote", @@ -1289,7 +1290,7 @@ dependencies = [ [[package]] name = "robespierre-http" version = "0.1.0" -source = "git+https://github.com/dblanovschi/robespierre#445af603ee43a4878e04310d2028c0347379afc2" +source = "git+https://github.com/dblanovschi/robespierre#0806bc28e7cd06f258457f719ceb5d6408c3d010" dependencies = [ "reqwest", "robespierre-models", @@ -1301,7 +1302,7 @@ dependencies = [ [[package]] name = "robespierre-models" version = "0.1.0" -source = "git+https://github.com/dblanovschi/robespierre#445af603ee43a4878e04310d2028c0347379afc2" +source = "git+https://github.com/dblanovschi/robespierre#0806bc28e7cd06f258457f719ceb5d6408c3d010" dependencies = [ "bitflags", "chrono", diff --git a/src/commands/furbooru.rs b/src/commands/furbooru.rs index e41ac84..1db4d5b 100644 --- a/src/commands/furbooru.rs +++ b/src/commands/furbooru.rs @@ -27,31 +27,31 @@ pub fn user_agent(username: String) -> String { ) } -#[command] -pub async fn search_impl(ctx: &FwContext, msg: &Message, args: &str) -> CommandResult { - let data = ctx.data_lock_read().await; - let client = data.get::().unwrap().clone(); - let client = client.lock().await; +// #[command] +// pub async fn search_impl(ctx: &FwContext, msg: &Message) -> CommandResult { +// let data = ctx.data_lock_read().await; +// let client = data.get::().unwrap().clone(); +// let client = client.lock().await; - let mut imgs = client.image_search(args, 0_u64).await?; +// let mut imgs = client.image_search(args, 0_u64).await?; - let mut response = String::new(); +// let mut response = String::new(); - imgs.truncate(3); +// imgs.truncate(3); - for mut post in imgs.into_iter() { - post.tags.sort(); - post.tags.truncate(8); +// for mut post in imgs.into_iter() { +// post.tags.sort(); +// post.tags.truncate(8); - response.push_str(&format!( - "<{}> - {} - <{}>\n", - format!("http://furbooru.org/{}", post.id), - post.tags.join(", "), - post.view_url, - )); - } +// response.push_str(&format!( +// "<{}> - {} - <{}>\n", +// format!("http://furbooru.org/{}", post.id), +// post.tags.join(", "), +// post.view_url, +// )); +// } - msg.reply(ctx, response).await?; +// msg.reply(ctx, response).await?; - Ok(()) -} +// Ok(()) +// } diff --git a/src/main.rs b/src/main.rs index 225de00..a6c5034 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,7 +80,7 @@ async fn main() -> Result<()> { } #[command] -async fn ping(ctx: &FwContext, msg: &Message, _args: &str) -> CommandResult { +async fn ping(ctx: &FwContext, msg: &Message) -> CommandResult { msg.reply(ctx, "pong").await?; let data = ctx.data_lock_read().await; @@ -91,7 +91,7 @@ async fn ping(ctx: &FwContext, msg: &Message, _args: &str) -> CommandResult { } #[command] -async fn command_counter(ctx: &FwContext, msg: &Message, _args: &str) -> CommandResult { +async fn command_counter(ctx: &FwContext, msg: &Message) -> CommandResult { let data = ctx.data_lock_read().await; let counter = data.get::().unwrap(); let count = counter.fetch_add(1, Ordering::SeqCst); @@ -106,7 +106,7 @@ async fn command_counter(ctx: &FwContext, msg: &Message, _args: &str) -> Command } #[command] -async fn current_front(ctx: &FwContext, msg: &Message, _args: &str) -> CommandResult { +async fn current_front(ctx: &FwContext, msg: &Message) -> CommandResult { let data = ctx.data_lock_read().await; let client = data.get::().unwrap().clone(); let client = client.lock().await;