feat: add #NoTweet to skip toot from being tweeted

This commit is contained in:
VC
2023-11-21 13:27:37 +01:00
parent b1aed34f3c
commit cdf7dc70c1
3 changed files with 8 additions and 2 deletions

2
Cargo.lock generated
View File

@@ -972,7 +972,7 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]] [[package]]
name = "oolatoocs" name = "oolatoocs"
version = "1.3.1" version = "1.4.0"
dependencies = [ dependencies = [
"clap", "clap",
"env_logger", "env_logger",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "oolatoocs" name = "oolatoocs"
version = "1.3.1" version = "1.4.0"
edition = "2021" edition = "2021"
# 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

View File

@@ -36,6 +36,12 @@ pub async fn run(config: &Config) {
.unwrap_or_else(|e| panic!("Cannot get instance: {}", e)); .unwrap_or_else(|e| panic!("Cannot get instance: {}", e));
for toot in timeline { 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 { let Ok(mut tweet_content) = strip_everything(&toot.content, &toot.tags) else {
continue; // skip in case we cant strip something continue; // skip in case we cant strip something
}; };