Skip to content

Commit

Permalink
Fixed bot not sending tweeets if keywords are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dracarys18 committed Apr 11, 2022
1 parent 7f1938b commit 1ca581b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/stream/stream_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ pub async fn stream_tweets(config: &Config, to_follow: &[u64]) -> TweetResult<()
.to_lowercase()
.split_whitespace()
.any(|w| config.keywords.contains(&w.to_string()));
if config.keywords.is_empty() || contains_keyword {
if (config.keywords.is_empty() || config.keywords.eq(&vec![""]))
|| contains_keyword
{
bot.send_message(config.chat_id, message)
.parse_mode(ParseMode::Html)
.disable_web_page_preview(preview)
.await
.expect("Failed to send a message");
eprintln!("Send {} to {},", tweet_url, config.chat_id);
eprintln!("Sent {} to {},", tweet_url, config.chat_id);
}
}
}
Expand Down

0 comments on commit 1ca581b

Please sign in to comment.