Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions scripts/seed_test_tweet_authors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)..."
Expand Down
2 changes: 1 addition & 1 deletion src/services/telegram_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("(", "\\(")
Expand Down
15 changes: 12 additions & 3 deletions src/services/tweet_synchronizer_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down