API

package
v0.0.7-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COMMUNITY_RPS_LIMIT = 20
	USER_RPS_LIMIT      = 3
)

Variables

This section is empty.

Functions

func BooleanToInteger

func BooleanToInteger(property bool) int

func Random

func Random() int

Types

type BanUser

type BanUser struct {
	GroupID int
	UserID  int
	Time    int
	Reason  int
	Comment CommentBanUser
}

type Banned

type Banned struct {
	Offset int
	Count  int
}

type BannedUsers

type BannedUsers struct {
	GroupID int
	UserID  int
	Offset  int
	Count   int
	Fields  []string
}

type Bot

type Bot struct {
	ID          int     `json:"id"`
	Token       string  `json:"token"`
	Version     float32 `json:"version"`
	IsGroup     bool    `json:"is_group"`
	Deprecated  Deprecated
	MessagePack bool

	*bots.Config
	// contains filtered or unexported fields
}

Bot ✨ is an object that defines the properties of a bot 🏙️ The ID is the unique identifier of the bot. It contains either a community ID or a user page ID 🏡 A token is a key to access your application (bot) ☕ Version - VK API version, it is strongly recommended to set 5.154000 📺 IsGroup is set automatically, guided by the information about the created bot 🧢 Logger is a pointer to the Logger object of the logrus library. Used during development to detect problems during operation 👆 MessagePack a simpler format of response data — https://en.wikipedia.org/wiki/MessagePack 💕 limit - limiting the number of requests per second depending on the type of bot 🌿 errorHandler performs the task of transmitting an error for further processing

func Create

func Create(properties ...any) *Bot

Create 📺 your own bot or add an existing one 🏙️ Accepts arguments: 🎮 String - token 💬 Float32 - version 🌀 Int - community or user page ID 💗 Pointer or no pointer Bot{} structure 🍭 Pointer or no pointer logrus.Logger{} structure 🍻 Returns a pointer to the Bot structure

func (*Bot) AnswerEvent

func (bot *Bot) AnswerEvent(properties ...any) types.SendEventMessage

func (*Bot) Ban

func (bot *Bot) Ban(property any) (banned types.Ban)

func (*Bot) BanUser

func (bot *Bot) BanUser(properties ...any) (banned types.Ban)

func (*Bot) Banned

func (bot *Bot) Banned(properties ...any) types.Banned

func (*Bot) BannedUsers

func (bot *Bot) BannedUsers(properties ...any) types.BannedUsers

func (*Bot) CallString

func (bot *Bot) CallString(method string, query url.Values, data any) error

CallString 🔥🌅 sends a request to the VKontakte server 🌌❄ The first argument is the name of the method, 🌺🌼🌹 the second is the URL string, 🦋🌹🎲 then usually a pointer to the structure where the response will be written 🌍🌊🐠 May return an error

func (*Bot) Chat

func (bot *Bot) Chat(properties ...any) types.Chat
func (bot *Bot) ChatLink(properties ...any) types.ChatLink

func (*Bot) ChatMembers

func (bot *Bot) ChatMembers(properties ...any) types.ChatMembers

func (*Bot) Chats

func (bot *Bot) Chats(properties ...any) types.Chats

Chats gets a list of conversationsByID Possible method arguments: GetChat, developer-created methods whose names correspond to the fields of the GetChat structure, int, []int, []string or bool The integer argument specifies either a chatID, if one is missing, or a groupID An array of integer values specifies a list of all requested chats An array of strings specifies a list of additional user and community fields The Boolean type defines the extended answer, which will contain the Users and Groups field Returns the ResponseChats structure with the fields Count, Error, Chats, Users, Groups

func (*Bot) Counters

func (bot *Bot) Counters(properties ...any) types.Counters

func (*Bot) CreateChat

func (bot *Bot) CreateChat(properties ...any) types.CreateChat

func (*Bot) DeleteMessage

func (bot *Bot) DeleteMessage(properties ...any) types.DeleteMessage

func (*Bot) DeleteMessages

