Documentation
¶
Index ¶
- func NewFactory() im.AdapterFactory
- type Adapter
- func (a *Adapter) DownloadFile(ctx context.Context, msg *im.IncomingMessage) (io.ReadCloser, string, error)
- func (a *Adapter) EndStream(ctx context.Context, incoming *im.IncomingMessage, streamID string) error
- func (a *Adapter) FinalizeStream(ctx context.Context, incoming *im.IncomingMessage, streamID string, ...) error
- func (a *Adapter) HandleURLVerification(c *gin.Context) bool
- func (a *Adapter) ParseCallback(c *gin.Context) (*im.IncomingMessage, error)
- func (a *Adapter) Platform() im.Platform
- func (a *Adapter) SendReply(ctx context.Context, incoming *im.IncomingMessage, reply *im.ReplyMessage) error
- func (a *Adapter) SendStreamChunk(ctx context.Context, incoming *im.IncomingMessage, streamID string, ...) error
- func (a *Adapter) StartStream(ctx context.Context, incoming *im.IncomingMessage) (string, error)
- func (a *Adapter) UpdateStreamContent(ctx context.Context, incoming *im.IncomingMessage, streamID string, ...) error
- func (a *Adapter) VerifyCallback(c *gin.Context) error
- type LongConnClient
- type MessageHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
func NewFactory() im.AdapterFactory
NewFactory returns an im.AdapterFactory for Telegram bot channels. Supports "webhook" and "websocket" (long polling, default).
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements im.Adapter for Telegram Bot API.
func NewAdapter ¶
func NewAdapter(client *LongConnClient, botToken string) *Adapter
NewAdapter creates a Telegram adapter backed by a long-polling client.
func NewWebhookAdapter ¶
NewWebhookAdapter creates a Telegram adapter for webhook mode.
func (*Adapter) DownloadFile ¶
func (a *Adapter) DownloadFile(ctx context.Context, msg *im.IncomingMessage) (io.ReadCloser, string, error)
func (*Adapter) FinalizeStream ¶
func (*Adapter) HandleURLVerification ¶
func (*Adapter) ParseCallback ¶
func (*Adapter) SendReply ¶
func (a *Adapter) SendReply(ctx context.Context, incoming *im.IncomingMessage, reply *im.ReplyMessage) error
func (*Adapter) SendStreamChunk ¶
func (*Adapter) StartStream ¶
func (*Adapter) UpdateStreamContent ¶
type LongConnClient ¶
type LongConnClient struct {
// contains filtered or unexported fields
}
LongConnClient manages a Telegram long-polling connection.
func NewLongConnClient ¶
func NewLongConnClient(botToken string, handler MessageHandler) *LongConnClient
NewLongConnClient creates a Telegram long-polling client.
type MessageHandler ¶
type MessageHandler func(ctx context.Context, msg *im.IncomingMessage) error
MessageHandler is called when an IM message is received via long polling.
Click to show internal directories.
Click to hide internal directories.