Documentation
¶
Index ¶
- Constants
- type ClientInfo
- type ExtendedResponse
- type KeyboardRow
- type Message
- type MessageKeyboard
- func (k *MessageKeyboard) AddButton(btn MessageKeyboardButton) *MessageKeyboard
- func (k *MessageKeyboard) AddCallbackButton(label string, color string, payload ...string) *MessageKeyboard
- func (k *MessageKeyboard) AddOpenLinkButton(link, label string, payload string) *MessageKeyboard
- func (k *MessageKeyboard) AddRow() *MessageKeyboard
- func (k *MessageKeyboard) AddTextButton(label string, color string, payload ...string) *MessageKeyboard
- func (k *MessageKeyboard) MakeInline() *MessageKeyboard
- func (k *MessageKeyboard) MakeOneTime() *MessageKeyboard
- func (k *MessageKeyboard) MarshalJSON() ([]byte, error)
- func (k *MessageKeyboard) UnmarshalJSON(data []byte) error
- type MessageKeyboardButton
- type MessageKeyboardButtonAction
- type MessagesEvent
- type MessagesNew
Constants ¶
View Source
const ( // ButtonText A button that sends a message with text specified in the label. ButtonText = "text" // ButtonVKPay Opens the VK Pay window with predefined parameters. The button is called // “Pay with VK Pay” (VK Pay is displayed as a logo). This button always // stretches to the whole keyboard width. ButtonVKPay = "vkpay" // ButtonVKApp Opens a specified VK Apps app. This button always stretches to the whole // keyboard width. ButtonVKApp = "open_app" // ButtonLocation Sends the location to the chat. This button always stretches to the // whole keyboard width. ButtonLocation = "location" // ButtonOpenLink Opens the specified link. ButtonOpenLink = "open_link" // ButtonCallback Allows, without sending a message from the user, to receive a // notification about pressing the button and perform the necessary action. ButtonCallback = "callback" )
Button action type.
View Source
const ( Primary = "primary" // Blue button, indicates the main action. #5181B8 ButtonBlue Secondary = "secondary" // Default white button. #FFFFFF ButtonWhite Negative = "negative" // Dangerous or negative action (cancel, delete etc.) #E64646 ButtonRed Positive = "positive" // Accept, agree. #4BB34B ButtonGreen )
Button color. This parameter is used only for buttons with the text and callback types.
View Source
const ( PeerIDsParam = "peer_ids" MessageParam = "message" RandomIDParam = "random_id" KeyboardParam = "keyboard" TemplateParam = "template" EventIDParam = "event_id" UserIDParam = "user_id" PeerIDParam = "peer_id" EventDataParam = "event_data" MessageIDsParam = "message_ids" PreviewLengthParam = "preview_length" ExtendedParam = "extended" FieldsParam = "fields" GroupIDParam = "group_id" CmIDsParam = "cmids" ConversationMessageIDs = "conversation_message_ids" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInfo ¶
type ExtendedResponse ¶
type ExtendedResponse struct {
Profiles []usermodel.User `json:"profiles,omitempty"`
Groups []groupmodel.Group `json:"groups,omitempty"`
}
type KeyboardRow ¶
type KeyboardRow []MessageKeyboardButton
type Message ¶
type Message struct {
// Only for messages from community. Contains user ID of community admin,
// who sent this message.
AdminAuthorID int `json:"admin_author_id"`
// FIXME: refactor handle attachments in vk-io style
Attachments []any `json:"attachments"`
// Unique auto-incremented number for all messages with this peer.
ConversationMessageID int `json:"conversation_message_id"`
// Date when the message has been sent in Unixtime.
Date int `json:"date"`
// Message author's ID.
FromID int `json:"from_id"`
// Forwarded messages.
FwdMessages []Message `json:"fwd_Messages"`
ReplyMessage *Message `json:"reply_message"`
PinnedAt int `json:"pinned_at,omitempty"`
ID int `json:"id"` // Message ID
Deleted types.ApiBool `json:"deleted"` // Is it an deleted message
Important types.ApiBool `json:"important"` // Is it an important message
IsHidden types.ApiBool `json:"is_hidden"`
IsCropped types.ApiBool `json:"is_cropped"`
IsSilent types.ApiBool `json:"is_silent"`
Out types.ApiBool `json:"out"` // Information whether the message is outcoming
WasListened types.ApiBool `json:"was_listened,omitempty"`
// FIXME: refactor handle keyboard and template in vk-io style
Keyboard MessageKeyboard `json:"keyboard"`
Template any `json:"template"`
Payload string `json:"payload"`
PeerID int `json:"peer_id"` // Peer ID
// ID used for sending messages. It returned only for outgoing messages.
RandomID int `json:"random_id"`
Ref string `json:"ref"`
RefSource string `json:"ref_source"`
Text string `json:"text"` // Message text
UpdateTime int `json:"update_time"` // Date when the message has been updated in Unixtime
MembersCount int `json:"members_count"` // Members number
ExpireTTL int `json:"expire_ttl"`
MessageTag string `json:"message_tag"` // for https://notify.mail.ru/
}
type MessageKeyboard ¶
type MessageKeyboard struct {
// Keyboard buttons
Buttons []KeyboardRow `json:"buttons"`
// Should the keyboard disappear after using it
OneTime types.ApiBool `json:"one_time,omitempty"`
// Should the keyboard be displayed inline the message
Inline types.ApiBool `json:"inline,omitempty"`
}
MessageKeyboard struct.
func NewKeyboard ¶
func NewKeyboard() *MessageKeyboard
func (*MessageKeyboard) AddButton ¶
func (k *MessageKeyboard) AddButton(btn MessageKeyboardButton) *MessageKeyboard
func (*MessageKeyboard) AddCallbackButton ¶
func (k *MessageKeyboard) AddCallbackButton(label string, color string, payload ...string) *MessageKeyboard
func (*MessageKeyboard) AddOpenLinkButton ¶
func (k *MessageKeyboard) AddOpenLinkButton(link, label string, payload string) *MessageKeyboard
AddOpenLinkButton add Open Link button in last row.
func (*MessageKeyboard) AddRow ¶
func (k *MessageKeyboard) AddRow() *MessageKeyboard
func (*MessageKeyboard) AddTextButton ¶
func (k *MessageKeyboard) AddTextButton(label string, color string, payload ...string) *MessageKeyboard
func (*MessageKeyboard) MakeInline ¶
func (k *MessageKeyboard) MakeInline() *MessageKeyboard
func (*MessageKeyboard) MakeOneTime ¶
func (k *MessageKeyboard) MakeOneTime() *MessageKeyboard
func (*MessageKeyboard) MarshalJSON ¶
func (k *MessageKeyboard) MarshalJSON() ([]byte, error)
func (*MessageKeyboard) UnmarshalJSON ¶
func (k *MessageKeyboard) UnmarshalJSON(data []byte) error
type MessageKeyboardButton ¶
type MessageKeyboardButton struct {
// A structure describing the type of button action and its parameters
Action MessageKeyboardButtonAction `json:"action"`
// Button color
Color string `json:"color,omitempty"`
}
MessageKeyboardButton struct.
type MessageKeyboardButtonAction ¶
type MessageKeyboardButtonAction struct {
// Type of button action
Type string `json:"type"`
// ID of the called application
// with the VK Mini Apps type (for the button with the "open_app" action)
AppID int `json:"app_id,omitempty"`
// ID of the community
// where the application is installed (for the button with the "open_app" action)
OwnerID int `json:"owner_id,omitempty"`
// Additional data along with the sent message (for the developer)
Payload string `json:"payload,omitempty"`
// Button text
Label string `json:"label,omitempty"`
// Contains VK Pay payment parameters (to see more, open https://dev.vk.com/ru/pay/getting-started)
// and the application ID
Hash string `json:"hash,omitempty"`
// The link that needs to be opened
// by clicking on the button
Link string `json:"link,omitempty"`
}
MessageKeyboardButtonAction struct.
type MessagesEvent ¶
type MessagesNew ¶
type MessagesNew struct {
Message Message `json:"message"`
ClientInfo ClientInfo `json:"client_info"`
}
Click to show internal directories.
Click to hide internal directories.