This package provides you bindings for the VK API
go get -u github.com/GDVFox/vkbot-go
import "github.com/GDVFox/vkbot-go"
Bot gets information about user id304508916
package main
import (
"log"
"net/http"
"net/url"
vkAPI "github.com/GDVFox/vkbot-go"
)
func main() {
bot, _ := vkAPI.NewVkBot("AccessToken", "5.92", &http.Client{})
resp, err := bot.Request("users.get", url.Values{
"user_ids": []string{"304508916"},
"fields": []string{"status"},
})
if err != nil {
log.Panic(err)
}
log.Println(string(resp.Response))
}
Bot gets events of group id1337
package main
import (
"log"
"net/http"
vkAPI "github.com/GDVFox/vkbot-go"
)
func main() {
bot, _ := vkAPI.NewVkBot("AccessToken", "5.92", &http.Client{})
bot.SetConfirmation(vkAPI.NewConfirmation("/", 1337, "ConfirmString"))
events := bot.ListenForEvents()
go http.ListenAndServe(":8080", nil)
log.Println("start listen :8080")
for event := range events {
log.Printf("[%s] %s from group: %d", event.Type, string(event.Object), event.GroupID)
}
}