Skip to content

Commit

Permalink
Heroku setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dracarys18 committed Apr 10, 2022
1 parent 9908085 commit 7f79ffb
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
worker: python3 main.py
worker: ./target/release/tweet_bot
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion runtime.txt

This file was deleted.

1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stable
6 changes: 2 additions & 4 deletions src/stream/stream_impl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::config::Config;
use crate::error::TweetResult;
use crate::utils::{get_media_urls, get_tweet_url, get_url_entity, tweet_has_media};
use crate::utils::{get_tweet_url, tweet_has_media};
use egg_mode::stream::{filter, StreamMessage};
use futures::TryStreamExt;
use teloxide::prelude2::*;
Expand All @@ -12,15 +12,13 @@ pub async fn stream_tweets(config: &Config, to_follow: Vec<u64>) -> TweetResult<
let bot = config.bot();
let stream = filter().follow(&to_follow).start(token);
stream
.try_for_each_concurrent(None, |t| async move {
.try_for_each(|t| async move {
if let StreamMessage::Tweet(tweet) = t {
let tweeter = tweet.user.as_ref().expect("Invalid User");
let name = &tweeter.name;
let _user_id = tweeter.id;
let tweet_url = get_tweet_url(&tweet).await.unwrap_or_default();
let text = escape(&tweet.text);
let urls = get_url_entity(&tweet).await.unwrap_or_default();
let media = get_media_urls(&tweet).await;
let message = format!("{}\nVia |<a href='{}'>{}</a>|", text, tweet_url, name);
//Don't send retweeted tweets and only send if the reply is from the current user (in case of threads)
if matches!(tweet.retweeted, Some(false))
Expand Down

0 comments on commit 7f79ffb

Please sign in to comment.