From 065e655773f68a37cbdd7995a4af1268028669f0 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sat, 4 Jul 2020 15:09:40 -0400 Subject: [PATCH] start making checking for hits an impl method --- Cargo.lock | 3 +-- Cargo.toml | 5 +++-- src/main.rs | 14 +++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0bb2a70..2af6cef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index 37d67a6..923d42e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "tron" version = "0.1.0" authors = ["Christine Dodrill "] 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" } diff --git a/src/main.rs b/src/main.rs index d1d3859..2997937 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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, Config); +impl Rules { + fn check(&self, text: String) -> Option> { + None + } +} + #[async_trait] impl FirehoseAdaptor for Rules { async fn image_created(&self, img: Image) -> Result<()> {