picoclaw/pkg/channels/feishu/init.go

26 lines
584 B
Go
Raw Permalink Normal View History

package feishu
import (
"github.com/sipeed/picoclaw/pkg/bus"
"github.com/sipeed/picoclaw/pkg/channels"
"github.com/sipeed/picoclaw/pkg/config"
)
func init() {
channels.RegisterFactory(
config.ChannelFeishu,
func(channelName, channelType string, cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
bc := cfg.Channels[channelName]
decoded, err := bc.GetDecoded()
if err != nil {
return nil, err
}
c, ok := decoded.(*config.FeishuSettings)
if !ok {
return nil, channels.ErrSendFailed
}
return NewFeishuChannel(bc, c, b)
},
)
}