7 Commits

Author SHA1 Message Date
VC
92d5fdffad Merge branch 'fix_lang' into 'master'
fix: visibility

See merge request veretcle/scootaloo!33
2022-11-19 16:46:06 +00:00
VC
331adec60f fix: visibility 2022-11-19 17:45:52 +01:00
VC
9a341310da Merge branch 'fix_lang' into 'master'
Fix lang

See merge request veretcle/scootaloo!32
2022-11-19 16:39:05 +00:00
VC
2c77a0e5fc chore: bump version 2022-11-19 17:34:09 +01:00
VC
032e3cf8dd fix: lang is not the default one anymore 2022-11-19 17:33:50 +01:00
VC
a854243cf6 Merge branch 'command_help' into 'master'
fix: remove unnecessary information in help commands

See merge request veretcle/scootaloo!31
2022-11-18 12:31:17 +00:00
VC
b33ffa4401 fix: remove unnecessary information in help commands 2022-11-18 13:27:18 +01:00
4 changed files with 15 additions and 11 deletions

2
Cargo.lock generated
View File

@@ -2103,7 +2103,7 @@ dependencies = [
[[package]]
name = "scootaloo"
version = "0.9.2"
version = "0.9.4"
dependencies = [
"chrono",
"clap",

View File

@@ -1,6 +1,6 @@
[package]
name = "scootaloo"
version = "0.9.2"
version = "0.9.4"
authors = ["VC <veretcle+framagit@mateu.be>"]
edition = "2021"

View File

@@ -19,14 +19,13 @@ mod state;
pub use state::{init_db, migrate_db};
use state::{read_state, write_state, TweetToToot};
use elefren::{prelude::*, status_builder::StatusBuilder};
use elefren::{prelude::*, status_builder::StatusBuilder, Language};
use futures::StreamExt;
use log::info;
use rusqlite::Connection;
use std::sync::Arc;
use tokio::{spawn, sync::Mutex};
use futures::StreamExt;
const DEFAULT_RATE_LIMIT: usize = 4;
const DEFAULT_PAGE_SIZE: i32 = 200;
@@ -57,7 +56,6 @@ pub async fn run(config: Config) {
spawn(async move {
info!("Starting treating {}", &mastodon_config.twitter_screen_name);
// retrieve the last tweet ID for the username
let lconn = task_conn.lock().await;
let last_tweet_id = read_state(&lconn, &mastodon_config.twitter_screen_name, None)?
@@ -78,6 +76,7 @@ pub async fn run(config: Config) {
for tweet in &feed {
info!("Treating Tweet {} inside feed", tweet.id);
let lconn = task_conn.lock().await;
// initiate the toot_reply_id var and retrieve the corresponding toot_id
let toot_reply_id: Option<String> = tweet.in_reply_to_user_id.and_then(|_| {
@@ -106,10 +105,18 @@ pub async fn run(config: Config) {
status_builder.status(&status_text).media_ids(status_medias);
// theard if necessary
if let Some(i) = toot_reply_id {
status_builder.in_reply_to(&i);
}
// language if any
if let Some(l) = &tweet.lang {
if let Some(r) = Language::from_639_1(l) {
status_builder.language(r);
}
}
// can be activated for test purposes
// status_builder.visibility(elefren::status_builder::Visibility::Private);

View File

@@ -15,10 +15,7 @@ fn main() {
.short('c')
.long("config")
.value_name("CONFIG_FILE")
.help(&format!(
"TOML config file for scootaloo (default {})",
DEFAULT_CONFIG_PATH
))
.help("TOML config file for scootaloo")
.num_args(1)
.default_value(DEFAULT_CONFIG_PATH)
.display_order(1),
@@ -28,7 +25,7 @@ fn main() {
.short('l')
.long("loglevel")
.value_name("LOGLEVEL")
.help("Log level.Valid values are: Off, Warn, Error, Info, Debug")
.help("Log level")
.num_args(1)
.value_parser(["Off", "Warn", "Error", "Info", "Debug"])
.display_order(2),