From cdf7dc70c1fb9b26007ce83a35cdc5887c5203b2 Mon Sep 17 00:00:00 2001 From: VC Date: Tue, 21 Nov 2023 13:27:37 +0100 Subject: [PATCH] =?UTF-8?q?feat:=E2=80=AFadd=20#NoTweet=20to=20skip=20toot?= =?UTF-8?q?=20from=20being=20tweeted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a7b5dce..b6e6237 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -972,7 +972,7 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "oolatoocs" -version = "1.3.1" +version = "1.4.0" dependencies = [ "clap", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 0fa65d5..70884ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oolatoocs" -version = "1.3.1" +version = "1.4.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/lib.rs b/src/lib.rs index 6e6069e..c493b2c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,6 +36,12 @@ pub async fn run(config: &Config) { .unwrap_or_else(|e| panic!("Cannot get instance: {}", e)); for toot in timeline { + // detecting tag #NoTweet and skipping the toot + if toot.tags.iter().any(|f| &f.name == "notweet") { + continue; + } + + // form tweet_content and strip everything useless in it let Ok(mut tweet_content) = strip_everything(&toot.content, &toot.tags) else { continue; // skip in case we can’t strip something };