channels

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseChannel

type BaseChannel struct {
	// contains filtered or unexported fields
}

func NewBaseChannel

func NewBaseChannel(name string, config interface{}, bus *bus.MessageBus, allowList []string) *BaseChannel

func (*BaseChannel) HandleMessage

func (c *BaseChannel) HandleMessage(senderID, chatID, content string, media []string, metadata map[string]string)

func (*BaseChannel) IsAllowed

func (c *BaseChannel) IsAllowed(senderID string) bool

func (*BaseChannel) IsRunning

func (c *BaseChannel) IsRunning() bool

func (*BaseChannel) Name

func (c *BaseChannel) Name() string

type Channel

type Channel interface {
	Name() string
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Send(ctx context.Context, msg bus.OutboundMessage) error
	IsRunning() bool
	IsAllowed(senderID string) bool
}

type DingTalkChannel added in v0.1.1

type DingTalkChannel struct {
	*BaseChannel
	// contains filtered or unexported fields
}

DingTalkChannel implements the Channel interface for DingTalk (钉钉) It uses WebSocket for receiving messages via stream mode and API for sending

func NewDingTalkChannel added in v0.1.1

func NewDingTalkChannel(cfg config.DingTalkConfig, messageBus *bus.MessageBus) (*DingTalkChannel, error)

NewDingTalkChannel creates a new DingTalk channel instance

func (*DingTalkChannel) Send added in v0.1.1

Send sends a message to DingTalk via the chatbot reply API

func (*DingTalkChannel) SendDirectReply added in v0.1.1

func (c *DingTalkChannel) SendDirectReply(ctx context.Context, sessionWebhook, content string) error

SendDirectReply sends a direct reply using the session webhook

func (*DingTalkChannel) Start added in v0.1.1

func (c *DingTalkChannel) Start(ctx context.Context) error

Start initializes the DingTalk channel with Stream Mode

func (*DingTalkChannel) Stop added in v0.1.1

func (c *DingTalkChannel) Stop(ctx context.Context) error

Stop gracefully stops the DingTalk channel

type DiscordChannel

type DiscordChannel struct {
	*BaseChannel
	// contains filtered or unexported fields
}

func NewDiscordChannel

func NewDiscordChannel(cfg config.DiscordConfig, bus *bus.MessageBus) (*DiscordChannel, error)

func (*DiscordChannel) Send

func (*DiscordChannel) SetTranscriber added in v0.1.1

func (c *DiscordChannel) SetTranscriber(transcriber *voice.GroqTranscriber)

func (*DiscordChannel) Start

func (c *DiscordChannel) Start(ctx context.Context) error

func (*DiscordChannel) Stop

func (c *DiscordChannel) Stop(ctx context.Context) error

type FeishuChannel

type FeishuChannel struct {
	*BaseChannel
	// contains filtered or unexported fields
}

func NewFeishuChannel

func NewFeishuChannel(cfg config.FeishuConfig, bus *bus.MessageBus) (*FeishuChannel, error)

func (*FeishuChannel) Send

func (*FeishuChannel) Start

func (c *FeishuChannel) Start(ctx context.Context) error

func (*FeishuChannel) Stop

func (c *FeishuChannel) Stop(ctx context.Context) error

type MaixCamChannel

type MaixCamChannel struct {
	*BaseChannel
	// contains filtered or unexported fields
}

func NewMaixCamChannel

func NewMaixCamChannel(cfg config.MaixCamConfig, bus *bus.MessageBus) (*MaixCamChannel, error)

func (*MaixCamChannel) Send

func (*MaixCamChannel) Start

func (c *MaixCamChannel) Start(ctx context.Context) error

func (*MaixCamChannel) Stop

func (c *MaixCamChannel) Stop(ctx context.Context) error

type MaixCamMessage

type MaixCamMessage struct {
	Type      string                 `json:"type"`
	Tips      string                 `json:"tips"`
	Timestamp float64                `json:"timestamp"`
	Data      map[string]interface{} `json:"data"`
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(cfg *config.Config, messageBus *bus.MessageBus) (*Manager, error)

func (*Manager) GetChannel

func (m *Manager) GetChannel(name string) (Channel, bool)

func (*Manager) GetEnabledChannels

func (m *Manager) GetEnabledChannels() []string

func (*Manager) GetStatus

func (m *Manager) GetStatus() map[string]interface{}

func (*Manager) RegisterChannel

func (m *Manager) RegisterChannel(name string, channel Channel)

func (*Manager) SendToChannel

func (m *Manager) SendToChannel(ctx context.Context, channelName, chatID, content string) error

func (*Manager) StartAll

func (m *Manager) StartAll(ctx context.Context) error

func (*Manager) StopAll

func (m *Manager) StopAll(ctx context.Context) error

func (*Manager) UnregisterChannel

func (m *Manager) UnregisterChannel(name string)

type QQChannel added in v0.1.1

type QQChannel struct {
	*BaseChannel
	// contains filtered or unexported fields
}

func NewQQChannel added in v0.1.1

func NewQQChannel(cfg config.QQConfig, messageBus *bus.MessageBus) (*QQChannel, error)

func (*QQChannel) Send added in v0.1.1

func (c *QQChannel) Send(ctx context.Context, msg bus.OutboundMessage) error

func (*QQChannel) Start added in v0.1.1

func (c *QQChannel) Start(ctx context.Context) error

func (*QQChannel) Stop added in v0.1.1

func (c *QQChannel) Stop(ctx context.Context) error

type SlackChannel added in v0.1.1

type SlackChannel struct {
	*BaseChannel
	// contains filtered or unexported fields
}

func NewSlackChannel added in v0.1.1

func NewSlackChannel(cfg config.SlackConfig, messageBus *bus.MessageBus) (*SlackChannel, error)

func (*SlackChannel) Send added in v0.1.1

func (*SlackChannel) SetTranscriber added in v0.1.1

func (c *SlackChannel) SetTranscriber(transcriber *voice.GroqTranscriber)

func (*SlackChannel) Start added in v0.1.1

func (c *SlackChannel) Start(ctx context.Context) error

func (*SlackChannel) Stop added in v0.1.1

func (c *SlackChannel) Stop(ctx context.Context) error

type TelegramChannel

type TelegramChannel struct {
	*BaseChannel
	// contains filtered or unexported fields
}

func NewTelegramChannel

func NewTelegramChannel(cfg config.TelegramConfig, bus *bus.MessageBus) (*TelegramChannel, error)

func (*TelegramChannel) Send

func (*TelegramChannel) SetTranscriber

func (c *TelegramChannel) SetTranscriber(transcriber *voice.GroqTranscriber)

func (*TelegramChannel) Start

func (c *TelegramChannel) Start(ctx context.Context) error

func (*TelegramChannel) Stop

func (c *TelegramChannel) Stop(ctx context.Context) error

type WhatsAppChannel

type WhatsAppChannel struct {
	*BaseChannel
	// contains filtered or unexported fields
}

func NewWhatsAppChannel

func NewWhatsAppChannel(cfg config.WhatsAppConfig, bus *bus.MessageBus) (*WhatsAppChannel, error)

func (*WhatsAppChannel) Send

func (*WhatsAppChannel) Start

func (c *WhatsAppChannel) Start(ctx context.Context) error

func (*WhatsAppChannel) Stop

func (c *WhatsAppChannel) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL