diff --git a/scripts/seed_test_tweet_authors.sh b/scripts/seed_test_tweet_authors.sh index df7eaef..b0cdf07 100755 --- a/scripts/seed_test_tweet_authors.sh +++ b/scripts/seed_test_tweet_authors.sh @@ -13,10 +13,10 @@ echo "🔧 Generating seed SQL..." cat << 'EOF' > $SQL_FILE INSERT INTO tweet_authors ( id, name, username, followers_count, following_count, - tweet_count, listed_count, like_count, media_count, fetched_at + tweet_count, listed_count, like_count, media_count, fetched_at, is_ignored ) VALUES -('1862779229277954048', 'Yuvi Lightman', 'YuviLightman', 0, 0, 0, 0, 0, 0, NOW()) +('1862779229277954048', 'Yuvi Lightman', 'YuviLightman', 0, 0, 0, 0, 0, 0, NOW(), false) ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, username = EXCLUDED.username, @@ -26,7 +26,8 @@ ON CONFLICT (id) DO UPDATE SET listed_count = EXCLUDED.listed_count, like_count = EXCLUDED.like_count, media_count = EXCLUDED.media_count, - fetched_at = NOW(); + fetched_at = NOW(), + is_ignored = EXCLUDED.is_ignored; EOF echo "📦 Copying SQL file into container ($CONTAINER_NAME)..." diff --git a/src/services/telegram_service.rs b/src/services/telegram_service.rs index e01e4c0..f214e6b 100644 --- a/src/services/telegram_service.rs +++ b/src/services/telegram_service.rs @@ -24,7 +24,7 @@ struct MessagePayload<'a> { impl TelegramService { pub fn escape_markdown_v2(text: &str) -> String { text.replace("_", "\\_") - .replace("*", "\\*") + // .replace("*", "\\*") // We want to allow bolding with ** .replace("[", "\\[") .replace("]", "\\]") .replace("(", "\\(") diff --git a/src/services/tweet_synchronizer_service.rs b/src/services/tweet_synchronizer_service.rs index 3d0f085..e18837b 100644 --- a/src/services/tweet_synchronizer_service.rs +++ b/src/services/tweet_synchronizer_service.rs @@ -113,11 +113,20 @@ impl TweetSynchronizerService { let link = build_x_status_url(author_name, &tweet.id); + let escaped_link = TelegramService::escape_markdown_v2(&link); + let escaped_author = TelegramService::escape_markdown_v2(author_name); + let escaped_text = TelegramService::escape_markdown_v2(&tweet.text); + let escaped_posted_at = TelegramService::escape_markdown_v2(&tweet.created_at.to_rfc3339()); + let tg_message = format!( - "**Raid Target Found!**\n\n**Link**: {}\n**Author**: {}\n**Text**: {}\n**Impressions**: {}\n**Posted At**: {}", - &link, author_name, &tweet.text, tweet.impression_count, tweet.created_at + "*Raid Target Found\\!*\n\n*Link*: {}\n\n*Author*: {}\n\n*Text*: {}\n\n*Impressions*: {}\n\n*Posted At*: {}", + escaped_link, + escaped_author, + escaped_text, + tweet.impression_count, + escaped_posted_at ); - messages.push(TelegramService::escape_markdown_v2(&tg_message)); + messages.push(tg_message); } tokio::spawn(async move {