Documentation
¶
Index ¶
- type TelegramChannel
- func (t *TelegramChannel) ClearHistory(ctx context.Context, recipientID string) error
- func (t *TelegramChannel) Name() string
- func (t *TelegramChannel) Send(ctx context.Context, msg domain.OutboundMessage) error
- func (t *TelegramChannel) SendApproval(ctx context.Context, recipientID string, req *domain.ApprovalRequest) error
- func (t *TelegramChannel) SetCommands(cmds []domain.ChannelCommand)
- func (t *TelegramChannel) Start(ctx context.Context, inbox chan<- domain.InboundMessage) error
- func (t *TelegramChannel) Stop() error
- type VoiceRetention
- type VoiceTranscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TelegramChannel ¶
type TelegramChannel struct {
// contains filtered or unexported fields
}
TelegramChannel implements domain.Channel for the Telegram Bot API using the go-telegram/bot SDK with long-polling.
func NewTelegramChannel ¶
func NewTelegramChannel(cfg config.TelegramChannelConfig, transcriber VoiceTranscriber, retention *VoiceRetention) *TelegramChannel
NewTelegramChannel creates a new Telegram channel. transcriber may be nil, in which case inbound voice messages are ignored. retention may be nil to disable local persistence of inbound voice/audio files.
func (*TelegramChannel) ClearHistory ¶ added in v0.149.0
func (t *TelegramChannel) ClearHistory(ctx context.Context, recipientID string) error
ClearHistory best-effort deletes the tracked messages of a chat. Implements domain.HistoryCleaner. Telegram silently skips messages it can no longer delete (older than 48h), and batches that fail are logged and skipped.
func (*TelegramChannel) Name ¶
func (t *TelegramChannel) Name() string
Name returns the channel identifier
func (*TelegramChannel) Send ¶
func (t *TelegramChannel) Send(ctx context.Context, msg domain.OutboundMessage) error
Send delivers a message through the Telegram Bot API
func (*TelegramChannel) SendApproval ¶ added in v0.103.0
func (t *TelegramChannel) SendApproval(ctx context.Context, recipientID string, req *domain.ApprovalRequest) error
SendApproval sends a tool approval prompt with inline keyboard buttons. Implements domain.ApprovalChannel.
func (*TelegramChannel) SetCommands ¶ added in v0.149.0
func (t *TelegramChannel) SetCommands(cmds []domain.ChannelCommand)
SetCommands sets the slash commands advertised to Telegram on Start.
func (*TelegramChannel) Start ¶
func (t *TelegramChannel) Start(ctx context.Context, inbox chan<- domain.InboundMessage) error
Start begins long-polling for Telegram updates and sends inbound messages to the inbox
func (*TelegramChannel) Stop ¶
func (t *TelegramChannel) Stop() error
Stop gracefully shuts down the Telegram channel
type VoiceRetention ¶ added in v0.125.0
VoiceRetention persists a bounded number of inbound voice/audio recordings to a local directory, pruning the oldest once the count exceeds Keep. A nil *VoiceRetention or a Keep <= 0 disables retention (the default behavior).
save serializes on mu because the channel manager may process voice messages concurrently and they all share one directory.
type VoiceTranscriber ¶ added in v0.116.0
type VoiceTranscriber interface {
TranscribeFile(ctx context.Context, audioPath string) (string, error)
}
VoiceTranscriber transcribes a downloaded audio file (any format ffmpeg can decode) into text. It is defined here so the channel can be wired with a concrete speech-to-text implementation only when the feature is enabled, while remaining nil (and a no-op) otherwise.