Documentation
¶
Index ¶
- Constants
- func DecodeJSON[T any](payload []byte) (T, error)
- func Updates(ctx context.Context, c Caller, limit int, timeout time.Duration, onErr OnError) <-chan Update
- type Caller
- type Chat
- type ChatType
- type Client
- type Error
- type GetLogger
- type HTTPClientDoer
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type KeyboardButton
- type KeyboardMarkup
- type LinkPreviewOptions
- type Message
- type MessageConfig
- type MessageEntity
- type MessageEntityType
- type NoneMarkup
- type OnError
- type Option
- type OptionMessage
- type ParseMode
- type Recipient
- type ReplyMarkup
- type ReplyParameters
- type RequestGetMe
- type RequestGetUpdates
- type Sendable
- type Update
- type User
Constants ¶
View Source
const BaseURL = "https://api.telegram.org/bot"
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type InlineKeyboardButton ¶
type InlineKeyboardButton struct { Text string `json:"text"` CallbackData string `json:"callback_data"` }
func NewInlineKeyboardButtonRow ¶
func NewInlineKeyboardButtonRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
func NewInlineKeyboard ¶
func NewInlineKeyboard(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup
type KeyboardButton ¶
type KeyboardButton struct {
Text string `json:"text"`
}
func NewKeyboardButtonRow ¶
func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton
type KeyboardMarkup ¶
type KeyboardMarkup struct { Keyboard [][]KeyboardButton `json:"keyboard"` ResizeKeyboard bool `json:"resize_keyboard"` OneTimeKeyboard bool `json:"one_time_keyboard"` }
func NewKeyboard ¶
func NewKeyboard(rows ...[]KeyboardButton) KeyboardMarkup
type LinkPreviewOptions ¶
type Message ¶
type Message struct { ID int64 `json:"message_id"` Unixtime int64 `json:"date"` Chat Chat `json:"chat"` From *User `json:"from"` Text string `json:"text"` GroupChatCreated bool `json:"group_chat_created"` NewChatTitle string `json:"new_chat_title,omitempty"` NewChatMembers []User `json:"new_chat_members,omitempty"` LeftChatMember *User `json:"left_chat_member,omitempty"` }
func SendMessage ¶
func SendMessage[R Recipient, M ReplyMarkup](ctx context.Context, c Caller, chatID int64, text string, opts ...OptionMessage[R, M], ) (*Message, error)
func (*Message) Params ¶
func (m *Message) Params() json.RawMessage
type MessageConfig ¶
type MessageConfig[R Recipient, M ReplyMarkup] struct { ChatID int64 `json:"chat_id"` ThreadID int64 `json:"message_thread_id,omitempty"` Text string `json:"text"` ParseMode ParseMode `json:"parse_mode,omitempty"` Entities []MessageEntity `json:"entities,omitempty"` LinkPreviewOptions *LinkPreviewOptions `json:"LinkPreviewOptions,omitempty"` DisableNotification bool `json:"disable_notification"` ProtectContent bool `json:"protect_content"` ReplyParameters *ReplyParameters[R] `json:"reply_parameters,omitempty"` ReplyMarkup M `json:"reply_markup,omitempty"` }
func (MessageConfig[R, M]) Method ¶
func (c MessageConfig[R, M]) Method() string
func (MessageConfig[R, M]) Params ¶
func (c MessageConfig[R, M]) Params() json.RawMessage
type MessageEntity ¶
type MessageEntityType ¶
type MessageEntityType string
const ( MessageEntityyMention MessageEntityType = "mention" MessageEntityHashtag MessageEntityType = "hashtag" MessageEntityCashtag MessageEntityType = "cashtag" MessageEntityBotCommand MessageEntityType = "bot_command" MessageEntityURL MessageEntityType = "url" MessageEntityEmail MessageEntityType = "email" MessageEntityPhoneNumber MessageEntityType = "phone_number" MessageEntityBold MessageEntityType = "bold" MessageEntityItalic MessageEntityType = "italic" MessageEntityUnderlime MessageEntityType = "underline" MessageEntityStrikethrough MessageEntityType = "strikethrough" MessageEntitySpoiler MessageEntityType = "spoiler" MessageEntityBlockquote MessageEntityType = "blockquote" MessageEntityCode MessageEntityType = "code" MessageEntityPre MessageEntityType = "pre" MessageEntityTextLink MessageEntityType = "text_link" MessageEntityTextMention MessageEntityType = "text_mention" MessageEntityCustomEmoji MessageEntityType = "custom_emoji" )
type NoneMarkup ¶
type NoneMarkup struct{}
type OnError ¶
type OnError func(req RequestGetUpdates, err error) (stop bool)
type Option ¶
type Option func(*Client)
func WithBaseURL ¶
func WithHTTPClient ¶
func WithHTTPClient(httpClient HTTPClientDoer) Option
func WithLogger ¶
type OptionMessage ¶
type OptionMessage[R Recipient, M ReplyMarkup] func(c *MessageConfig[R, M])
func WithInlineKeyboard ¶
func WithInlineKeyboard[R Recipient](markup InlineKeyboardMarkup) OptionMessage[R, InlineKeyboardMarkup]
func WithKeyboard ¶
func WithKeyboard[R Recipient](markup KeyboardMarkup) OptionMessage[R, KeyboardMarkup]
type ReplyMarkup ¶
type ReplyMarkup interface { NoneMarkup | KeyboardMarkup | InlineKeyboardMarkup }
type ReplyParameters ¶
type RequestGetMe ¶
type RequestGetMe struct{}
func (RequestGetMe) Method ¶
func (r RequestGetMe) Method() string
func (RequestGetMe) Params ¶
func (r RequestGetMe) Params() json.RawMessage
type RequestGetUpdates ¶
type RequestGetUpdates struct { Offset int64 `json:"offset"` Limit int `json:"limit"` Timeout int `json:"timeout"` AllowedUpdates []string `json:"allowed_updates,omitempty"` }
func (RequestGetUpdates) Method ¶
func (RequestGetUpdates) Method() string
func (RequestGetUpdates) Params ¶
func (r RequestGetUpdates) Params() json.RawMessage
type Sendable ¶
type Sendable interface { Method() string Params() json.RawMessage }
type Update ¶
func GetUpdates ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.