refactor(config): make config.Channel to multiple instance support

add new field type to Channel struct
config.channels refactor to channel_list
update config version to 3
update the docs
This commit is contained in:
Cytown committed 2026-04-13 22:21:21 +08:00
1 parent 2b2bc26f8e
commit 667fc85d54
185 files changed
+6389 -4180

No files matched your search

+15 -3
View File
@@ -7,7 +7,19 @@ import (
)
func init() {
channels.RegisterFactory("feishu", func(cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
return NewFeishuChannel(cfg.Channels.Feishu, b)
})
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)
},
)
}