From a366ba9ca1fc1baa9db3b6f974578810f4d6c0eb Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 10 Jul 2023 23:40:31 +0200 Subject: [PATCH] Fix not fetching only local communities --- src/config/mod.rs | 3 ++- src/main.rs | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 841640e..9460de7 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1,7 +1,7 @@ use std::{fs::{self, OpenOptions}, path::Path, io::Write, thread::sleep, time}; use lemmy_api_common::{sensitive::Sensitive, post::CreatePost, community::{self, ListCommunities, ListCommunitiesResponse}}; -use lemmy_db_schema::newtypes::{LanguageId, CommunityId}; +use lemmy_db_schema::{newtypes::{LanguageId, CommunityId}, ListingType}; use serde_derive::{Deserialize, Serialize}; use url::Url; @@ -271,6 +271,7 @@ impl CommunitiesVector { pub(crate) fn load(&mut self, auth: &Sensitive, base: &String) { let params = ListCommunities { auth: Some(auth.clone()), + type_: Some(ListingType::Local), ..Default::default() }; diff --git a/src/main.rs b/src/main.rs index 3e9dbd1..4e825db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -134,6 +134,7 @@ fn run_bot(mut terminal: Terminal>) { loop { let _ = enable_raw_mode(); let _ = execute!(terminal.backend_mut(), EnterAlternateScreen, EnableMouseCapture); + this.run_once(old); // Update UI @@ -141,8 +142,8 @@ fn run_bot(mut terminal: Terminal>) { ui(f, &this); }).unwrap(); - thread::sleep(Duration::from_secs(5)); - + this.idle(); + disable_raw_mode().unwrap(); execute!( terminal.backend_mut(), @@ -150,8 +151,6 @@ fn run_bot(mut terminal: Terminal>) { DisableMouseCapture ).unwrap(); terminal.show_cursor().unwrap(); - - this.idle(); }