All basic functions plus guide README to use

This commit is contained in:
Malte Schröder
2025-12-19 20:25:39 +01:00
parent db48f07b78
commit 397635d43e
12 changed files with 486 additions and 22 deletions

View File

@@ -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())
}
}