All basic functions plus guide README to use
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
use anyhow::Result;
|
||||
use nostr_sdk::prelude::*;
|
||||
use anyhow::Result; // <--- Hinzufügen
|
||||
|
||||
// Das Result hier bezieht sich jetzt auf anyhow::Result
|
||||
/// A simplified structure for a Text Post (Kind 1)
|
||||
/// Contains the ID, Author, content, and timestamp.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Post {
|
||||
pub id: EventId,
|
||||
pub author: PublicKey,
|
||||
pub content: String,
|
||||
pub created_at: Timestamp,
|
||||
}
|
||||
|
||||
/// Publishes a text note (Kind 1) to the connected relays.
|
||||
pub async fn publish_text(client: &Client, content: &str) -> Result<EventId> {
|
||||
let builder = EventBuilder::text_note(content);
|
||||
let output = client.send_event_builder(builder).await?;
|
||||
Ok(*output.id())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user