@@ -144,7 +144,7 @@ export interface NostrBusHandle {
144144 /** Get the bot's public key */
145145 publicKey : string ;
146146 /** Send a DM to a pubkey */
147- sendDm : ( toPubkey : string , text : string ) => Promise < void > ;
147+ sendDm : ( toPubkey : string , text : string ) => Promise < string > ;
148148 /** Get current metrics snapshot */
149149 getMetrics : ( ) => MetricsSnapshot ;
150150 /** Publish a profile (kind:0) to all relays */
@@ -643,8 +643,8 @@ export async function startNostrBus(options: NostrBusOptions): Promise<NostrBusH
643643 } ) ;
644644
645645 // Public sendDm function
646- const sendDm = async ( toPubkey : string , text : string ) : Promise < void > => {
647- await sendEncryptedDm (
646+ const sendDm = async ( toPubkey : string , text : string ) : Promise < string > => {
647+ return await sendEncryptedDm (
648648 pool ,
649649 sk ,
650650 toPubkey ,
@@ -744,7 +744,7 @@ async function sendEncryptedDm(
744744 healthTracker : RelayHealthTracker ,
745745 onError ?: ( error : Error , context : string ) => void ,
746746 replyToEventId ?: string ,
747- ) : Promise < void > {
747+ ) : Promise < string > {
748748 const ciphertext = encrypt ( sk , toPubkey , text ) ;
749749 // NIP-04 uses an e tag to keep a reply attached to its verified inbound event.
750750 const tags = [ [ "p" , toPubkey ] ] ;
@@ -788,7 +788,7 @@ async function sendEncryptedDm(
788788 cb ?. recordSuccess ( ) ;
789789 healthTracker . recordSuccess ( relay , latency ) ;
790790
791- return ; // Success - exit early
791+ return reply . id ;
792792 } catch ( err ) {
793793 lastError = err as Error ;
794794 const latency = Date . now ( ) - startTime ;
0 commit comments