Documentation
¶
Index ¶
- Constants
- func IsRetryable(err error) bool
- type APIError
- type AnswerCallbackQueryRequest
- type AnswerGuestQueryRequest
- type AnswerInlineQueryRequest
- type Audio
- type BotAPI
- type BotCommand
- type BotCommandScope
- type CallbackQuery
- type Chat
- type ChosenInlineResult
- type Client
- func (c *Client) AnswerCallbackQuery(ctx context.Context, req AnswerCallbackQueryRequest) error
- func (c *Client) AnswerGuestQuery(ctx context.Context, req AnswerGuestQueryRequest) (SentGuestMessage, error)
- func (c *Client) AnswerInlineQuery(ctx context.Context, req AnswerInlineQueryRequest) 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) EditMessageMedia(ctx context.Context, req EditMessageMediaRequest) (EditMessageMediaResponse, 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) SendDocument(ctx context.Context, req SendDocumentRequest) (SentMessage, error)
- func (c *Client) SendMessage(ctx context.Context, req SendMessageRequest) (SentMessage, error)
- func (c *Client) SendMessageDraft(ctx context.Context, req SendMessageDraftRequest) 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 EditMessageMediaRequest
- type EditMessageMediaResponse
- type EditMessageTextRequest
- type EditMessageTextResponse
- type File
- type GetFileRequest
- type GetUpdatesRequest
- type HTTPDoer
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type InlineQuery
- type InlineQueryResultArticle
- type InputMediaAudio
- type InputTextMessageContent
- type KeyboardButton
- type Location
- type Message
- type PhotoSize
- type ReplyKeyboardMarkup
- type ReplyKeyboardRemove
- type SendAudioRequest
- type SendChatActionRequest
- type SendDocumentRequest
- type SendMessageDraftRequest
- type SendMessageRequest
- type SendVoiceRequest
- type SentGuestMessage
- 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 AnswerGuestQueryRequest ¶ added in v0.1.15
type AnswerGuestQueryRequest struct {
GuestQueryID string `json:"guest_query_id"`
Result InlineQueryResultArticle `json:"result"`
}
type AnswerInlineQueryRequest ¶ added in v0.1.15
type AnswerInlineQueryRequest struct {
InlineQueryID string `json:"inline_query_id"`
Results []InlineQueryResultArticle `json:"results"`
CacheTime int `json:"cache_time,omitempty"`
IsPersonal bool `json:"is_personal,omitempty"`
}
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)
SendMessageDraft(ctx context.Context, req SendMessageDraftRequest) error
SendChatAction(ctx context.Context, req SendChatActionRequest) error
SendVoice(ctx context.Context, req SendVoiceRequest) (SentMessage, error)
SendAudio(ctx context.Context, req SendAudioRequest) (SentMessage, error)
SendDocument(ctx context.Context, req SendDocumentRequest) (SentMessage, error)
EditMessageText(ctx context.Context, req EditMessageTextRequest) (EditMessageTextResponse, error)
EditMessageMedia(ctx context.Context, req EditMessageMediaRequest) (EditMessageMediaResponse, error)
AnswerCallbackQuery(ctx context.Context, req AnswerCallbackQueryRequest) error
AnswerGuestQuery(ctx context.Context, req AnswerGuestQueryRequest) (SentGuestMessage, error)
AnswerInlineQuery(ctx context.Context, req AnswerInlineQueryRequest) 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 ChosenInlineResult ¶ added in v0.1.15
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) AnswerGuestQuery ¶ added in v0.1.15
func (c *Client) AnswerGuestQuery(ctx context.Context, req AnswerGuestQueryRequest) (SentGuestMessage, error)
func (*Client) AnswerInlineQuery ¶ added in v0.1.15
func (c *Client) AnswerInlineQuery(ctx context.Context, req AnswerInlineQueryRequest) 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) EditMessageMedia ¶ added in v0.1.15
func (c *Client) EditMessageMedia(ctx context.Context, req EditMessageMediaRequest) (EditMessageMediaResponse, error)
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) SendDocument ¶ added in v0.1.15
func (c *Client) SendDocument(ctx context.Context, req SendDocumentRequest) (SentMessage, error)
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, req SendMessageRequest) (SentMessage, error)
func (*Client) SendMessageDraft ¶ added in v0.1.15
func (c *Client) SendMessageDraft(ctx context.Context, req SendMessageDraftRequest) 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 overrides the Bot API address; empty means Telegram's.
TelegramBaseURL string
AllowedUserID int64
InlineCachePath string
// CallbackCachePath keeps the long button data behind short references.
CallbackCachePath string
// RenderStatePath keeps which Telegram messages show each run in delivery.
RenderStatePath string
Geo *geo.OSMService
Offset *atomic.Int64
SkipCommandRegistration bool
}
type DeleteMessageRequest ¶
type DeleteMyCommandsRequest ¶
type DeleteMyCommandsRequest struct {
Scope *BotCommandScope `json:"scope,omitempty"`
}
type DeliveryAddress ¶
type DeliveryAddress struct {
Kind string `json:"kind,omitempty"`
ChatID int64 `json:"chat_id,omitempty"`
MessageID int64 `json:"message_id,omitempty"`
GuestQueryID string `json:"guest_query_id,omitempty"`
InlineMessageID string `json:"inline_message_id,omitempty"`
}
func ChatDeliveryAddress ¶ added in v0.2.0
func ChatDeliveryAddress(chatID int64) DeliveryAddress
ChatDeliveryAddress addresses the private or group chat chatID.
type EditMessageMediaRequest ¶ added in v0.1.15
type EditMessageMediaRequest struct {
ChatID int64 `json:"chat_id,omitempty"`
MessageID int64 `json:"message_id,omitempty"`
InlineMessageID string `json:"inline_message_id,omitempty"`
Media InputMediaAudio `json:"media"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
type EditMessageMediaResponse ¶ added in v0.1.15
type EditMessageMediaResponse struct {
MessageID int64 `json:"message_id"`
}
type EditMessageTextRequest ¶
type EditMessageTextRequest struct {
ChatID int64 `json:"chat_id,omitempty"`
MessageID int64 `json:"message_id,omitempty"`
InlineMessageID string `json:"inline_message_id,omitempty"`
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 InlineQuery ¶ added in v0.1.15
type InlineQueryResultArticle ¶ added in v0.1.15
type InlineQueryResultArticle struct {
Type string `json:"type"`
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
InputMessageContent InputTextMessageContent `json:"input_message_content"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
type InputMediaAudio ¶ added in v0.1.15
type InputTextMessageContent ¶ added in v0.1.15
type KeyboardButton ¶ added in v0.1.16
type Location ¶ added in v0.1.15
type Location struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
LivePeriod int `json:"live_period,omitempty"`
Heading int `json:"heading,omitempty"`
ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}
type Message ¶
type Message struct {
MessageID int64 `json:"message_id"`
Date int64 `json:"date,omitempty"`
From *User `json:"from,omitempty"`
Chat Chat `json:"chat"`
GuestQueryID string `json:"guest_query_id,omitempty"`
GuestBotCallerUser *User `json:"guest_bot_caller_user,omitempty"`
GuestBotCallerChat *Chat `json:"guest_bot_caller_chat,omitempty"`
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"`
Location *Location `json:"location,omitempty"`
ReplyToMessage *Message `json:"reply_to_message,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
type ReplyKeyboardMarkup ¶ added in v0.1.16
type ReplyKeyboardMarkup struct {
Keyboard [][]KeyboardButton `json:"keyboard"`
ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
Selective bool `json:"selective,omitempty"`
}
type ReplyKeyboardRemove ¶ added in v0.1.16
type SendAudioRequest ¶ added in v0.1.10
type SendChatActionRequest ¶
type SendDocumentRequest ¶ added in v0.1.15
type SendMessageDraftRequest ¶ added in v0.1.15
type SendMessageRequest ¶
type SendVoiceRequest ¶ added in v0.1.9
type SentGuestMessage ¶ added in v0.1.15
type SentGuestMessage struct {
InlineMessageID string `json:"inline_message_id"`
}
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"`
GuestMessage *Message `json:"guest_message,omitempty"`
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
}
type User ¶
type User struct {
ID int64 `json:"id"`
IsBot bool `json:"is_bot"`
Username string `json:"username,omitempty"`
CanJoinGroups bool `json:"can_join_groups,omitempty"`
CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
SupportsGuestQueries bool `json:"supports_guest_queries,omitempty"`
SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
HasTopicsEnabled bool `json:"has_topics_enabled,omitempty"`
AllowsUsersToCreateTopics bool `json:"allows_users_to_create_topics,omitempty"`
CanManageBots bool `json:"can_manage_bots,omitempty"`
}
Source Files
¶
- api.go
- assistant_stream.go
- bot_retry.go
- callback_data.go
- callbacks.go
- command_render.go
- command_runtime.go
- commands.go
- constants.go
- delivery.go
- delivery_address.go
- delivery_queue.go
- format.go
- helpers.go
- inline.go
- keyboards.go
- location_context.go
- message_transport.go
- messages.go
- persona.go
- presenter.go
- prompts.go
- recent.go
- ref_store.go
- registration.go
- render_helpers.go
- render_state_file.go
- restart.go
- run_cancel.go
- run_messages.go
- run_notes.go
- run_render.go
- run_status.go
- run_todo.go
- run_voice.go
- storage_upload.go
- types.go
- typing_indicator.go
- worker.go
- worker_constructor.go
- worker_types.go
Click to show internal directories.
Click to hide internal directories.