Compare commits

..

4 Commits

Author SHA1 Message Date
prcrst
cda9f86b92 Spoilers are guaranteed 2024-03-08 09:29:39 +01:00
prcrst
36bda1e89f A little more chatty on the console 2024-03-08 09:29:12 +01:00
prcrst
3baaf86132 Fix authentication 2024-03-08 09:28:55 +01:00
prcrst
01822e79bb Update dependencies 2024-03-08 09:28:32 +01:00
3 changed files with 456 additions and 1227 deletions

1672
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
chrono = "0.4.26"
reqwest = { version ="0.11.18", features = ["json"]}
tokio = { version = "1" }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
serde = { version = "1.0.104", features = ["derive"] }
serde_json = "1.0.48"
lemmy_api_common = "0.18.1"
lemmy_api_common = "0.19.3"

View File

@ -55,19 +55,19 @@ async fn post_to_lemmy(
)
.as_ref(),
)?;
println!("{}", title);
println!("Using title: {}", title);
let params = CreatePost {
community_id,
name: title,
url: Some(url),
body: Some("Post your results and discuss your guesses. Have fun! \nNote: there might be spoilers in the thread.".to_owned()),
auth,
body: Some("Post your results and discuss your guesses. Have fun! \nNote: there _will_ be spoilers in the thread, so try it first.".to_owned()),
..Default::default()
};
let response = client
.post(helper::api_url("post"))
.header("Authorization", "Bearer ".to_owned() + &auth)
.json(&params)
.send()
.await?;
@ -94,6 +94,7 @@ async fn get_latest_post(
client: &Client,
user: &Sensitive<String>,
) -> Result<Option<Post>, Box<dyn std::error::Error>> {
println!("Checking if already posted...");
let params = GetPersonDetails {
username: Some(user.to_string()),
sort: Some(SortType::New),