From 28a0cf652c12de697d3a9b9500982ca30b6ef5cc Mon Sep 17 00:00:00 2001 From: lemon-sh Date: Mon, 27 Dec 2021 22:24:15 +0100 Subject: [PATCH] Directory structure changes --- Cargo.toml | 2 +- src/bots/leek.rs | 1 + src/bots/mod.rs | 2 ++ src/{titlebot.rs => bots/title.rs} | 0 src/{waifu.rs => bots/weeb.rs} | 4 +++- src/main.rs | 11 +++++------ 6 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 src/bots/leek.rs create mode 100644 src/bots/mod.rs rename src/{titlebot.rs => bots/title.rs} (100%) rename src/{waifu.rs => bots/weeb.rs} (94%) diff --git a/Cargo.toml b/Cargo.toml index 494d773..2174851 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/bots/leek.rs b/src/bots/leek.rs new file mode 100644 index 0000000..95ee0a7 --- /dev/null +++ b/src/bots/leek.rs @@ -0,0 +1 @@ +// TODO: port leek @karx diff --git a/src/bots/mod.rs b/src/bots/mod.rs new file mode 100644 index 0000000..0d8a9fc --- /dev/null +++ b/src/bots/mod.rs @@ -0,0 +1,2 @@ +pub mod weeb; +pub mod title; diff --git a/src/titlebot.rs b/src/bots/title.rs similarity index 100% rename from src/titlebot.rs rename to src/bots/title.rs diff --git a/src/waifu.rs b/src/bots/weeb.rs similarity index 94% rename from src/waifu.rs rename to src/bots/weeb.rs index 4cdc91f..ac29b7b 100644 --- a/src/waifu.rs +++ b/src/bots/weeb.rs @@ -8,4 +8,6 @@ pub async fn get_waifu_pic(category: &str) -> anyhow::Result> { let value: Value = serde_json::from_str(&api_resp)?; let url = value["url"].as_str().map(|v| v.to_string()); Ok(url) -} \ No newline at end of file +} + +// TODO: add owofier \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 0f63279..b867c39 100644 --- a/src/main.rs +++ b/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)?;