-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2022-2023 Yuki Kishimoto | ||
// Copyright (c) 2023-2024 Rust Nostr Developers | ||
// Distributed under the MIT software license | ||
|
||
use nostr_sdk::prelude::*; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
tracing_subscriber::fmt::init(); | ||
|
||
let keys = Keys::generate(); | ||
let client = Client::builder().signer(keys).build(); | ||
|
||
client.add_relay("wss://relay.damus.io/").await?; | ||
client.add_relay("wss://relay.primal.net/").await?; | ||
|
||
client.connect().await; | ||
|
||
let event_id = | ||
EventId::from_bech32("note1hrrgx2309my3wgeecx2tt6fl2nl8hcwl0myr3xvkcqpnq24pxg2q06armr")?; | ||
let events = client | ||
.fetch_events(vec![Filter::new().id(event_id)], None) | ||
.await?; | ||
|
||
let reply_to = events.first().unwrap(); | ||
let builder = EventBuilder::comment("This is a reply", reply_to, None, None); | ||
|
||
let output = client.send_event_builder(builder).await?; | ||
println!("Output: {:?}", output); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters