mirror of
https://framagit.org/veretcle/oolatoocs.git
synced 2025-07-20 20:41:17 +02:00
feat: threads
This commit is contained in:
13
src/lib.rs
13
src/lib.rs
@@ -44,6 +44,7 @@ pub async fn run(config: &Config) {
|
||||
|
||||
// if we wanted to cut toot in half, now would be the right time to do so
|
||||
|
||||
// treats media
|
||||
for media in toot.media_attachments {
|
||||
let id = match media.r#type {
|
||||
AttachmentType::Image => {
|
||||
@@ -77,12 +78,20 @@ pub async fn run(config: &Config) {
|
||||
medias.push(id);
|
||||
}
|
||||
|
||||
println!("{:?}", medias);
|
||||
// threads if necessary
|
||||
let reply_to = toot.in_reply_to_id.and_then(|t| {
|
||||
read_state(&conn, Some(t.parse::<u64>().unwrap()))
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|s| s.tweet_id)
|
||||
});
|
||||
|
||||
let tweet_id = post_tweet(&config.twitter, &tweet_content, &medias)
|
||||
// posts corresponding tweet
|
||||
let tweet_id = post_tweet(&config.twitter, &tweet_content, &medias, &reply_to)
|
||||
.await
|
||||
.unwrap_or_else(|e| panic!("Cannot Tweet {}: {}", toot.id, e));
|
||||
|
||||
// writes the current state of the tweet
|
||||
write_state(
|
||||
&conn,
|
||||
TweetToToot {
|
||||
|
Reference in New Issue
Block a user