Merge pull request #56 from Trivernis/develop

Fix issues with animethemes
develop v0.10.2
Julius Riegel 2 years ago committed by GitHub
commit 6c100ad1e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

50
Cargo.lock generated

@ -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",
]

@ -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 <trivernis@protonmail.com>"]
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"

@ -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 {

@ -55,6 +55,11 @@ fn create_theme_pages(anime_entries: Vec<Anime>, nsfw: bool) -> Vec<Page<'static
}
}
}
if pages.is_empty() {
let mut message = CreateMessage::default();
message.embed(|e| e.description("No themes found!"));
pages.push(Page::Static(message));
}
pages
}

Loading…
Cancel
Save