picoclaw/pkg/channels/buzz/init.go
PeterChrz 9b4df86182
feat(channels): add Buzz (Nostr relay) channel
Implements a Buzz channel backed by a Nostr relay:
- kind:9 events scoped by "h" tag, "p" tags for mentions
- NIP-42 (kind:22242) auth before subscription
- optional threaded replies via "e" tag
- registered as config.ChannelBuzz with BuzzSettings
2026-08-11 21:41:16 -04:00

35 lines
775 B
Go

package buzz
import (
"github.com/sipeed/picoclaw/pkg/bus"
"github.com/sipeed/picoclaw/pkg/channels"
"github.com/sipeed/picoclaw/pkg/config"
)
func init() {
channels.RegisterFactory(
config.ChannelBuzz,
func(channelName, channelType string, cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
bc := cfg.Channels[channelName]
if bc == nil || !bc.Enabled {
return nil, nil
}
decoded, err := bc.GetDecoded()
if err != nil {
return nil, err
}
c, ok := decoded.(*config.BuzzSettings)
if !ok {
return nil, channels.ErrSendFailed
}
ch, err := NewBuzzChannel(bc, c, b)
if err != nil {
return nil, err
}
if channelName != config.ChannelBuzz {
ch.SetName(channelName)
}
return ch, nil
},
)
}