Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
f3bb504cfd | |||
42aff098bd | |||
204d413779 | |||
10111ff612 |
4 changed files with 14 additions and 11 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -52,7 +52,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "aob-lemmy-bot"
|
||||
version = "3.2.2"
|
||||
version = "3.3.1"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"chrono",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
authors = ["Neshura"]
|
||||
name = "aob-lemmy-bot"
|
||||
version = "3.2.2"
|
||||
version = "3.3.1"
|
||||
edition = "2021"
|
||||
description = "Bot for automatically posting new chapters of 'Ascendance of a Bookworm' released by J-Novel Club"
|
||||
license = "GPL-3.0-or-later"
|
||||
|
|
|
@ -81,7 +81,10 @@ impl Bot {
|
|||
loop {
|
||||
let mut lemmy = match Lemmy::new(&self.shared_config).await {
|
||||
Ok(data) => data,
|
||||
Err(_) => continue,
|
||||
Err(_) => {
|
||||
sleep(Duration::seconds(10).to_std().unwrap()).await;
|
||||
continue;
|
||||
},
|
||||
};
|
||||
|
||||
lemmy.get_communities().await;
|
||||
|
|
16
src/lemmy.rs
16
src/lemmy.rs
|
@ -227,7 +227,7 @@ impl Lemmy {
|
|||
};
|
||||
|
||||
let response = match HTTP_CLIENT
|
||||
.post(read_config.instance.to_owned() + "/api/v3/user/login")
|
||||
.post(read_config.instance.to_owned() + "/api/alpha/user/login")
|
||||
.json(&login_params)
|
||||
.send()
|
||||
.await
|
||||
|
@ -268,12 +268,12 @@ impl Lemmy {
|
|||
}
|
||||
|
||||
pub(crate) async fn logout(&self) {
|
||||
let _ = self.post_data_json("/api/v3/user/logout", &"").await;
|
||||
let _ = self.post_data_json("/api/alpha/user/logout", &"").await;
|
||||
}
|
||||
|
||||
|
||||
pub(crate) async fn post(&self, post: CreatePost) -> Option<PostId> {
|
||||
let response: String = match self.post_data_json("/api/v3/post", &post).await {
|
||||
let response: String = match self.post_data_json("/api/alpha/post", &post).await {
|
||||
Some(data) => data,
|
||||
None => return None,
|
||||
};
|
||||
|
@ -286,7 +286,7 @@ impl Lemmy {
|
|||
}
|
||||
|
||||
async fn feature(&self, params: FeaturePost) -> Option<PostView> {
|
||||
let response: String = match self.post_data_json("/api/v3/post/feature", ¶ms).await {
|
||||
let response: String = match self.post_data_json("/api/alpha/post/feature", ¶ms).await {
|
||||
Some(data) => data,
|
||||
None => return None,
|
||||
};
|
||||
|
@ -323,7 +323,7 @@ impl Lemmy {
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
let response: String = match self.get_data_query("/api/v3/post/list", &list_params).await {
|
||||
let response: String = match self.get_data_query("/api/alpha/post/list", &list_params).await {
|
||||
Some(data) => data,
|
||||
None => return None,
|
||||
};
|
||||
|
@ -346,7 +346,7 @@ impl Lemmy {
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
let response: String = match self.get_data_query("/api/v3/post/list", &list_params).await {
|
||||
let response: String = match self.get_data_query("/api/alpha/post/list", &list_params).await {
|
||||
Some(data) => data,
|
||||
None => return None,
|
||||
};
|
||||
|
@ -369,7 +369,7 @@ impl Lemmy {
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
let response: String = match self.get_data_query("/api/v3/community/list", &list_params).await {
|
||||
let response: String = match self.get_data_query("/api/alpha/community/list", &list_params).await {
|
||||
Some(data) => data,
|
||||
None => return,
|
||||
};
|
||||
|
@ -404,7 +404,7 @@ impl Lemmy {
|
|||
page_cursor: None,
|
||||
};
|
||||
|
||||
let response: String = match self.get_data_query("/api/v3/post/list", &get_params).await {
|
||||
let response: String = match self.get_data_query("/api/alpha/post/list", &get_params).await {
|
||||
Some(data) => data,
|
||||
None => {
|
||||
error!("Unable to query post list");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue