pleroma groups!!!!!! try it ->
https://piggo.space/hob
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.0 KiB
85 lines
2.0 KiB
#![deny(unused_must_use)]
|
|
|
|
#[macro_use]
|
|
extern crate log;
|
|
#[macro_use]
|
|
extern crate smart_default;
|
|
#[macro_use]
|
|
extern crate serde;
|
|
#[macro_use]
|
|
extern crate thiserror;
|
|
extern crate elefren;
|
|
|
|
use elefren::entities::event::Event;
|
|
use log::LevelFilter;
|
|
use elefren::entities::notification::NotificationType;
|
|
use elefren::entities::account::Account;
|
|
use elefren::status_builder::Visibility;
|
|
use elefren::{Registration, Scopes, StatusBuilder, FediClient};
|
|
use tokio_stream::{Stream, StreamExt};
|
|
use elefren::scopes;
|
|
use crate::store::{NewGroupOptions, StoreOptions};
|
|
use elefren::debug::NotificationDisplay;
|
|
|
|
mod store;
|
|
mod group_handle;
|
|
mod utils;
|
|
mod command;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
env_logger::Builder::new()
|
|
.filter_level(LevelFilter::Debug)
|
|
.write_style(env_logger::WriteStyle::Always)
|
|
.filter_module("rustls", LevelFilter::Warn)
|
|
.filter_module("reqwest", LevelFilter::Warn)
|
|
.init();
|
|
|
|
let store = store::ConfigStore::new(StoreOptions {
|
|
store_path: "groups.json".to_string(),
|
|
save_pretty: true
|
|
}).await?;
|
|
|
|
/*
|
|
let mut new_group = store.auth_new_group(NewGroupOptions {
|
|
server: "https://botsin.space".to_string(),
|
|
acct: "betty@botsin.space".to_string()
|
|
}).await?;
|
|
// */
|
|
|
|
let mut groups = store.spawn_groups().await;
|
|
//groups.push(new_group);
|
|
|
|
|
|
/*
|
|
let mut betty = groups.remove(0);
|
|
|
|
let notifications = betty.client.notifications().await?;
|
|
let mut iter = notifications.items_iter();
|
|
|
|
let mut num = 0;
|
|
while let Some(n) = iter.next_item().await {
|
|
debug!("A notification: {}", NotificationDisplay(&n));
|
|
num += 1;
|
|
if num > 10 {
|
|
break;
|
|
}
|
|
}
|
|
|
|
return Ok(());
|
|
*/
|
|
|
|
let mut handles = vec![];
|
|
|
|
for mut g in groups {
|
|
handles.push(tokio::spawn(async move {
|
|
g.run().await
|
|
}));
|
|
}
|
|
|
|
futures::future::join_all(handles).await;
|
|
|
|
println!("Main loop ended!");
|
|
|
|
Ok(())
|
|
}
|
|
|