func (bot *Bot) DeleteMessages(properties ...any) (destroyed types.DeleteMessages)

func (*Bot) DisableOnline

func (bot *Bot) DisableOnline(properties ...any) (offline types.OnlineStatus)

func (*Bot) EditMessage

func (bot *Bot) EditMessage(properties ...any) (edited types.EditMessage)

func (*Bot) EnableOnline

func (bot *Bot) EnableOnline(properties ...any) (online types.OnlineStatus)

func (*Bot) Execute

func (bot *Bot) Execute(properties ...any) (executed types.Execute)

func (*Bot) Gifts

func (bot *Bot) Gifts(properties ...any) types.Gifts

func (*Bot) Group

func (bot *Bot) Group(properties ...any) types.Group

func (*Bot) GroupLongPoll

func (bot *Bot) GroupLongPoll(properties ...any) types.LongPoll

func (*Bot) Groups

func (bot *Bot) Groups(properties ...any) types.Groups

func (*Bot) Health

func (bot *Bot) Health() types.Health

func (*Bot) HistoryMessages

func (bot *Bot) HistoryMessages(properties ...any) types.HistoryMessages

func (*Bot) Info

func (bot *Bot) Info(properties ...any) types.Info

func (*Bot) Message

func (bot *Bot) Message(properties ...any) update.Message

func (*Bot) Messages

func (bot *Bot) Messages(properties ...any) types.Messages

func (*Bot) Offers

func (bot *Bot) Offers(properties ...any) types.Offers

func (*Bot) PinMessage

func (bot *Bot) PinMessage(properties ...any) types.PinMessage

func (*Bot) ResolveDomain

func (bot *Bot) ResolveDomain(properties ...any) types.ResolveDomain

func (*Bot) SaveUploadMessagesDocument

func (bot *Bot) SaveUploadMessagesDocument(file string) types.SaveUploadMessagesDocument

func (*Bot) SaveUploadMessagesPhoto

func (bot *Bot) SaveUploadMessagesPhoto(server int, photo, hash string) types.SaveUploadMessagesPhotos

func (*Bot) SendAnswerEvent

func (bot *Bot) SendAnswerEvent(properties ...any) (sent types.SendEventMessage)

func (*Bot) SendMessage

func (bot *Bot) SendMessage(properties ...any) types.SendMessage

func (*Bot) SendMessages

func (bot *Bot) SendMessages(properties ...any) (sent types.SendMessages)

func (*Bot) SendSticker

func (bot *Bot) SendSticker(chatID, stickerID int, properties ...any) types.SendMessage

func (*Bot) SendStickers

func (bot *Bot) SendStickers(chatID, stickerID int, properties ...any) types.SendMessages

func (*Bot) SetGroupLongPoll

func (bot *Bot) SetGroupLongPoll(properties ...any) (server types.SetLongPoll)

func (*Bot) SetOffline

func (bot *Bot) SetOffline() (offline types.OnlineStatus)

func (*Bot) SetOnline

func (bot *Bot) SetOnline(properties ...any) (online types.OnlineStatus)

func (*Bot) SetStatus

func (bot *Bot) SetStatus(properties ...any) (status types.SetStatus)

func (*Bot) SetStorage

func (bot *Bot) SetStorage(properties ...any) types.SetStorage

func (*Bot) Spam

func (bot *Bot) Spam(properties ...any) types.DeleteMessage

func (*Bot) Spams

func (bot *Bot) Spams(properties ...any) types.DeleteMessages

func (*Bot) Status

func (bot *Bot) Status(properties ...any) types.Status

func (*Bot) Storage

func (bot *Bot) Storage(properties ...any) types.Storage

func (*Bot) StorageKeys

func (bot *Bot) StorageKeys(properties ...any) types.StorageKeys

func (*Bot) Unban

func (bot *Bot) Unban(property any) (unbanned types.Ban)

func (*Bot) UnbanUser

func (bot *Bot) UnbanUser(properties ...any) (unbanned types.Ban)

func (*Bot) UpdateWidgets

