Documentation
¶
Index ¶
- Constants
- func IsRetryable(err error) bool
- type APIError
- type AnswerCallbackQueryRequest
- type Audio
- type BotAPI
- type BotCommand
- type BotCommandScope
- type CallbackQuery
- type Chat
- type Client
- func (c *Client) AnswerCallbackQuery(ctx context.Context, req AnswerCallbackQueryRequest) error
- func (c *Client) DeleteMessage(ctx context.Context, req DeleteMessageRequest) error
- func (c *Client) DeleteMyCommands(ctx context.Context, req DeleteMyCommandsRequest) error
- func (c *Client) DownloadFile(ctx context.Context, filePath string) ([]byte, error)
- func (c *Client) EditMessageText(ctx context.Context, req EditMessageTextRequest) (EditMessageTextResponse, error)
- func (c *Client) GetFile(ctx context.Context, fileID string) (File, error)
- func (c *Client) GetMe(ctx context.Context) (User, error)
- func (c *Client) GetUpdates(ctx context.Context, req GetUpdatesRequest) ([]Update, error)
- func (c *Client) SendAudio(ctx context.Context, req SendAudioRequest) (SentMessage, error)
- func (c *Client) SendChatAction(ctx context.Context, req SendChatActionRequest) error
- func (c *Client) SendMessage(ctx context.Context, req SendMessageRequest) (SentMessage, error)
- func (c *Client) SendVoice(ctx context.Context, req SendVoiceRequest) (SentMessage, error)
- func (c *Client) SetMyCommands(ctx context.Context, req SetMyCommandsRequest) error
- type ClientConfig
- type Config
- type DeleteMessageRequest
- type DeleteMyCommandsRequest
- type DeliveryAddress
- type Document
- type EditMessageTextRequest
- type EditMessageTextResponse
- type File
- type GetFileRequest
- type GetUpdatesRequest
- type HTTPDoer
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type Message
- type PhotoSize
- type RestartDeliveryCodec
- type RestartDeliverySender
- type RestartDeliverySenderConfig
- type SendAudioRequest
- type SendChatActionRequest
- type SendMessageRequest
- type SendVoiceRequest
- type SentMessage
- type SetMyCommandsRequest
- type Update
- type User
- type Voice
- type Worker
Constants ¶
View Source
const (
ClientName = "telegram"
)
Variables ¶
This section is empty.
Functions ¶
func IsRetryable ¶
Types ¶
type APIError ¶
type BotAPI ¶
type BotAPI interface {
GetMe(ctx context.Context) (User, error)
GetUpdates(ctx context.Context, req GetUpdatesRequest) ([]Update, error)
GetFile(ctx context.Context, fileID string) (File, error)
DownloadFile(ctx context.Context, filePath string) ([]byte, error)
SendMessage(ctx context.Context, req SendMessageRequest) (SentMessage, error)
SendChatAction(ctx context.Context, req SendChatActionRequest) error
SendVoice(ctx context.Context, req SendVoiceRequest) (SentMessage, error)
SendAudio(ctx context.Context, req SendAudioRequest) (SentMessage, error)
EditMessageText(ctx context.Context, req EditMessageTextRequest) (EditMessageTextResponse, error)
AnswerCallbackQuery(ctx context.Context, req AnswerCallbackQueryRequest) error
DeleteMessage(ctx context.Context, req DeleteMessageRequest) error
SetMyCommands(ctx context.Context, req SetMyCommandsRequest) error
DeleteMyCommands(ctx context.Context, req DeleteMyCommandsRequest) error
}
type BotCommand ¶
type BotCommandScope ¶
type CallbackQuery ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg ClientConfig) (*Client, error)
func (*Client) AnswerCallbackQuery ¶
func (c *Client) AnswerCallbackQuery(ctx context.Context, req AnswerCallbackQueryRequest) error
func (*Client) DeleteMessage ¶
func (c *Client) DeleteMessage(ctx context.Context, req DeleteMessageRequest) error
func (*Client) DeleteMyCommands ¶
func (c *Client) DeleteMyCommands(ctx context.Context, req DeleteMyCommandsRequest) error
func (*Client) DownloadFile ¶
func (*Client) EditMessageText ¶
func (c *Client) EditMessageText(ctx context.Context, req EditMessageTextRequest) (EditMessageTextResponse, error)
func (*Client) GetUpdates ¶
func (*Client) SendAudio ¶ added in v0.1.10
func (c *Client) SendAudio(ctx context.Context, req SendAudioRequest) (SentMessage, error)
func (*Client) SendChatAction ¶
func (c *Client) SendChatAction(ctx context.Context, req SendChatActionRequest) error
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, req SendMessageRequest) (SentMessage, error)
func (*Client) SendVoice ¶ added in v0.1.9
func (c *Client) SendVoice(ctx context.Context, req SendVoiceRequest) (SentMessage, error)
func (*Client) SetMyCommands ¶
func (c *Client) SetMyCommands(ctx context.Context, req SetMyCommandsRequest) error
type ClientConfig ¶
type Config ¶
type Config struct {
BaseURL string
APIToken string
BotToken string
TelegramBaseURL string
AllowedUserID int64
ClientName string
WorkingDir string
PollTimeout time.Duration
PollLimit int
PollRetryDelay time.Duration
StreamFlushInterval time.Duration
BotHTTPClient HTTPDoer
DaemonHTTPClient *http.Client
Offset *atomic.Int64
SkipCommandRegistration bool
}
type DeleteMessageRequest ¶
type DeleteMyCommandsRequest ¶
type DeleteMyCommandsRequest struct {
Scope *BotCommandScope `json:"scope,omitempty"`
}
type DeliveryAddress ¶
type EditMessageTextRequest ¶
type EditMessageTextRequest struct {
ChatID int64 `json:"chat_id"`
MessageID int64 `json:"message_id"`
Text string `json:"text"`
ParseMode string `json:"parse_mode,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
type EditMessageTextResponse ¶
type EditMessageTextResponse struct {
MessageID int64 `json:"message_id"`
}
type GetFileRequest ¶
type GetFileRequest struct {
FileID string `json:"file_id"`
}
type GetUpdatesRequest ¶
type InlineKeyboardButton ¶
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
type Message ¶
type Message struct {
MessageID int64 `json:"message_id"`
MessageThreadID int64 `json:"message_thread_id,omitempty"`
Date int64 `json:"date,omitempty"`
From *User `json:"from,omitempty"`
Chat Chat `json:"chat"`
Text string `json:"text,omitempty"`
Caption string `json:"caption,omitempty"`
Photo []PhotoSize `json:"photo,omitempty"`
Document *Document `json:"document,omitempty"`
Voice *Voice `json:"voice,omitempty"`
Audio *Audio `json:"audio,omitempty"`
ReplyToMessage *Message `json:"reply_to_message,omitempty"`
}
type RestartDeliveryCodec ¶
type RestartDeliveryCodec struct{}
func (RestartDeliveryCodec) ClientName ¶
func (RestartDeliveryCodec) ClientName() string
func (RestartDeliveryCodec) NormalizeRestartDeliveryAddress ¶
func (RestartDeliveryCodec) NormalizeRestartDeliveryAddress(raw json.RawMessage) (json.RawMessage, error)
type RestartDeliverySender ¶
type RestartDeliverySender struct {
// contains filtered or unexported fields
}
func NewRestartDeliverySender ¶
func NewRestartDeliverySender(cfg RestartDeliverySenderConfig) (*RestartDeliverySender, error)
func (*RestartDeliverySender) ClientName ¶
func (s *RestartDeliverySender) ClientName() string
func (*RestartDeliverySender) DeliverRestartNotification ¶
func (s *RestartDeliverySender) DeliverRestartNotification(ctx context.Context, delivery core.ClientDelivery, fallback string) error
type SendAudioRequest ¶ added in v0.1.10
type SendChatActionRequest ¶
type SendMessageRequest ¶
type SendMessageRequest struct {
ChatID int64 `json:"chat_id"`
MessageThreadID int64 `json:"message_thread_id,omitempty"`
Text string `json:"text"`
ParseMode string `json:"parse_mode,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
type SendVoiceRequest ¶ added in v0.1.9
type SentMessage ¶
type SetMyCommandsRequest ¶
type SetMyCommandsRequest struct {
Commands []BotCommand `json:"commands"`
Scope *BotCommandScope `json:"scope,omitempty"`
}
type Update ¶
type Update struct {
UpdateID int64 `json:"update_id"`
Message *Message `json:"message,omitempty"`
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
}
Source Files
¶
- api.go
- auto_approval.go
- bot_retry.go
- callback_data.go
- callbacks.go
- command_render.go
- command_runtime.go
- commands.go
- constants.go
- delivery.go
- delivery_address.go
- format.go
- helpers.go
- keyboards.go
- live_monitor.go
- message_transport.go
- messages.go
- monitor_state.go
- persona.go
- presenter.go
- prompts.go
- registration.go
- render_helpers.go
- restart.go
- restart_delivery.go
- run_render.go
- run_voice.go
- storage_upload.go
- types.go
- worker.go
- worker_constructor.go
- worker_types.go
Click to show internal directories.
Click to hide internal directories.