Documentation
¶
Index ¶
- type BaseChannel
- type Channel
- type DiscordChannel
- type LINEChannel
- type Manager
- func (m *Manager) GetChannel(name string) (Channel, bool)
- func (m *Manager) GetEnabledChannels() []string
- func (m *Manager) GetStatus() map[string]interface{}
- func (m *Manager) RegisterChannel(name string, channel Channel)
- func (m *Manager) SendToChannel(ctx context.Context, channelName, chatID, content string) error
- func (m *Manager) StartAll(ctx context.Context) error
- func (m *Manager) StopAll(ctx context.Context) error
- func (m *Manager) UnregisterChannel(name string)
- type SlackChannel
- type TelegramChannel
- type TelegramCommander
- type WebSocketChannel
- type WhatsAppChannel
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 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 (c *DiscordChannel) Send(ctx context.Context, msg bus.OutboundMessage) error
type LINEChannel ¶
type LINEChannel struct {
*BaseChannel
// contains filtered or unexported fields
}
LINEChannel implements the Channel interface for LINE Official Account using the LINE Messaging API with HTTP webhook for receiving messages and REST API for sending messages.
func NewLINEChannel ¶
func NewLINEChannel(cfg config.LINEConfig, messageBus *bus.MessageBus) (*LINEChannel, error)
NewLINEChannel creates a new LINE channel instance.
func (*LINEChannel) Send ¶
func (c *LINEChannel) Send(ctx context.Context, msg bus.OutboundMessage) error
Send sends a message to LINE. It first tries the Reply API (free) using a cached reply token, then falls back to the Push API.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) GetEnabledChannels ¶
func (*Manager) RegisterChannel ¶
func (*Manager) SendToChannel ¶
func (*Manager) UnregisterChannel ¶
type SlackChannel ¶
type SlackChannel struct {
*BaseChannel
// contains filtered or unexported fields
}
func NewSlackChannel ¶
func NewSlackChannel(cfg config.SlackConfig, messageBus *bus.MessageBus) (*SlackChannel, error)
func (*SlackChannel) Send ¶
func (c *SlackChannel) Send(ctx context.Context, msg bus.OutboundMessage) error
type TelegramChannel ¶
type TelegramChannel struct {
*BaseChannel
// contains filtered or unexported fields
}
func NewTelegramChannel ¶
func NewTelegramChannel(cfg *config.Config, bus *bus.MessageBus) (*TelegramChannel, error)
func (*TelegramChannel) Send ¶
func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) error
type TelegramCommander ¶
type TelegramCommander interface {
Help(ctx context.Context, message telego.Message) error
Start(ctx context.Context, message telego.Message) error
Show(ctx context.Context, message telego.Message) error
List(ctx context.Context, message telego.Message) error
}
func NewTelegramCommands ¶
func NewTelegramCommands(bot *telego.Bot, cfg *config.Config) TelegramCommander
type WebSocketChannel ¶
type WebSocketChannel struct {
*BaseChannel
// contains filtered or unexported fields
}
WebSocketChannel is a server-side WebSocket channel that accepts connections from clients (e.g. a Google Assistant replacement APK).
func NewWebSocketChannel ¶
func NewWebSocketChannel(cfg config.WebSocketConfig, msgBus *bus.MessageBus, configPath string) (*WebSocketChannel, error)
func (*WebSocketChannel) GetClientType ¶
func (c *WebSocketChannel) GetClientType(chatID string) string
GetClientType returns the client type for a given chatID. Returns empty string if unknown. The value is retained after disconnect so that the broadcast fallback can check the type.
func (*WebSocketChannel) Send ¶
func (c *WebSocketChannel) Send(ctx context.Context, msg bus.OutboundMessage) 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 (c *WhatsAppChannel) Send(ctx context.Context, msg bus.OutboundMessage) error