From c217e6555779d180dab1212e7dca1bf8ca1330a6 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 3 Jul 2022 17:03:26 +0200 Subject: [PATCH] Fix issues with animethemes Signed-off-by: trivernis --- Cargo.lock | 50 +++++++++++++++----------------------- Cargo.toml | 4 +-- src/commands/weeb/theme.rs | 16 ++++++------ src/messages/theme.rs | 5 ++++ 4 files changed, 35 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65aa271..1e08471 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,13 +52,14 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" [[package]] name = "animethemes-rs" -version = "0.3.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b717f29f786445f30818874943f9c7c6ad370804cc7a345d3f0bae3c85163d17" +checksum = "1b533eb7d6c73c43695c40e88f3ed40a859f9b47d3c4f0ac00e7ec4576a5f6fa" dependencies = [ "reqwest", "serde", "thiserror", + "tracing", ] [[package]] @@ -1179,7 +1180,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.3", + "tokio-util", "tracing", ] @@ -2354,9 +2355,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.10" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" +checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" dependencies = [ "base64 0.13.0", "bytes 1.1.0", @@ -2386,7 +2387,8 @@ dependencies = [ "tokio", "tokio-native-tls", "tokio-rustls 0.23.4", - "tokio-util 0.6.10", + "tokio-util", + "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -2476,9 +2478,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "0.3.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" +checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" dependencies = [ "base64 0.13.0", ] @@ -2812,9 +2814,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.137" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47" dependencies = [ "serde_derive", ] @@ -2832,9 +2834,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c" dependencies = [ "proc-macro2", "quote", @@ -3627,20 +3629,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes 1.1.0", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.3" @@ -3663,9 +3651,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" +checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ "cfg-if 1.0.0", "log", @@ -3687,11 +3675,11 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.26" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" dependencies = [ - "lazy_static", + "once_cell", "valuable", ] diff --git a/Cargo.toml b/Cargo.toml index 5b9c171..1ae0bba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members=["bot-coreutils", "bot-database", "bot-database/migration", "."] [package] name = "tobi-rs" -version = "0.10.1" +version = "0.10.2" authors = ["trivernis "] edition = "2018" @@ -38,7 +38,7 @@ trigram = "0.4.4" typemap_rev = "0.1.5" youtube-metadata = "0.2.0" xkcd-search = "0.1.2" -animethemes-rs = "0.3.0" +animethemes-rs = "0.4.3" build-time = "0.1.1" tracing-subscriber = { version = "0.3.11", features = ["env-filter"] } tracing = "0.1.34" diff --git a/src/commands/weeb/theme.rs b/src/commands/weeb/theme.rs index 049d737..01dc000 100644 --- a/src/commands/weeb/theme.rs +++ b/src/commands/weeb/theme.rs @@ -1,6 +1,6 @@ use crate::messages::theme::create_theme_menu; use animethemes_rs::client::AnimeThemesClient; -use animethemes_rs::includes; +use animethemes_rs::includes::{AnimeInclude, SearchIncludes}; use serenity::client::Context; use serenity::framework::standard::macros::command; use serenity::framework::standard::{Args, CommandResult}; @@ -20,12 +20,14 @@ async fn theme(ctx: &Context, msg: &Message, args: Args) -> CommandResult { let search_results = client .search( query, - &[includes::ANIME], - &[ - "animethemes", - "animethemes.animethemeentries", - "animethemes.animethemeentries.videos", - ], + &["anime"], + SearchIncludes { + anime: AnimeInclude::default() + .themes() + .themes_entries() + .themes_entries_videos(), + ..Default::default() + }, ) .await?; if let Some(anime) = search_results.anime { diff --git a/src/messages/theme.rs b/src/messages/theme.rs index 4a9e129..165d5bf 100644 --- a/src/messages/theme.rs +++ b/src/messages/theme.rs @@ -55,6 +55,11 @@ fn create_theme_pages(anime_entries: Vec, nsfw: bool) -> Vec