From f70db84f474698f28ec44442852cb81e780edc73 Mon Sep 17 00:00:00 2001 From: Liqiang Liu Date: Wed, 18 Mar 2026 22:00:10 +0800 Subject: [PATCH] feat(feishu): add Lark (international) support via IsLark config field Add IsLark field to FeishuConfig to switch between Feishu and Lark domains. Also fix domain inconsistency where WS client defaulted to LarkBaseUrl while HTTP client used FeishuBaseUrl. Co-Authored-By: Claude Opus 4.6 --- pkg/channels/feishu/feishu_64.go | 11 ++++++++++- pkg/config/config.go | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/channels/feishu/feishu_64.go b/pkg/channels/feishu/feishu_64.go index c503e2993..3aea67b12 100644 --- a/pkg/channels/feishu/feishu_64.go +++ b/pkg/channels/feishu/feishu_64.go @@ -54,11 +54,15 @@ func NewFeishuChannel(cfg config.FeishuConfig, bus *bus.MessageBus) (*FeishuChan ) tc := newTokenCache() + opts := []lark.ClientOptionFunc{lark.WithTokenCache(tc)} + if cfg.IsLark { + opts = append(opts, lark.WithOpenBaseUrl(lark.LarkBaseUrl)) + } ch := &FeishuChannel{ BaseChannel: base, config: cfg, tokenCache: tc, - client: lark.NewClient(cfg.AppID, cfg.AppSecret, lark.WithTokenCache(tc)), + client: lark.NewClient(cfg.AppID, cfg.AppSecret, opts...), } ch.SetOwner(ch) return ch, nil @@ -83,10 +87,15 @@ func (c *FeishuChannel) Start(ctx context.Context) error { c.mu.Lock() c.cancel = cancel + domain := lark.FeishuBaseUrl + if c.config.IsLark { + domain = lark.LarkBaseUrl + } c.wsClient = larkws.NewClient( c.config.AppID, c.config.AppSecret, larkws.WithEventHandler(dispatcher), + larkws.WithDomain(domain), ) wsClient := c.wsClient c.mu.Unlock() diff --git a/pkg/config/config.go b/pkg/config/config.go index dd4e86319..d07cb60aa 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -325,6 +325,7 @@ type FeishuConfig struct { Placeholder PlaceholderConfig `json:"placeholder,omitempty"` ReasoningChannelID string `json:"reasoning_channel_id" env:"PICOCLAW_CHANNELS_FEISHU_REASONING_CHANNEL_ID"` RandomReactionEmoji FlexibleStringSlice `json:"random_reaction_emoji" env:"PICOCLAW_CHANNELS_FEISHU_RANDOM_REACTION_EMOJI"` + IsLark bool `json:"is_lark" env:"PICOCLAW_CHANNELS_FEISHU_IS_LARK"` } type DiscordConfig struct {