mirror of
https://github.com/fiatjaf/nak.git
synced 2025-12-22 22:48:50 +00:00
spell: also take a --pub to run spells in the context of other users.
This commit is contained in:
8
spell.go
8
spell.go
@@ -24,6 +24,10 @@ var spell = &cli.Command{
|
|||||||
ArgsUsage: "[nevent_code]",
|
ArgsUsage: "[nevent_code]",
|
||||||
Description: `fetches a spell event (kind 777) and executes REQ command encoded in its tags.`,
|
Description: `fetches a spell event (kind 777) and executes REQ command encoded in its tags.`,
|
||||||
Flags: append(defaultKeyFlags,
|
Flags: append(defaultKeyFlags,
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "pub",
|
||||||
|
Usage: "public key to run spells in the context of (if you don't want to pass a --sec)",
|
||||||
|
},
|
||||||
&cli.UintFlag{
|
&cli.UintFlag{
|
||||||
Name: "outbox-relays-per-pubkey",
|
Name: "outbox-relays-per-pubkey",
|
||||||
Aliases: []string{"n"},
|
Aliases: []string{"n"},
|
||||||
@@ -259,6 +263,10 @@ func buildSpellReq(ctx context.Context, c *cli.Command, tags nostr.Tags) (nostr.
|
|||||||
filter := nostr.Filter{}
|
filter := nostr.Filter{}
|
||||||
|
|
||||||
getMe := func() (nostr.PubKey, error) {
|
getMe := func() (nostr.PubKey, error) {
|
||||||
|
if !c.IsSet("sec") && !c.IsSet("prompt-sec") && c.IsSet("pub") {
|
||||||
|
return parsePubKey(c.String("pub"))
|
||||||
|
}
|
||||||
|
|
||||||
kr, _, err := gatherKeyerFromArguments(ctx, c)
|
kr, _, err := gatherKeyerFromArguments(ctx, c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nostr.ZeroPK, fmt.Errorf("failed to get keyer: %w", err)
|
return nostr.ZeroPK, fmt.Errorf("failed to get keyer: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user