golgi/examples/ssb-invite.rs

33 lines
890 B
Rust

use async_std::stream::StreamExt;
use futures::pin_mut;
use std::process;
use golgi::error::GolgiError;
use golgi::messages::SsbMessageContent;
use golgi::sbot::Sbot;
use golgi::sbot::{FriendsHopsOpts, SubsetQuery, SubsetQueryOptions};
async fn run() -> Result<(), GolgiError> {
let mut sbot_client = Sbot::init(None, None).await?;
let id = sbot_client.whoami().await?;
println!("whoami: {}", id);
let invite_link = sbot_client.invite_create(100).await?;
println!("invite: {:?}", invite_link);
let test_invite = "net:ssbroom2.commoninternet.net:8009~shs:wm8a1zHWjtESv4XSKMWU/rPRhnAoAiSAe4hQSY0UF5A=";
let mref = sbot_client.invite_use(test_invite).await?;
println!("mref: {:?}", mref);
Ok(())
}
#[async_std::main]
async fn main() {
if let Err(e) = run().await {
eprintln!("Application error: {}", e);
process::exit(1);
}
}