Documentation ¶
Index ¶
- Constants
- type AdminsListResponse
- type Bot
- func (b *Bot) BlockChatUser(chatID, userID string, deleteLastMessages bool) error
- func (b *Bot) EditMessage(message *Message) error
- func (b *Bot) GetChatAdmins(chatID string) ([]ChatMember, error)
- func (b *Bot) GetChatBlockedUsers(chatID string) ([]User, error)
- func (b *Bot) GetChatInfo(chatID string) (*Chat, error)
- func (b *Bot) GetChatMembers(chatID string) ([]ChatMember, error)
- func (b *Bot) GetChatPendingUsers(chatID string) ([]User, error)
- func (b *Bot) GetFileInfo(fileID string) (*File, error)
- func (b *Bot) GetInfo() (*BotInfo, error)
- func (b *Bot) GetUpdatesChannel(ctx context.Context) <-chan Event
- func (b *Bot) NewButtonResponse(queryID, url, text string, showAlert bool) *ButtonResponse
- func (b *Bot) NewChat(id string) *Chat
- func (b *Bot) NewFileMessage(chatID string, file *os.File) *Message
- func (b *Bot) NewFileMessageByFileID(chatID, fileID string) *Message
- func (b *Bot) NewInlineKeyboardMessage(chatID, text string, keyboard [][]Button) *Message
- func (b *Bot) NewMessage(chatID string) *Message
- func (b *Bot) NewMessageFromPart(message PartMessage) *Message
- func (b *Bot) NewTextMessage(chatID, text string) *Message
- func (b *Bot) NewVoiceMessage(chatID string, file *os.File) *Message
- func (b *Bot) NewVoiceMessageByFileID(chatID, fileID string) *Message
- func (b *Bot) ResolveChatJoinRequests(chatID, userID string, accept, everyone bool) error
- func (b *Bot) SendChatActions(chatID string, actions ...ChatAction) error
- func (b *Bot) SendMessage(message *Message) error
- func (b *Bot) SetChatAbout(chatID, about string) error
- func (b *Bot) SetChatRules(chatID, rules string) error
- func (b *Bot) SetChatTitle(chatID, title string) error
- func (b *Bot) UnblockChatUser(chatID, userID string) error
- type BotApiURL
- type BotDebug
- type BotInfo
- type BotOption
- type BotPollTime
- type Button
- type ButtonResponse
- type Chat
- func (c *Chat) BlockUser(userID string, deleteLastMessages bool) error
- func (c *Chat) GetAdmins() ([]ChatMember, error)
- func (c *Chat) GetBlockedUsers() ([]User, error)
- func (c *Chat) GetMembers() ([]ChatMember, error)
- func (c *Chat) GetPendingUsers() ([]User, error)
- func (v Chat) MarshalEasyJSON(w *jwriter.Writer)
- func (v Chat) MarshalJSON() ([]byte, error)
- func (c *Chat) ResolveAllJoinRequests(accept bool) error
- func (c *Chat) ResolveJoinRequest(userID string, accept bool) error
- func (c *Chat) SendActions(actions ...ChatAction) error
- func (c *Chat) SetAbout(about string) error
- func (c *Chat) SetRules(rules string) error
- func (c *Chat) SetTitle(title string) error
- func (c *Chat) UnblockUser(userID string) error
- func (v *Chat) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Chat) UnmarshalJSON(data []byte) error
- type ChatAction
- type ChatMember
- type ChatType
- type Client
- func (c *Client) BlockChatUser(chatID, userID string, deleteLastMessages bool) error
- func (c *Client) DeleteMessage(message *Message) error
- func (c *Client) Do(path string, params url.Values, file *os.File) ([]byte, error)
- func (c *Client) EditMessage(message *Message) error
- func (c *Client) GetChatAdmins(chatID string) ([]ChatMember, error)
- func (c *Client) GetChatBlockedUsers(chatID string) ([]User, error)
- func (c *Client) GetChatInfo(chatID string) (*Chat, error)
- func (c *Client) GetChatMembers(chatID string) ([]ChatMember, error)
- func (c *Client) GetChatPendingUsers(chatID string) ([]User, error)
- func (c *Client) GetEvents(lastEventID int, pollTime int) ([]*Event, error)
- func (c *Client) GetFileInfo(fileID string) (*File, error)
- func (c *Client) GetInfo() (*BotInfo, error)
- func (c *Client) GetVoiceInfo(fileID string) (*File, error)
- func (c *Client) PinMessage(message *Message) error
- func (c *Client) ResolveChatPending(chatID, userID string, approve, everyone bool) error
- func (c *Client) SendAnswerCallbackQuery(answer *ButtonResponse) error
- func (c *Client) SendChatActions(chatID string, actions ...ChatAction) error
- func (c *Client) SendFileMessage(message *Message) error
- func (c *Client) SendTextMessage(message *Message) error
- func (c *Client) SendVoiceMessage(message *Message) error
- func (c *Client) SetChatAbout(chatID, about string) error
- func (c *Client) SetChatRules(chatID, rules string) error
- func (c *Client) SetChatTitle(chatID, title string) error
- func (c *Client) UnblockChatUser(chatID, userID string) error
- func (c *Client) UnpinMessage(message *Message) error
- func (c *Client) UploadFile(message *Message) error
- func (c *Client) UploadVoice(message *Message) error
- type Contact
- type Event
- type EventPayload
- func (ep *EventPayload) CallbackQuery() *ButtonResponse
- func (v EventPayload) MarshalEasyJSON(w *jwriter.Writer)
- func (v EventPayload) MarshalJSON() ([]byte, error)
- func (ep *EventPayload) Message() *Message
- func (v *EventPayload) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *EventPayload) UnmarshalJSON(data []byte) error
- type EventType
- type File
- type MembersListResponse
- type Message
- func (m *Message) AttachExistingFile(fileID string)
- func (m *Message) AttachExistingVoice(fileID string)
- func (m *Message) AttachInlineKeyboard(keyboard [][]Button)
- func (m *Message) AttachNewFile(file *os.File)
- func (m *Message) AttachNewVoice(file *os.File)
- func (m *Message) Delete() error
- func (m *Message) Edit() error
- func (m *Message) Forward(chatID string) error
- func (v Message) MarshalEasyJSON(w *jwriter.Writer)
- func (v Message) MarshalJSON() ([]byte, error)
- func (m *Message) Pin() error
- func (m *Message) Reply(text string) error
- func (m *Message) Send() error
- func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Message) UnmarshalJSON(data []byte) error
- func (m *Message) Unpin() error
- type MessageContentType
- type MockHandler
- type Part
- type PartMessage
- type PartPayload
- type PartType
- type Photo
- type Response
- type Updater
- type User
- type UsersListResponse
Constants ¶
const ( NEW_MESSAGE EventType = "newMessage" EDITED_MESSAGE EventType = "editedMessage" DELETED_MESSAGE EventType = "deletedMessage" PINNED_MESSAGE EventType = "pinnedMessage" UNPINNED_MESSAGE EventType = "unpinnedMessage" NEW_CHAT_MEMBERS EventType = "newChatMembers" LEFT_CHAT_MEMBERS EventType = "leftChatMembers" CALLBACK_QUERY EventType = "callbackQuery" STICKER PartType = "sticker" MENTION PartType = "mention" VOICE PartType = "voice" FILE PartType = "file" FORWARD PartType = "forward" REPLY PartType = "reply" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminsListResponse ¶
type AdminsListResponse struct {
List []ChatMember `json:"admins"`
}
func (AdminsListResponse) MarshalEasyJSON ¶
func (v AdminsListResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AdminsListResponse) MarshalJSON ¶
func (v AdminsListResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AdminsListResponse) UnmarshalEasyJSON ¶
func (v *AdminsListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AdminsListResponse) UnmarshalJSON ¶
func (v *AdminsListResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Bot ¶
type Bot struct { Info *BotInfo // contains filtered or unexported fields }
Bot is the main structure for interaction with API. All fields are private, you can configure bot using config arguments in NewBot func.
func NewBot ¶
NewBot returns new bot object. All communications with bot API must go through Bot struct. In general you don't need to configure this bot, therefore all options are optional arguments.
func (*Bot) BlockChatUser ¶
BlockChatUser blocks user and removes him from chat. If deleteLastMessages is true, the messages written recently will be deleted
func (*Bot) EditMessage ¶
EditMessage edit a message passed as an argument.
func (*Bot) GetChatAdmins ¶
func (b *Bot) GetChatAdmins(chatID string) ([]ChatMember, error)
GetChatAdmins returns chat admins list with fields: userID, creator flag
func (*Bot) GetChatBlockedUsers ¶
GetChatBlockedUsers returns chat blocked users list: userID
func (*Bot) GetChatInfo ¶
GetChatInfo returns information about chat: id, type, title, public, group, inviteLink, admins
func (*Bot) GetChatMembers ¶
func (b *Bot) GetChatMembers(chatID string) ([]ChatMember, error)
GetChatMem returns chat members list with fields: userID, creator flag, admin flag
func (*Bot) GetChatPendingUsers ¶
GetChatPendingUsers returns chat join pending users list: userID
func (*Bot) GetFileInfo ¶
GetFileInfo returns information about file: id, type, size, filename, url
func (*Bot) GetUpdatesChannel ¶
GetUpdatesChannel returns a channel, which will be filled with events. You can pass cancellable context there and stop receiving events. The channel will be closed after context cancellation.
func (*Bot) NewButtonResponse ¶
func (b *Bot) NewButtonResponse(queryID, url, text string, showAlert bool) *ButtonResponse
NewButtonResponse returns new ButtonResponse
func (*Bot) NewFileMessage ¶
NewFileMessage returns new file message
func (*Bot) NewFileMessageByFileID ¶
NewFileMessageByFileID returns new message with previously uploaded file id
func (*Bot) NewInlineKeyboardMessage ¶
NewInlineKeyboardMessage returns new text message with inline keyboard
func (*Bot) NewMessage ¶
NewMessage returns new message
func (*Bot) NewMessageFromPart ¶
func (b *Bot) NewMessageFromPart(message PartMessage) *Message
NewMessageFromPart returns new message based on part message
func (*Bot) NewTextMessage ¶
NewTextMessage returns new text message
func (*Bot) NewVoiceMessage ¶
NewVoiceMessage returns new voice message
func (*Bot) NewVoiceMessageByFileID ¶
NewVoiceMessageByFileID returns new message with previously uploaded voice file id
func (*Bot) ResolveChatJoinRequests ¶
ResolveChatJoinRequests sends a decision to accept/decline user join to chat
func (*Bot) SendChatActions ¶
func (b *Bot) SendChatActions(chatID string, actions ...ChatAction) error
SendChatActions sends an actions like "typing, looking"
func (*Bot) SendMessage ¶
SendMessage sends a message, passed as an argument. This method fills the argument with ID of sent message and returns an error if any.
func (*Bot) SetChatAbout ¶
SetChatAbout changes chat about
func (*Bot) SetChatRules ¶
SetChatRules changes chat rules
func (*Bot) SetChatTitle ¶
SetChatTitle changes chat title
func (*Bot) UnblockChatUser ¶
UnblockChatUser unblocks user in chat
type BotInfo ¶
type BotInfo struct { User // Nickname of the bot Nick string `json:"nick"` // Name of the bot FirstName string `json:"firstName"` // Information about the box About string `json:"about"` // A slice of avatars Photo []Photo `json:"photo"` }
func (BotInfo) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (BotInfo) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*BotInfo) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BotInfo) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type BotPollTime ¶
type BotPollTime int
func (BotPollTime) Type ¶
func (o BotPollTime) Type() string
func (BotPollTime) Value ¶
func (o BotPollTime) Value() interface{}
type Button ¶
type Button struct { // Button text Text string `json:"text"` // URL to be opened // You can't use it with CallbackData URL string `json:"url,omitempty"` // Data that identify the button // You can't use it with URL CallbackData string `json:"callbackData,omitempty"` }
Button represents a button in inline keyboard
func NewCallbackButton ¶
NewCallbackButton returns new button with CallbackData field
func NewURLButton ¶
NewURLButton returns new button with URL field
func (Button) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Button) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Button) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Button) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ButtonResponse ¶
type ButtonResponse struct { // Id of the query QueryID string `json:"queryId"` // Text of the response message Text string `json:"text"` // Display alert? ShowAlert bool `json:"showAlert"` // URL to be opened URL string `json:"url"` // CallbackData of the query (id of the pressed button). CallbackData string `json:"callbackData"` // contains filtered or unexported fields }
ButtonResponse represents a data that is returned when a button is clicked
func (ButtonResponse) MarshalEasyJSON ¶
func (v ButtonResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ButtonResponse) MarshalJSON ¶
func (v ButtonResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ButtonResponse) Send ¶
func (cl *ButtonResponse) Send() error
Send method sends your response message. Make sure you have QueryID in your ButtonResponse.
func (*ButtonResponse) UnmarshalEasyJSON ¶
func (v *ButtonResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ButtonResponse) UnmarshalJSON ¶
func (v *ButtonResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Chat ¶
type Chat struct { // Id of the chat ID string `json:"chatId"` // Type of the chat: channel, group or private Type ChatType `json:"type"` // First name of the user FirstName string `json:"firstName"` // Last name of the user LastName string `json:"lastName"` // Nick of the user Nick string `json:"nick"` // User about or group/channel description About string `json:"about"` // Rules of the group/channel Rules string `json:"rules"` // Title of the chat Title string `json:"title"` // Flag that indicates that requested chat is the bot IsBot bool `json:"isBot"` // Is this chat public? Public bool `json:"public"` // Is this chat has join moderation? JoinModeration bool `json:"joinModeration"` // You can send this link to all your friends InviteLink string `json:"inviteLink"` // contains filtered or unexported fields }
func (*Chat) BlockUser ¶
Block user and remove him from chat. If deleteLastMessages is true, the messages written recently will be deleted
func (*Chat) GetAdmins ¶
func (c *Chat) GetAdmins() ([]ChatMember, error)
Get chat administrators list
func (*Chat) GetBlockedUsers ¶
Get chat blocked users list
func (*Chat) GetPendingUsers ¶
Get chat join pending users list
func (Chat) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Chat) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Chat) ResolveAllJoinRequests ¶
ResolveAllJoinRequest resolve all chat join requests
func (*Chat) ResolveJoinRequest ¶
ResolveJoinRequest resolve specific user chat join request
func (*Chat) SendActions ¶
func (c *Chat) SendActions(actions ...ChatAction) error
Send bot actions to the chat
You can call this method every time you change the current actions, or every 10 seconds if the actions have not changed. After sending a request without active action, you should not re-notify of their absence.
func (*Chat) UnblockUser ¶
Unblock user in chat (but not add him back)
func (*Chat) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Chat) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ChatAction ¶
type ChatAction = string
const ( TypingAction ChatAction = "typing" LookingAction ChatAction = "looking" )
type ChatMember ¶
func (ChatMember) MarshalEasyJSON ¶
func (v ChatMember) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ChatMember) MarshalJSON ¶
func (v ChatMember) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ChatMember) UnmarshalEasyJSON ¶
func (v *ChatMember) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ChatMember) UnmarshalJSON ¶
func (v *ChatMember) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BlockChatUser ¶
func (*Client) DeleteMessage ¶
func (*Client) EditMessage ¶
func (*Client) GetChatAdmins ¶
func (c *Client) GetChatAdmins(chatID string) ([]ChatMember, error)
func (*Client) GetChatBlockedUsers ¶
func (*Client) GetChatMembers ¶
func (c *Client) GetChatMembers(chatID string) ([]ChatMember, error)
func (*Client) GetChatPendingUsers ¶
func (*Client) PinMessage ¶
func (*Client) ResolveChatPending ¶
func (*Client) SendAnswerCallbackQuery ¶
func (c *Client) SendAnswerCallbackQuery(answer *ButtonResponse) error
func (*Client) SendChatActions ¶
func (c *Client) SendChatActions(chatID string, actions ...ChatAction) error
func (*Client) SendFileMessage ¶
func (*Client) SendTextMessage ¶
func (*Client) SendVoiceMessage ¶
func (*Client) SetChatAbout ¶
func (*Client) SetChatRules ¶
func (*Client) SetChatTitle ¶
func (*Client) UnblockChatUser ¶
func (*Client) UnpinMessage ¶
func (*Client) UploadFile ¶
func (*Client) UploadVoice ¶
type Contact ¶
func (Contact) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Contact) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Contact) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Contact) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Event ¶
type Event struct { // Id of the event EventID int `json:"eventId"` // Type of the event: newMessage, editedMessage, deletedMessage, pinnedMessage, unpinnedMessage, newChatMembers Type EventType `json:"type"` // Payload of the event Payload EventPayload `json:"payload"` // contains filtered or unexported fields }
func (Event) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Event) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Event) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Event) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type EventPayload ¶
type EventPayload struct { // Id of the message. // Presented in newMessage, editedMessage, deletedMessage, pinnedMessage, unpinnedMessage events. MsgID string `json:"msgId"` // Chat info. // Presented in all events. Chat Chat `json:"chat"` // Author of the message // Presented in newMessage and editedMessage events. From Contact `json:"from"` // Text of the message. // Presented in newMessage, editedMessage and pinnedMessage events. Text string `json:"text"` // Parts of the message. // Presented only in newMessage event. Parts []Part `json:"parts"` // Timestamp of the event. Timestamp int `json:"timestamp"` // Id of the query. // Presented only in callbackQuery event. QueryID string `json:"queryId"` // CallbackData of the query (id of button). // Presented only in callbackQuery event. CallbackData string `json:"callbackData"` LeftMembers []Contact `json:"leftMembers"` NewMembers []Contact `json:"newMembers"` AddedBy Contact `json:"addedBy"` RemovedBy Contact `json:"removedBy"` // contains filtered or unexported fields }
func (*EventPayload) CallbackQuery ¶
func (ep *EventPayload) CallbackQuery() *ButtonResponse
func (EventPayload) MarshalEasyJSON ¶
func (v EventPayload) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (EventPayload) MarshalJSON ¶
func (v EventPayload) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*EventPayload) Message ¶
func (ep *EventPayload) Message() *Message
func (*EventPayload) UnmarshalEasyJSON ¶
func (v *EventPayload) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*EventPayload) UnmarshalJSON ¶
func (v *EventPayload) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type File ¶
type File struct { // Id of the file ID string `json:"fileId"` // Type of the file Type string `json:"type"` // Size in bytes Size uint64 `json:"size"` // Name of file Name string `json:"filename"` // URL to the file URL string `json:"url"` }
func (File) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (File) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*File) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*File) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type MembersListResponse ¶
type MembersListResponse struct { // TODO: cursor List []ChatMember `json:"members"` }
func (MembersListResponse) MarshalEasyJSON ¶
func (v MembersListResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (MembersListResponse) MarshalJSON ¶
func (v MembersListResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*MembersListResponse) UnmarshalEasyJSON ¶
func (v *MembersListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*MembersListResponse) UnmarshalJSON ¶
func (v *MembersListResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Message ¶
type Message struct { ContentType MessageContentType // Id of the message (for editing) ID string `json:"msgId"` From Contact `json:"from"` // File contains file attachment of the message File *os.File `json:"-"` // Id of file to send FileID string `json:"fileId"` // Text of the message or caption for file Text string `json:"text"` // Chat where to send the message Chat Chat `json:"chat"` // Id of replied message // You can't use it with ForwardMsgID or ForwardChatID ReplyMsgID string `json:"replyMsgId"` // Id of forwarded message // You can't use it with ReplyMsgID ForwardMsgID string `json:"forwardMsgId"` // Id of a chat from which you forward the message // You can't use it with ReplyMsgID // You should use it with ForwardMsgID ForwardChatID string `json:"forwardChatId"` Timestamp int `json:"timestamp"` // The markup for the inline keyboard InlineKeyboard [][]Button `json:"inlineKeyboardMarkup"` // contains filtered or unexported fields }
Message represents a text message
func (*Message) AttachExistingFile ¶
func (*Message) AttachExistingVoice ¶
func (*Message) AttachInlineKeyboard ¶
func (*Message) AttachNewFile ¶
func (*Message) AttachNewVoice ¶
func (*Message) Forward ¶
Forward method forwards your message to chat. Make sure you have ID in your message.
func (Message) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Message) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Message) Send ¶
Send method sends your message. Make sure you have Text or FileID in your message.
func (*Message) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Message) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type MessageContentType ¶
type MessageContentType uint8
const ( Unknown MessageContentType = iota Text OtherFile Voice )
type MockHandler ¶
func (*MockHandler) GetEvents ¶
func (h *MockHandler) GetEvents(w http.ResponseWriter)
func (*MockHandler) SendMessage ¶
func (h *MockHandler) SendMessage(w http.ResponseWriter)
func (*MockHandler) ServeHTTP ¶
func (h *MockHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*MockHandler) TokenError ¶
func (h *MockHandler) TokenError(w http.ResponseWriter)
type Part ¶
type Part struct { // Type of the part Type PartType `json:"type"` // Payload of the part Payload PartPayload `json:"payload"` }
func (Part) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Part) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Part) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Part) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type PartMessage ¶
type PartMessage struct { From Contact `json:"from"` MsgID string `json:"msgId"` Text string `json:"text"` Timestamp int `json:"timestamp"` }
func (PartMessage) MarshalEasyJSON ¶
func (v PartMessage) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (PartMessage) MarshalJSON ¶
func (v PartMessage) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*PartMessage) UnmarshalEasyJSON ¶
func (v *PartMessage) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*PartMessage) UnmarshalJSON ¶
func (v *PartMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type PartPayload ¶
type PartPayload struct { FirstName string `json:"firstName"` LastName string `json:"lastName"` UserID string `json:"userId"` FileID string `json:"fileId"` Caption string `json:"caption"` Type string `json:"type"` PartMessage PartMessage `json:"message"` Message PartMessage `json:"-"` }
func (PartPayload) MarshalEasyJSON ¶
func (v PartPayload) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (PartPayload) MarshalJSON ¶
func (v PartPayload) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*PartPayload) UnmarshalEasyJSON ¶
func (v *PartPayload) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*PartPayload) UnmarshalJSON ¶
func (v *PartPayload) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Photo ¶
type Photo struct {
URL string `json:"url"`
}
func (Photo) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Photo) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Photo) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Photo) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Response ¶
func (Response) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Response) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Response) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Response) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Updater ¶
type Updater struct { PollTime int // contains filtered or unexported fields }
func (*Updater) NewMessageFromPayload ¶
func (u *Updater) NewMessageFromPayload(message EventPayload) *Message
NewMessageFromPart returns new message based on part message
type User ¶
type User struct {
ID string `json:"userId"`
}
func (User) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (User) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*User) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*User) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type UsersListResponse ¶
type UsersListResponse struct {
List []User `json:"users"`
}
func (UsersListResponse) MarshalEasyJSON ¶
func (v UsersListResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (UsersListResponse) MarshalJSON ¶
func (v UsersListResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*UsersListResponse) UnmarshalEasyJSON ¶
func (v *UsersListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UsersListResponse) UnmarshalJSON ¶
func (v *UsersListResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface