Directory structure changes
This commit is contained in:
parent
a85113cfd7
commit
28a0cf652c
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
irc = "0.15"
|
||||
irc = "0"
|
||||
tokio = { version = "1", features = ["rt", "macros", "signal"] }
|
||||
anyhow = "1"
|
||||
futures = "0"
|
||||
|
|
1
src/bots/leek.rs
Normal file
1
src/bots/leek.rs
Normal file
|
@ -0,0 +1 @@
|
|||
// TODO: port leek @karx
|
2
src/bots/mod.rs
Normal file
2
src/bots/mod.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
pub mod weeb;
|
||||
pub mod title;
|
|
@ -8,4 +8,6 @@ pub async fn get_waifu_pic(category: &str) -> anyhow::Result<Option<String>> {
|
|||
let value: Value = serde_json::from_str(&api_resp)?;
|
||||
let url = value["url"].as_str().map(|v| v.to_string());
|
||||
Ok(url)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: add owofier
|
11
src/main.rs
11
src/main.rs
|
@ -6,17 +6,16 @@ use irc::{
|
|||
proto::{Command, Message, Prefix},
|
||||
};
|
||||
use rspotify::Credentials;
|
||||
use titlebot::Titlebot;
|
||||
use bots::title::Titlebot;
|
||||
use bots::weeb;
|
||||
use tokio::select;
|
||||
use tracing::{debug, error, info, warn};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
mod waifu;
|
||||
mod titlebot;
|
||||
mod bots;
|
||||
|
||||
const HELP: &str = concat!(
|
||||
"a",
|
||||
"b"
|
||||
"=- \x1d\x02Ü\x02berbot\x0f ", env!("CARGO_PKG_VERSION"), " -="
|
||||
);
|
||||
|
||||
#[cfg(unix)]
|
||||
|
@ -150,7 +149,7 @@ async fn handle_privmsg(
|
|||
}
|
||||
"waifu" => {
|
||||
let category = remainder.unwrap_or("waifu");
|
||||
let url = waifu::get_waifu_pic(category).await?;
|
||||
let url = weeb::get_waifu_pic(category).await?;
|
||||
let response = url.as_ref().map(|v| v.as_str())
|
||||
.unwrap_or("Invalid category. Valid categories: https://waifu.pics/docs");
|
||||
state.client.send_privmsg(target, response)?;
|
||||
|
|
Loading…
Reference in a new issue