diff --git a/botfather-setcommands.txt b/botfather-setcommands.txt index a15232e3..8bc26efd 100644 --- a/botfather-setcommands.txt +++ b/botfather-setcommands.txt @@ -19,3 +19,4 @@ note - Create an LNURLcash note: /note 1000 [memo] notes - List your notes, or create a batch: /notes 100 x 10 redeem - Redeem a received note: /redeem lnurlw://... lnurlmints - Show the LNURLcash mints and pick a default +lnurlhelp - Help for LNURLcash notes diff --git a/internal/telegram/handler.go b/internal/telegram/handler.go index 7a0c3ec0..02cb3729 100644 --- a/internal/telegram/handler.go +++ b/internal/telegram/handler.go @@ -85,6 +85,17 @@ func (bot TipBot) register(h InterceptionWrapper) { func (bot TipBot) getHandler() []InterceptionWrapper { return []InterceptionWrapper{ // LNURLcash notes (docs/lnurlcash) + { + Endpoints: []interface{}{"/lnurlhelp", "/notehelp"}, + Handler: bot.lnurlHelpHandler, + Interceptor: &Interceptor{ + Before: []intercept.Func{ + bot.localizerInterceptor, + bot.logMessageInterceptor, + bot.loadUserInterceptor, + }, + }, + }, { Endpoints: []interface{}{"/note"}, Handler: bot.noteHandler, diff --git a/internal/telegram/lnurlmints.go b/internal/telegram/lnurlmints.go index 63932e80..08103975 100644 --- a/internal/telegram/lnurlmints.go +++ b/internal/telegram/lnurlmints.go @@ -85,3 +85,13 @@ func (bot *TipBot) setMintHandler(ctx intercept.Context) (intercept.Context, err bot.tryEditMessage(ctx.Callback().Message, text, kb) return ctx, nil } + +// lnurlHelpHandler sends the LNURLcash notes help, privately. +func (bot *TipBot) lnurlHelpHandler(ctx intercept.Context) (intercept.Context, error) { + m := ctx.Message() + if !m.Private() { + bot.tryDeleteMessage(m) + } + bot.trySendMessage(ctx.Sender(), TranslateUser(ctx, "noteHelpMessage"), tb.NoPreview) + return ctx, nil +} diff --git a/translations/en.toml b/translations/en.toml index f11aafe7..d6106712 100644 --- a/translations/en.toml +++ b/translations/en.toml @@ -125,6 +125,7 @@ advancedMessage = """%s */link* πŸ”— Link your wallet to [BlueWallet](https://bluewallet.io/) or [Zeus](https://zeusln.app/) */lnurl* ⚑️ Lnurl receive or pay: `/lnurl` or `/lnurl [memo]` */nostr* πŸ’œ Connect to Nostr: `/nostr` +*/lnurlhelp* 🎫 LNURLcash notes: `/lnurlhelp` (create, share and redeem bearer notes) */faucet* 🚰 Create a faucet: `/faucet ` */tipjar* 🍯 Create a tipjar: `/tipjar ` */group* 🎟 Group chat features: `/group` @@ -413,7 +414,8 @@ generateDalleGeneratingMessage = """Your images are being generated. Please wai # LNURLCASH lnurlcashDisabledMessage = """🚫 LNURLcash notes are not enabled on this bot.""" lnurlcashStartPrivateFirstMessage = """πŸ‘‹ Start a private chat with me first, then try again.""" -noteHelpMessage = """🎫 *LNURLcash notes*\n\nA note is a bearer link worth a fixed number of sats. Whoever scans it first gets the sats.\n\n`/note [memo]` creates one note.\n`/notes` lists your notes and batches.\n`/notes x [memo]` creates a batch.\n`/redeem ` adds a received note to your balance (or just paste it).\n`/lnurlmints` shows the mints and sets your default.""" +noteHelpMessage = """🎫 *LNURLcash notes*\n\nA note is a bearer link worth a fixed number of sats. Whoever scans it first gets the sats.\n\n`/note [memo]` creates one note.\n`/notes` lists your notes and batches.\n`/notes x [memo]` creates a batch.\n`/redeem ` adds a received note to your balance (or just paste it).\n`/lnurlmints` shows the mints and sets your default. +`/lnurlhelp` shows this help.""" notesHelpMessage = """πŸ“– Usage: `/notes` or `/notes x [memo]`""" redeemHelpMessage = """πŸ“– Usage: `/redeem ` β€” or paste the note or send a photo of its QR code in private chat.""" noteConfirmMessage = """🎫 *Create %d note(s)?*\n\nπŸ’Έ Value: %s sat each\n🏦 Mint fee: %s sat\nπŸ’° Total: %s sat\n🏭 Mint: %s""" diff --git a/translations/nl.toml b/translations/nl.toml index c4635839..a17b59c6 100644 --- a/translations/nl.toml +++ b/translations/nl.toml @@ -121,6 +121,7 @@ advancedMessage = """%s */link* πŸ”— Koppel uw wallet aan [BlueWallet](https://bluewallet.io/) of [Zeus](https://zeusln.app/) */lnurl* ⚑️ Lnurl ontvangen of betalen: `/lnurl` of `/lnurl [memo]` */nostr* πŸ’œ Connect to Nostr: `/nostr` +*/lnurlhelp* 🎫 LNURLcash-notes: `/lnurlhelp` (notes aan toonder maken, delen en inwisselen) */faucet* 🚰 Maak een kraan: `/faucet ` */tipjar* 🍯 Maak een tipjar: `/tipjar ` */group* 🎟 Create group tickets: `/group add []` @@ -320,7 +321,8 @@ inlineReceiveCancelledMessage = """🚫 Ontvangen geannuleerd.""" # LNURLCASH lnurlcashDisabledMessage = """🚫 LNURLcash-notes zijn op deze bot niet ingeschakeld.""" lnurlcashStartPrivateFirstMessage = """πŸ‘‹ Start eerst een privΓ©chat met mij en probeer het dan opnieuw.""" -noteHelpMessage = """🎫 *LNURLcash-notes*\n\nEen note is een link aan toonder ter waarde van een vast aantal sats. Wie hem het eerst scant, krijgt de sats.\n\n`/note [memo]` maakt één note.\n`/notes` toont je notes en batches.\n`/notes x [memo]` maakt een batch.\n`/redeem ` voegt een ontvangen note toe aan je saldo (of plak hem gewoon).\n`/lnurlmints` toont de mints en kiest je standaard.""" +noteHelpMessage = """🎫 *LNURLcash-notes*\n\nEen note is een link aan toonder ter waarde van een vast aantal sats. Wie hem het eerst scant, krijgt de sats.\n\n`/note [memo]` maakt één note.\n`/notes` toont je notes en batches.\n`/notes x [memo]` maakt een batch.\n`/redeem ` voegt een ontvangen note toe aan je saldo (of plak hem gewoon).\n`/lnurlmints` toont de mints en kiest je standaard. +`/lnurlhelp` toont deze uitleg.""" notesHelpMessage = """πŸ“– Gebruik: `/notes` of `/notes x [memo]`""" redeemHelpMessage = """πŸ“– Gebruik: `/redeem ` β€” of plak de note of stuur een foto van de QR-code in een privΓ©chat.""" noteConfirmMessage = """🎫 *%d note(s) maken?*\n\nπŸ’Έ Waarde: %s sat per stuk\n🏦 Mintkosten: %s sat\nπŸ’° Totaal: %s sat\n🏭 Mint: %s"""