mirror of
https://framagit.org/veretcle/oolatoocs.git
synced 2025-07-20 20:41:17 +02:00
feat: add the ability to rewrite an edited toot
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::config::MastodonConfig;
|
||||
use chrono::{DateTime, Utc};
|
||||
use megalodon::{
|
||||
entities::{Status, StatusVisibility},
|
||||
generator,
|
||||
@@ -10,16 +11,29 @@ use megalodon::{
|
||||
use std::error::Error;
|
||||
use std::io::stdin;
|
||||
|
||||
pub async fn get_mastodon_timeline_since(
|
||||
config: &MastodonConfig,
|
||||
id: Option<u64>,
|
||||
) -> Result<Vec<Status>, Box<dyn Error>> {
|
||||
let mastodon = Mastodon::new(
|
||||
/// Get Mastodon Object instance
|
||||
pub fn get_mastodon_instance(config: &MastodonConfig) -> Mastodon {
|
||||
Mastodon::new(
|
||||
config.base.to_string(),
|
||||
Some(config.token.to_string()),
|
||||
None,
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the edited_at field from the specified toot
|
||||
pub async fn get_status_edited_at(mastodon: &Mastodon, t: u64) -> Option<DateTime<Utc>> {
|
||||
mastodon
|
||||
.get_status(t.to_string())
|
||||
.await
|
||||
.ok()
|
||||
.and_then(|t| t.json.edited_at)
|
||||
}
|
||||
|
||||
/// Get the home timeline since the last toot
|
||||
pub async fn get_mastodon_timeline_since(
|
||||
mastodon: &Mastodon,
|
||||
id: Option<u64>,
|
||||
) -> Result<Vec<Status>, Box<dyn Error>> {
|
||||
let input_options = GetHomeTimelineInputOptions {
|
||||
only_media: Some(false),
|
||||
limit: None,
|
||||
|
Reference in New Issue
Block a user