Documentation
¶
Index ¶
- Constants
- func DecodeConfig(raw map[string]any) (pkgchannel.TelegramConfig, error)
- func NewManagedRuntime(deps RuntimeDeps) pkgplugins.Runtime
- func RedactConfig(raw map[string]any) map[string]any
- func SetRuntimeFactoryForTesting(factory func(platform pkgplugins.Platform) (pkgplugins.Runtime, error)) func()
- type Bot
- func (b *Bot) Finalize()
- func (b *Bot) Name() string
- func (b *Bot) Notify(_ context.Context, n channel.Notification) error
- func (b *Bot) Platform() string
- func (b *Bot) Publish(ctx context.Context, req internalchannel.GroupPublishRequest) (err error)
- func (b *Bot) Start(ctx context.Context) error
- func (b *Bot) Stop()
- type Config
- type RuntimeDeps
Constants ¶
View Source
const ( PluginID = "channel/telegram" RuntimeName = "bot" )
Variables ¶
This section is empty.
Functions ¶
func DecodeConfig ¶
func DecodeConfig(raw map[string]any) (pkgchannel.TelegramConfig, error)
func NewManagedRuntime ¶
func NewManagedRuntime(deps RuntimeDeps) pkgplugins.Runtime
func SetRuntimeFactoryForTesting ¶
func SetRuntimeFactoryForTesting(factory func(platform pkgplugins.Platform) (pkgplugins.Runtime, error)) func()
SetRuntimeFactoryForTesting swaps the Telegram managed runtime factory for tests.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot wraps a Telegram bot with agent pool integration. It implements channel.Channel.
func (*Bot) Finalize ¶ added in v0.63.0
func (b *Bot) Finalize()
Finalize removes routing registrations after accepted work has drained.
func (*Bot) Publish ¶ added in v0.43.0
func (b *Bot) Publish(ctx context.Context, req internalchannel.GroupPublishRequest) (err error)
Publish renders the dispatcher-owned ChatStream as one Telegram message. It deliberately has no session or agent logic: a failed platform request is returned so the existing at-least-once group dispatcher owns the retry.
type Config ¶
type Config struct {
InstanceID string
Token string
ChannelID string
AllowGroup bool
AllowedChatIDs []string
AllowedTopicIDs []string
AllowDM bool
RequireMention bool
}
Config holds Telegram bot settings.
type RuntimeDeps ¶
type RuntimeDeps struct {
Parent context.Context
Handler pkgchannel.Handler
Notifications pkgplugins.ChannelRegistry
Now func() time.Time
NewChannel func(pkgchannel.TelegramConfig, pkgchannel.Handler) (pkgchannel.Channel, error)
}
Click to show internal directories.
Click to hide internal directories.