mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-20 17:11:19 +02:00
refactor: optimize import and last_tweet_id var
This commit is contained in:
@@ -33,10 +33,7 @@ pub async fn run(config: Config) {
|
|||||||
// open the SQLite connection
|
// open the SQLite connection
|
||||||
let conn = Connection::open(&config.scootaloo.db_path).unwrap();
|
let conn = Connection::open(&config.scootaloo.db_path).unwrap();
|
||||||
// retrieve the last tweet ID for the username
|
// retrieve the last tweet ID for the username
|
||||||
let last_tweet_id = match read_state(&conn, None).unwrap() {
|
let last_tweet_id = read_state(&conn, None).unwrap().map(|s| s.tweet_id);
|
||||||
Some(i) => Some(i.tweet_id),
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
// get OAuth2 token
|
// get OAuth2 token
|
||||||
let token = get_oauth2_token(&config.twitter);
|
let token = get_oauth2_token(&config.twitter);
|
||||||
|
@@ -17,7 +17,6 @@ use elefren::{
|
|||||||
scopes::Scopes,
|
scopes::Scopes,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Decodes the Twitter mention to something that will make sense once Twitter has joined the
|
/// Decodes the Twitter mention to something that will make sense once Twitter has joined the
|
||||||
/// Fediverse
|
/// Fediverse
|
||||||
fn twitter_mentions(ums: &Vec<MentionEntity>) -> HashMap<String, String> {
|
fn twitter_mentions(ums: &Vec<MentionEntity>) -> HashMap<String, String> {
|
||||||
|
@@ -1,12 +1,8 @@
|
|||||||
// auto-imports
|
|
||||||
use crate::ScootalooError;
|
use crate::ScootalooError;
|
||||||
use crate::config::TwitterConfig;
|
use crate::config::TwitterConfig;
|
||||||
use crate::util::cache_media;
|
use crate::util::cache_media;
|
||||||
|
|
||||||
// std
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
// egg-mode
|
|
||||||
use egg_mode::{
|
use egg_mode::{
|
||||||
Token,
|
Token,
|
||||||
KeyPair,
|
KeyPair,
|
||||||
|
@@ -1,11 +1,6 @@
|
|||||||
// std
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use crate::ScootalooError;
|
use crate::ScootalooError;
|
||||||
|
|
||||||
// reqwest
|
|
||||||
use reqwest::Url;
|
use reqwest::Url;
|
||||||
|
|
||||||
// tokio
|
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::copy,
|
io::copy,
|
||||||
fs::{File, create_dir_all},
|
fs::{File, create_dir_all},
|
||||||
|
Reference in New Issue
Block a user