channels

package
v0.0.0-...-ab6ecea Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 34 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 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) Start

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

func (*DiscordChannel) Stop

func (c *DiscordChannel) Stop(ctx context.Context) 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.

func (*LINEChannel) Start

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

Start launches the HTTP webhook server.

func (*LINEChannel) Stop

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

Stop gracefully shuts down the HTTP server.

type Manager

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

func NewManager

func NewManager(cfg *config.Config, messageBus *bus.MessageBus, configPath string) (*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 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 (*SlackChannel) Start

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

func (*SlackChannel) Stop

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.Config, bus *bus.MessageBus) (*TelegramChannel, error)

func (*TelegramChannel) Send

func (*TelegramChannel) Start

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

func (*TelegramChannel) Stop

func (c *TelegramChannel) Stop(ctx context.Context) 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 (*WebSocketChannel) Start

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

func (*WebSocketChannel) Stop

func (c *WebSocketChannel) 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