ready to roll

This commit is contained in:
VC
2023-11-08 10:00:34 +01:00
parent 5126083dc4
commit bf70072376
2 changed files with 33 additions and 4 deletions

View File

@@ -3,7 +3,8 @@ pub use config::{parse_toml, Config};
mod state;
pub use state::init_db;
use state::read_state;
#[allow(unused_imports)]
use state::{read_state, write_state};
mod mastodon;
use mastodon::get_mastodon_timeline_since;
@@ -12,6 +13,10 @@ pub use mastodon::register;
mod utils;
use utils::strip_everything;
mod twitter;
#[allow(unused_imports)]
use twitter::{post_tweet, upload_media};
use rusqlite::Connection;
#[tokio::main]
@@ -29,9 +34,13 @@ pub async fn run(config: &Config) {
for toot in timeline {
let Ok(tweet_content) = strip_everything(&toot.content, &toot.tags) else {
continue;
continue; // skip in case we cant strip something
};
println!("Toot: {}", toot.id);
println!("{:?}", tweet_content);
// if we wanted to cut toot in half, now would be the right time to do so
// treating medias (nothing for now)
let _tweet_id = post_tweet(&tweet_content, &[])
.await
.unwrap_or_else(|e| panic!("Cannot Tweet {}: {}", toot.id, e));
return;
}
}