func (bot *Bot) UpdateWidgets(properties ...any) types.UpdateWidgets

func (*Bot) UploadFile

func (bot *Bot) UploadFile(uploadURL, fileURL, field, name string) (UploadFile, error)

func (*Bot) UploadMessagesDocument

func (bot *Bot) UploadMessagesDocument(chatID int, fileURL, extension string, properties ...any) types.SaveUploadMessagesDocument

func (*Bot) UploadMessagesDocumentServer

func (bot *Bot) UploadMessagesDocumentServer(properties ...any) types.UploadMessagesDocumentServer

func (*Bot) UploadMessagesPhoto

func (bot *Bot) UploadMessagesPhoto(chatID int, fileURL string) types.SaveUploadMessagesPhotos

func (*Bot) UploadMessagesPhotoServer

func (bot *Bot) UploadMessagesPhotoServer(property any) types.UploadMessagesPhoto

func (*Bot) User

func (bot *Bot) User(properties ...any) types.User

func (*Bot) UserLongPoll

func (bot *Bot) UserLongPoll(properties ...any) types.LongPoll

func (*Bot) Users

func (bot *Bot) Users(properties ...any) types.Users

type Chat

type Chat struct {
	GroupID  int
	ChatID   int
	ChatsID  []int
	Extended bool
	Fields   []string
}
type ChatLink struct {
	GroupID int
	ChatID  int
	Reset   bool
}

type ChatMembers

type ChatMembers struct {
	GroupID  int
	ChatID   int
	Offset   int
	Count    int
	Extended bool
	Fields   []string
}

type CommentBanUser

type CommentBanUser struct {
	Text string
	Show bool
}

type CreateChat

type CreateChat struct {
	GroupID int
	UserID  int
	UsersID []int
	Name    string
	Title   string
}

type DeleteMessage

type DeleteMessage struct {
	GroupID        int
	ChatID         int
	MessageID      int
	MessagesID     []int
	ChatMessageID  int
	ChatMessagesID []int
	Spam           bool
	Everyone       bool
}

type Deprecated

type Deprecated struct {
	Bot *Bot
}

func (Deprecated) Dialogs

func (deprecated Deprecated) Dialogs(properties ...any) (dialogs types.Dialogs)

func (Deprecated) Messages

func (deprecated Deprecated) Messages(properties ...any) types.Dialogs

type Dialogs

type Dialogs struct {
	Offset         int
	Count          int
	StartMessageID int
	PreviewLength  int
	Unread         bool
	Important      bool
	Unanswered     bool
	UserID         string
}

type EditMessage

type EditMessage struct {
	GroupID             int
	ChatID              int
	Text                string
	MessageID           int
	ChatMessageID       int
	Attachment          string
	Attachments         []string
	Template            string
	Keyboard            string
	KeepForwardMessages bool
	KeepSnippets        bool
	DontParseLinks      bool
	DisableMentions     bool
	Latitude            string
	Longitude           string
}

type EnableOnline

type EnableOnline struct {
	GroupID int
}

type EventAction

type EventAction struct {
	Type string `json:"type,omitempty"`

	Text string `json:"text,omitempty"` //  show_snackbar
	Link string `json:"link,omitempty"` // open_link

	// open_app
	AppID         int    `json:"app_id,omitempty"`
	ApplicationID int    `json:"-"`
	OwnerID       int    `json:"owner_id,omitempty"`
	Hash          string `json:"hash,omitempty"`
}

func (EventAction) JSON

func (action EventAction) JSON() string

type Execute

type Execute struct {
	Code    any
	Version float32
}

type Forward

type Forward struct {
	ChatID        int  `json:"peer_id"`
	ChatMessageID int  `json:"conversation_message_ids"`
	IsReply       bool `json:"is_reply"`
}

func GetForward

func GetForward(chatID, ID int, isReply bool) Forward

type Gifts

type Gifts struct {
	UserID int
	Count  int
	Offset int
}

type Group

type Group Groups

type GroupLongPoll

type GroupLongPoll struct {
	GroupID int
}

