Documentation
¶
Overview ¶
Package maxbot implements MAX Bot API. Official documentation: https://dev.max.ru/
Index ¶
- Constants
- Variables
- type APIError
- type Api
- type HttpClient
- type Keyboard
- type KeyboardRow
- func (k *KeyboardRow) AddButton(b schemes.ButtonInterface) *KeyboardRow
- func (k *KeyboardRow) AddCallback(text string, intent schemes.Intent, payload string) *KeyboardRow
- func (k *KeyboardRow) AddContact(text string) *KeyboardRow
- func (k *KeyboardRow) AddGeolocation(text string, quick bool) *KeyboardRow
- func (k *KeyboardRow) AddLink(text string, _ schemes.Intent, url string) *KeyboardRow
- func (k *KeyboardRow) AddMessage(text string) *KeyboardRow
- func (k *KeyboardRow) AddOpenApp(text string, app, payload string, contactId int64) *KeyboardRow
- func (k *KeyboardRow) Build() []schemes.ButtonInterface
- type Message
- func (m *Message) AddAudio(audio *schemes.UploadedInfo) *Message
- func (m *Message) AddContact(name string, contactID int64, vcfInfo string, vcfPhone string) *Message
- func (m *Message) AddFile(file *schemes.UploadedInfo) *Message
- func (m *Message) AddKeyboard(keyboard *Keyboard) *Message
- func (m *Message) AddLocation(lat float64, lon float64) *Message
- func (m *Message) AddMarkUp(user int64, from int, len int) *Message
- func (m *Message) AddPhoto(photo *schemes.PhotoTokens) *Message
- func (m *Message) AddPhotoByToken(token string) *Message
- func (m *Message) AddSticker(code string) *Message
- func (m *Message) AddVideo(video *schemes.UploadedInfo) *Message
- func (m *Message) Reply(text string, reply schemes.Message) *Message
- func (m *Message) SetChat(chatID int64) *Message
- func (m *Message) SetFormat(format schemes.Format) *Message
- func (m *Message) SetNotify(notify bool) *Message
- func (m *Message) SetPhoneNumbers(phoneNumbers []string) *Message
- func (m *Message) SetReply(text, id string) *Message
- func (m *Message) SetReset(reset bool) *Message
- func (m *Message) SetText(text string) *Message
- func (m *Message) SetUser(userID int64) *Message
- type MessageResponse
- type NetworkError
- type Option
- func WithApiTimeout(timeout time.Duration) Option
- func WithBaseURL(baseURL string) Option
- func WithDebugChat(chat int64) Option
- func WithDebugMode() Option
- func WithHTTPClient(httpClient HttpClient) Option
- func WithPauseTimeout(timeout time.Duration) Option
- func WithUpdateHandler(f UpdateHandler) Option
- func WithVersion(version string) Option
- type SerializationError
- type TimeoutError
- type UpdateHandler
- type UpdatesParams
Constants ¶
View Source
const (
Version = "1.2.5"
)
Variables ¶
View Source
var ( ErrEmptyToken = errors.New("bot token is empty") ErrInvalidURL = errors.New("invalid API URL") )
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Code int `json:"code"`
Message string `json:"message"`
Details string `json:"details,omitempty"`
}
func (*APIError) IsAttachmentNotReady ¶
type Api ¶
type Api struct {
Bots *bots
Chats *chats
Debugs *debugs
Messages *messages
Subscriptions *subscriptions
Uploads *uploads
// contains filtered or unexported fields
}
Api represents the MAX Bot API client.
func (*Api) GetHandler ¶
func (a *Api) GetHandler(updates chan<- schemes.UpdateInterface) http.HandlerFunc
GetHandler returns an http.HandlerFunc for webhook handling.
func (*Api) GetUpdates ¶
func (a *Api) GetUpdates(ctx context.Context) <-chan schemes.UpdateInterface
GetUpdates returns a channel that delivers updates from the API.
type Keyboard ¶
type Keyboard struct {
// contains filtered or unexported fields
}
Keyboard implements a builder for the inline keyboard.
func (*Keyboard) AddRow ¶
func (k *Keyboard) AddRow() *KeyboardRow
AddRow adds a row to the inline keyboard.
type KeyboardRow ¶
type KeyboardRow struct {
// contains filtered or unexported fields
}
KeyboardRow represents a button row.
func (*KeyboardRow) AddButton ¶
func (k *KeyboardRow) AddButton(b schemes.ButtonInterface) *KeyboardRow
func (*KeyboardRow) AddCallback ¶
func (k *KeyboardRow) AddCallback(text string, intent schemes.Intent, payload string) *KeyboardRow
AddCallback button.
func (*KeyboardRow) AddContact ¶
func (k *KeyboardRow) AddContact(text string) *KeyboardRow
AddContact button.
func (*KeyboardRow) AddGeolocation ¶
func (k *KeyboardRow) AddGeolocation(text string, quick bool) *KeyboardRow
AddGeolocation button.
func (*KeyboardRow) AddLink ¶
func (k *KeyboardRow) AddLink(text string, _ schemes.Intent, url string) *KeyboardRow
AddLink button.
func (*KeyboardRow) AddMessage ¶
func (k *KeyboardRow) AddMessage(text string) *KeyboardRow
AddMessage button.
func (*KeyboardRow) AddOpenApp ¶
func (k *KeyboardRow) AddOpenApp(text string, app, payload string, contactId int64) *KeyboardRow
AddOpenApp button.
func (*KeyboardRow) Build ¶
func (k *KeyboardRow) Build() []schemes.ButtonInterface
Build returns keyboard rows.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func NewMessage ¶
func NewMessage() *Message
func (*Message) AddContact ¶
func (*Message) AddKeyboard ¶
func (*Message) AddPhotoByToken ¶
func (*Message) AddSticker ¶
func (*Message) SetPhoneNumbers ¶
type MessageResponse ¶
MessageResponse represents the response wrapper when a message is sent
type NetworkError ¶
func (*NetworkError) Error ¶
func (e *NetworkError) Error() string
func (*NetworkError) Unwrap ¶
func (e *NetworkError) Unwrap() error
type Option ¶
type Option func(api *Api)
func WithApiTimeout ¶
func WithBaseURL ¶
func WithDebugChat ¶
func WithDebugMode ¶
func WithDebugMode() Option
func WithHTTPClient ¶
func WithHTTPClient(httpClient HttpClient) Option
func WithPauseTimeout ¶
func WithUpdateHandler ¶
func WithUpdateHandler(f UpdateHandler) Option
func WithVersion ¶
type SerializationError ¶
func (*SerializationError) Error ¶
func (e *SerializationError) Error() string
func (*SerializationError) Unwrap ¶
func (e *SerializationError) Unwrap() error
type TimeoutError ¶
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
func (*TimeoutError) Timeout ¶
func (e *TimeoutError) Timeout() bool
type UpdateHandler ¶
type UpdateHandler func(schemes.UpdateInterface)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.