start making checking for hits an impl method
This commit is contained in:
parent
18d6842f95
commit
065e655773
|
@ -336,8 +336,7 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "furbooru"
|
name = "furbooru"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/Xe/furbooru#1af4851486d5f104235c492da29e81809dfb00b1"
|
||||||
checksum = "1ef1f8a2e91bead257f057491c9581bfee0e9d7eef219ffafd88408fd4a3c818"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "tron"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Christine Dodrill <me@christine.website>"]
|
authors = ["Christine Dodrill <me@christine.website>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
repository = "https://tulpa.dev/cadey/tron"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
@ -10,7 +11,6 @@ edition = "2018"
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
async-trait = "0"
|
async-trait = "0"
|
||||||
envy = "0.4"
|
envy = "0.4"
|
||||||
furbooru = "0.3"
|
|
||||||
kankyo = "*"
|
kankyo = "*"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pretty_env_logger = "0.4"
|
pretty_env_logger = "0.4"
|
||||||
|
@ -21,3 +21,4 @@ tokio = { version = "0.2", features = ["macros"] }
|
||||||
|
|
||||||
# git deps
|
# 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" }
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -4,13 +4,14 @@ use discord_webhook::Body;
|
||||||
use furbooru::{Client, Comment, FirehoseAdaptor, Image};
|
use furbooru::{Client, Comment, FirehoseAdaptor, Image};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
pub(crate) struct Config {
|
pub(crate) struct Config {
|
||||||
discord_webhook_url: String,
|
discord_webhook_url: String,
|
||||||
furbooru_api_key: String,
|
furbooru_api_key: String,
|
||||||
bot_owner_furbooru_account: String,
|
bot_owner_furbooru_account: String,
|
||||||
regexes: std::path::PathBuf,
|
regexes: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {}
|
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);
|
struct Rules(Vec<CompiledRule>, Config);
|
||||||
|
|
||||||
|
impl Rules {
|
||||||
|
fn check(&self, text: String) -> Option<Vec<Hit>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl FirehoseAdaptor for Rules {
|
impl FirehoseAdaptor for Rules {
|
||||||
async fn image_created(&self, img: Image) -> Result<()> {
|
async fn image_created(&self, img: Image) -> Result<()> {
|
||||||
|
|
Loading…
Reference in New Issue