Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dimonchik0036/vk-api
VK SDK | VKontakte wrapper for standalone apps
https://github.com/dimonchik0036/vk-api
api bot go golang package sdk vk vk-api vk-bot vk-bot-api vk-sdk vkapi vkontakte vkontakte-api vkontakte-bot-api vkontakte-sdk vkontakteapi wrapper wrapper-api
Last synced: 3 months ago
JSON representation
VK SDK | VKontakte wrapper for standalone apps
- Host: GitHub
- URL: https://github.com/dimonchik0036/vk-api
- Owner: dimonchik0036
- License: mit
- Created: 2017-06-18T15:45:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T07:15:15.000Z (over 4 years ago)
- Last Synced: 2024-09-26T21:43:27.203Z (4 months ago)
- Topics: api, bot, go, golang, package, sdk, vk, vk-api, vk-bot, vk-bot-api, vk-sdk, vkapi, vkontakte, vkontakte-api, vkontakte-bot-api, vkontakte-sdk, vkontakteapi, wrapper, wrapper-api
- Language: Go
- Homepage:
- Size: 798 KB
- Stars: 31
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![](https://github.com/Dimonchik0036/vk-api/blob/master/logo.png)]()
# VK API? GO!
[![Build Status](https://travis-ci.org/Dimonchik0036/vk-api.svg?branch=master)](https://travis-ci.org/Dimonchik0036/vk-api)
[![GoDoc](https://godoc.org/github.com/Dimonchik0036/vk-api?status.svg)](https://godoc.org/github.com/Dimonchik0036/vk-api)
[![Language](https://img.shields.io/badge/language-Go-blue.svg)](https://github.com/golang/go)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Dimonchik0036/vk-api/blob/master/LICENSE)
Work with Vkontakte API for StandAlone application on The Go Programming Language.# Usage / Installation
## Installation
`go get -u github.com/Dimonchik0036/vk-api`## Example
Displays incoming messages. If this is a "/start", then a "Hello!" message will be sent.
```go
package mainimport (
"github.com/dimonchik0036/vk-api"
"log"
)func main() {
//client, err := vkapi.NewClientFromLogin("", "", vkapi.ScopeMessages)
client, err := vkapi.NewClientFromToken("")
if err != nil {
log.Panic(err)
}
client.Log(true)if err := client.InitLongPoll(0, 2); err != nil {
log.Panic(err)
}updates, _, err := client.GetLPUpdatesChan(100, vkapi.LPConfig{25, vkapi.LPModeAttachments})
if err != nil {
log.Panic(err)
}for update := range updates {
if update.Message == nil || !update.IsNewMessage() || update.Message.Outbox(){
continue
}log.Printf("%s", update.Message.String())
if update.Message.Text == "/start" {
client.SendMessage(vkapi.NewMessage(vkapi.NewDstFromUserID(update.Message.FromID), "Hello!"))
}}
}
```
## Technical Details
* API version 5.67.