Documentation
¶
Index ¶
- func NewFromCmdlineOptions() plugin.Plugin
- type TelegramOptionFunc
- func WithBotToken(token string) TelegramOptionFunc
- func WithChatID(chatID int64) TelegramOptionFunc
- func WithDisableLinkPreview(disable bool) TelegramOptionFunc
- func WithLogger(logger plugin.Logger) TelegramOptionFunc
- func WithParseMode(mode string) TelegramOptionFunc
- func WithRetryConfig(maxRetries int, initialBackoff, maxBackoff time.Duration) TelegramOptionFunc
- type TelegramOutput
- func (t *TelegramOutput) ErrorChan() <-chan error
- func (t *TelegramOutput) GetBot() *bot.Bot
- func (t *TelegramOutput) GetChatID() int64
- func (t *TelegramOutput) InputChan() chan<- event.Event
- func (t *TelegramOutput) OutputChan() <-chan event.Event
- func (t *TelegramOutput) SendMessage(message string) error
- func (t *TelegramOutput) Start() error
- func (t *TelegramOutput) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFromCmdlineOptions ¶
Types ¶
type TelegramOptionFunc ¶
type TelegramOptionFunc func(*TelegramOutput)
TelegramOptionFunc is a function type for configuring TelegramOutput
func WithBotToken ¶
func WithBotToken(token string) TelegramOptionFunc
WithBotToken specifies the Telegram Bot API token This token is obtained from @BotFather on Telegram
func WithChatID ¶
func WithChatID(chatID int64) TelegramOptionFunc
WithChatID specifies the chat ID to send messages to This can be a user ID, group ID, or channel ID For groups/channels, the ID is typically negative
func WithDisableLinkPreview ¶
func WithDisableLinkPreview(disable bool) TelegramOptionFunc
WithDisableLinkPreview disables link preview in messages
func WithLogger ¶
func WithLogger(logger plugin.Logger) TelegramOptionFunc
WithLogger specifies the logger object to use for logging messages
func WithParseMode ¶
func WithParseMode(mode string) TelegramOptionFunc
WithParseMode specifies the message parse mode Options: HTML, Markdown (legacy), MarkdownV2 (default markdown)
func WithRetryConfig ¶
func WithRetryConfig( maxRetries int, initialBackoff, maxBackoff time.Duration, ) TelegramOptionFunc
WithRetryConfig specifies the retry configuration for message delivery
type TelegramOutput ¶
type TelegramOutput struct {
// contains filtered or unexported fields
}
TelegramOutput implements the Plugin interface for sending events to Telegram
func New ¶
func New(options ...TelegramOptionFunc) (*TelegramOutput, error)
New creates a new TelegramOutput with the provided options
func (*TelegramOutput) ErrorChan ¶
func (t *TelegramOutput) ErrorChan() <-chan error
ErrorChan returns the plugin's error channel
func (*TelegramOutput) GetBot ¶
func (t *TelegramOutput) GetBot() *bot.Bot
GetBot returns the underlying Telegram bot instance for advanced usage
func (*TelegramOutput) GetChatID ¶
func (t *TelegramOutput) GetChatID() int64
GetChatID returns the configured chat ID
func (*TelegramOutput) InputChan ¶
func (t *TelegramOutput) InputChan() chan<- event.Event
InputChan returns the input event channel
func (*TelegramOutput) OutputChan ¶
func (t *TelegramOutput) OutputChan() <-chan event.Event
OutputChan always returns nil
func (*TelegramOutput) SendMessage ¶
func (t *TelegramOutput) SendMessage(message string) error
SendMessage sends a message to the configured Telegram chat