More logging
This commit is contained in:
@ -137,23 +137,31 @@ public class ZapperRelay : INostrRelay, IDisposable
|
||||
};
|
||||
|
||||
var zapSigned = zap.Sign(key);
|
||||
var invoice = await _lnurl.GetInvoiceAsync(svc, 5, "Thanks for your interaction!", zapSigned);
|
||||
if (string.IsNullOrEmpty(invoice.Pr))
|
||||
try
|
||||
{
|
||||
return new(false, $"blocked: failed to get invoice from {parsedTarget}");
|
||||
}
|
||||
var invoice = await _lnurl.GetInvoiceAsync(svc, 5, "Thanks for your interaction!", zapSigned);
|
||||
if (string.IsNullOrEmpty(invoice.Pr))
|
||||
{
|
||||
return new(false, $"blocked: failed to get invoice from {parsedTarget}");
|
||||
}
|
||||
|
||||
_logger.LogInformation("Paying invoice {pr}", invoice.Pr);
|
||||
if (!await _albyApi.PayInvoice(invoice.Pr))
|
||||
_logger.LogInformation("Paying invoice {pr}", invoice.Pr);
|
||||
if (!await _albyApi.PayInvoice(invoice.Pr))
|
||||
{
|
||||
return new(false, "blocked: failed to pay invoice!");
|
||||
}
|
||||
|
||||
var seenEvent = NostrBuf.Encode(ev);
|
||||
(await _session.UpsertAsync(ref seenId, ref seenEvent)).Complete();
|
||||
|
||||
_logger.LogInformation("Zapped {name}!", senderProfile.Name);
|
||||
return new(true, "Zapped!");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new(false, "blocked: failed to pay invoice!");
|
||||
_logger.LogError(e.ToString());
|
||||
return new(false, $"blocked: Oh no! something went wrong! {e.Message}");
|
||||
}
|
||||
|
||||
var seenEvent = NostrBuf.Encode(ev);
|
||||
(await _session.UpsertAsync(ref seenId, ref seenEvent)).Complete();
|
||||
|
||||
_logger.LogInformation("Zapped {name}!", senderProfile.Name);
|
||||
return new(true, "Zapped!");
|
||||
}
|
||||
|
||||
return new(false, "blocked: kind not accepted, no zap for you!");
|
||||
|
Reference in New Issue
Block a user