17 lines
464 B
Rust
17 lines
464 B
Rust
// Scuttlebutt functionality.
|
|
|
|
use async_std::task;
|
|
use golgi::Sbot;
|
|
|
|
/// Follow a peer.
|
|
pub fn follow_peer(public_key: &str) -> Result<String, String> {
|
|
task::block_on(async {
|
|
let mut sbot_client = Sbot::init(None, None).await.map_err(|e| e.to_string())?;
|
|
|
|
match sbot_client.follow(public_key).await {
|
|
Ok(_) => Ok("Followed peer".to_string()),
|
|
Err(e) => Err(format!("Failed to follow peer: {}", e)),
|
|
}
|
|
})
|
|
}
|