yao/integrations/feishu/bot.go
Max 33efd3e890 Add Feishu and DingTalk integration support in robot lifecycle</message>
<message>
- Introduce Feishu and DingTalk adapters in the robot lifecycle for enhanced integration capabilities.
- Update the integration dispatcher to include new adapters for handling events from Feishu and DingTalk.
- Modify the configuration structure to support settings for both Feishu and DingTalk integrations.
- Enhance the integration parsing logic to recognize and process configurations for Feishu and DingTalk.
2026-03-02 07:36:34 +08:00

41 lines
936 B
Go

package feishu
import (
lark "github.com/larksuite/oapi-sdk-go/v3"
larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
)
// Bot represents a single Feishu bot instance bound to an app.
type Bot struct {
appID string
appSecret string
client *lark.Client
}
// NewBot creates a Bot bound to the given Feishu app credentials.
func NewBot(appID, appSecret string) *Bot {
client := lark.NewClient(appID, appSecret,
lark.WithLogLevel(larkcore.LogLevelWarn),
)
return &Bot{
appID: appID,
appSecret: appSecret,
client: client,
}
}
// AppID returns the app ID.
func (b *Bot) AppID() string { return b.appID }
// AppSecret returns the app secret (needed for WS client).
func (b *Bot) AppSecret() string { return b.appSecret }
// Client returns the underlying Lark SDK client.
func (b *Bot) Client() *lark.Client { return b.client }
func derefStr(s *string) string {
if s == nil {
return ""
}
return *s
}