start making checking for hits an impl method

This commit is contained in:
Cadey Ratio 2020-07-04 15:09:40 -04:00
parent 18d6842f95
commit 065e655773
3 changed files with 17 additions and 5 deletions

3
Cargo.lock generated
View File

@ -336,8 +336,7 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "furbooru"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ef1f8a2e91bead257f057491c9581bfee0e9d7eef219ffafd88408fd4a3c818"
source = "git+https://github.com/Xe/furbooru#1af4851486d5f104235c492da29e81809dfb00b1"
dependencies = [
"anyhow",
"async-trait",

View File

@ -3,6 +3,7 @@ name = "tron"
version = "0.1.0"
authors = ["Christine Dodrill <me@christine.website>"]
edition = "2018"
repository = "https://tulpa.dev/cadey/tron"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -10,7 +11,6 @@ edition = "2018"
anyhow = "1"
async-trait = "0"
envy = "0.4"
furbooru = "0.3"
kankyo = "*"
log = "0.4"
pretty_env_logger = "0.4"
@ -20,4 +20,5 @@ serde_dhall = "0.5.3"
tokio = { version = "0.2", features = ["macros"] }
# git deps
discord_webhook = { git = "https://github.com/Xe/withinbot", branch = "main"}
discord_webhook = { git = "https://github.com/Xe/withinbot", branch = "main" }
furbooru = { git = "https://github.com/Xe/furbooru", branch = "master" }

View File

@ -4,13 +4,14 @@ use discord_webhook::Body;
use furbooru::{Client, Comment, FirehoseAdaptor, Image};
use regex::Regex;
use serde::Deserialize;
use std::path::PathBuf;
#[derive(Deserialize, Debug, Clone)]
pub(crate) struct Config {
discord_webhook_url: String,
furbooru_api_key: String,
bot_owner_furbooru_account: String,
regexes: std::path::PathBuf,
regexes: PathBuf,
}
impl Config {}
@ -37,8 +38,19 @@ pub(crate) fn user_agent(username: String) -> String {
)
}
struct Hit{
matches: String,
why: String,
}
struct Rules(Vec<CompiledRule>, Config);
impl Rules {
fn check(&self, text: String) -> Option<Vec<Hit>> {
None
}
}
#[async_trait]
impl FirehoseAdaptor for Rules {
async fn image_created(&self, img: Image) -> Result<()> {