Documentation
¶
Overview ¶
Package telegram implements AstraEngine's Telegram Bot API adapter.
Index ¶
- func From(ctx *botctx.Context) (*tgbot.Bot, bool)
- type Config
- type Platform
- func (p *Platform) AnswerCallback(ctx context.Context, callbackID string, text string) error
- func (p *Platform) Capabilities() capability.Capabilities
- func (p *Platform) Edit(ctx context.Context, ev event.Event, msg platform.OutgoingMessage) error
- func (p *Platform) EditByRef(ctx context.Context, ref platform.MessageRef, msg platform.OutgoingMessage) error
- func (p *Platform) Name() string
- func (p *Platform) Raw() any
- func (p *Platform) Send(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) error
- func (p *Platform) SendPrivate(ctx context.Context, userID string, msg platform.OutgoingMessage) error
- func (p *Platform) SendWithRef(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) (platform.MessageRef, error)
- func (p *Platform) SetCommandPrefixes(prefixes []string)
- func (p *Platform) SetEventTypes(types []event.Type)
- func (p *Platform) SetLogger(logger *slog.Logger)
- func (p *Platform) Start(ctx context.Context, dispatcher platform.Dispatcher) error
- func (p *Platform) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Token string
ServerURL string
ProxyURL string
CheckInitTimeout time.Duration
PollTimeout time.Duration
RequestTimeout time.Duration
Debug bool
SkipGetMe bool
}
Config configures Telegram API access, proxying and request timeouts.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform adapts Telegram updates and messages to AstraEngine contracts.
func (*Platform) AnswerCallback ¶
func (*Platform) Capabilities ¶
func (p *Platform) Capabilities() capability.Capabilities
func (*Platform) EditByRef ¶
func (p *Platform) EditByRef(ctx context.Context, ref platform.MessageRef, msg platform.OutgoingMessage) error
func (*Platform) SendPrivate ¶ added in v2.0.1
func (*Platform) SendWithRef ¶
func (p *Platform) SendWithRef(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) (platform.MessageRef, error)
func (*Platform) SetCommandPrefixes ¶
func (*Platform) SetEventTypes ¶
SetEventTypes limits Telegram updates to the events registered by the app.