GitXplorerGitXplorer
S

vksdk

public
196 stars
36 forks
26 issues

Commits

List of commits on branch master.
Verified
dbf7c2ac25909cdd82d1680ebea98dfb3c2a736f

Log callback failed to write response error (#304)

ggaiaz-iusipov committed a month ago
Verified
9dae20ba538ab8cb2362a6f698700fc4ecbfd7ed

chore(deps): bump github.com/klauspost/compress from 1.17.9 to 1.17.10 (#299)

ddependabot[bot] committed 4 months ago
Unverified
30c8ba15d9199231b788ae0d9b8c8d7ef26b6844

BREAKING CHANGE: v2 -> v3

SSevereCloud committed 6 months ago
Unverified
4bd40440184157377f96ded63cfc3c5ec7e69bec

feat: update go.mod

SSevereCloud committed 6 months ago
Verified
ff812f6e40dbb367ed75acd7bfa629b4e591f8b2

fix: Set default empty filter for Groups.GetMembers (#285)

BBercof committed 9 months ago
Verified
2f24be6f94ca50b7372403dc6f73605d2c690ce1

chore(deps): bump github.com/gorilla/schema from 1.2.1 to 1.3.0 (#280)

ddependabot[bot] committed 10 months ago

README

The README file for this repository.

VK SDK for Golang

PkgGoDev VK Developers codecov VK chat release license

VK SDK for Golang ready implementation of the main VK API functions for Go.

Russian documentation

Features

Version API 5.199.

  • API
    • 500+ methods
    • Ability to modify HTTP client
    • Request Limiter
    • Support zstd and MessagePack
    • Token pool
    • OAuth
  • Callback API
    • Tracking tool for users activity in your VK communities
    • Supports all events
    • Auto setting callback
  • Bots Long Poll API
    • Allows you to work with community events in real time
    • Supports all events
    • Ability to modify HTTP client
  • User Long Poll API
    • Allows you to work with user events in real time
    • Ability to modify HTTP client
  • Streaming API
    • Receiving public data from VK by specified keywords
    • Ability to modify HTTP client
  • FOAF
    • Machine-readable ontology describing persons
    • Works with users and groups
    • The only place to get page creation date
  • Games
    • Checking launch parameters
    • Intermediate http handler
  • VK Mini Apps
    • Checking launch parameters
    • Intermediate http handler
  • Payments API
    • Processes payment notifications
  • Marusia Skills
    • For creating Marusia Skills
    • Support SSML

Install

# go mod init mymodulename
go get github.com/SevereCloud/vksdk/v3@latest

Use by

Example

package main

import (
	"context"
	"log"

	"github.com/SevereCloud/vksdk/v3/api"
	"github.com/SevereCloud/vksdk/v3/api/params"
	"github.com/SevereCloud/vksdk/v3/events"
	"github.com/SevereCloud/vksdk/v3/longpoll-bot"
)

func main() {
	token := "<TOKEN>" // use os.Getenv("TOKEN")
	vk := api.NewVK(token)

	// get information about the group
	group, err := vk.GroupsGetByID(nil)
	if err != nil {
		log.Fatal(err)
	}

	// Initializing Long Poll
	lp, err := longpoll.NewLongPoll(vk, group[0].ID)
	if err != nil {
		log.Fatal(err)
	}

	// New message event
	lp.MessageNew(func(_ context.Context, obj events.MessageNewObject) {
		log.Printf("%d: %s", obj.Message.PeerID, obj.Message.Text)

		if obj.Message.Text == "ping" {
			b := params.NewMessagesSendBuilder()
			b.Message("pong")
			b.RandomID(0)
			b.PeerID(obj.Message.PeerID)

			_, err := vk.MessagesSend(b.Params)
			if err != nil {
				log.Fatal(err)
			}
		}
	})

	// Run Bots Long Poll
	log.Println("Start Long Poll")
	if err := lp.Run(); err != nil {
		log.Fatal(err)
	}
}

LICENSE

FOSSA Status