type Groups

type Groups struct {
	GroupID  int
	GroupsID []int
	Fields   []string
}

type HistoryMessages

type HistoryMessages struct {
	GroupID        int
	ChatID         int
	UserID         int
	StartMessageID int
	Offset         int
	Count          int
	Rev            bool
	Extended       bool
	Fields         []string
}

type Info

type Info struct {
	Fields []string
}

type Message

type Message Messages

type Messages

type Messages struct {
	GroupID        int
	ChatID         int
	MessageID      int
	MessagesID     []int
	ChatMessageID  int
	ChatMessagesID []int
	Fields         []string
	Extended       bool
	Characters     int
}

type Offers

type Offers struct {
	Count  int
	Offset int
}

type PinMessage

type PinMessage struct {
	ChatID        int
	MessageID     int
	ChatMessageID int
}

type ResolveDomain

type ResolveDomain struct {
	Domain string
}

type SendEventMessage

type SendEventMessage struct {
	EventID string
	ChatID  int
	UserID  int
	Action  string
}

type SendMessage

type SendMessage struct {
	GroupID         int
	RandomID        int
	Domain          string
	ChatID          int
	ChatsID         []int
	UserID          int
	UsersID         []int
	Text            string
	Attachment      string
	Attachments     []string
	StickerID       int
	Payload         string
	Forward         Forward
	Template        string
	Keyboard        string
	DontParseLinks  bool
	DisableMentions bool
	Latitude        string
	Longitude       string
	Intent          string
	SubscribeID     int
	ExpireTime      int
}

type SetGroupLongPoll

type SetGroupLongPoll struct {
	GroupID int
	Enabled bool
	Version float32

	Message        bool
	ReplyMessage   bool
	EditMessage    bool
	EnableMessage  bool
	DisableMessage bool
	Typing         bool
	Callback       bool

	Photo               bool
	PhotoComment        bool
	EditPhotoComment    bool
	DeletePhotoComment  bool
	RestorePhotoComment bool

	Audio bool

	Video               bool
	VideoComment        bool
	EditVideoComment    bool
	DeleteVideoComment  bool
	RestoreVideoComment bool

	Post             bool
	Repost           bool
	ReplyPost        bool
	EditReplyPost    bool
	DeleteReplyPost  bool
	RestoreReplyPost bool

	BlockUser   bool
	UnblockUser bool

	Like   bool
	Unlike bool

	BoardPost        bool
	EditBoardPost    bool
	DeleteBoardPost  bool
	RestoreBoardPost bool

	MarketComment        bool
	EditMarketComment    bool
	DeleteMarketComment  bool
	RestoreMarketComment bool

	JoinGroup  bool
	LeaveGroup bool

	Vote bool

	EditOwners          bool
	ChangeGroupSettings bool
	ChangeGroupPhoto    bool

	Donate             bool
	ProlongedDonate    bool
	ExpiredDonate      bool
	CancelDonate       bool
	ChangeDonatePrice  bool
	WithdrawMoney      bool
	WithdrawMoneyError bool
}

type SetOnline

type SetOnline struct {
	Calls bool
}

type SetStatus

type SetStatus struct {
	GroupID int
	Text    string
}

type SetStorage

type SetStorage struct{}

type Status

type Status struct {
	GroupID int
	UserID  int
}

type Storage

type Storage struct{}

type UnbanUser

type UnbanUser struct {
	GroupID int
	UserID  int
}

type UploadFile

type UploadFile []byte

func (UploadFile) JSON

func (file UploadFile) JSON(data any)

type UploadMessagesDocumentServer

type UploadMessagesDocumentServer struct {
	ChatID int
	Type   string
}

type UploadMessagesPhotoServer

type UploadMessagesPhotoServer struct {
	ChatID int
}

type User

type User Users

type UserLongPoll

type UserLongPoll struct {
	GroupID int
	Version int
	NeedPTS bool
}

type Users

type Users struct {
	UserID   int
	UsersID  []int
	NameCase string
	Fields   []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL