matterbridge/vendor/github.com/SevereCloud/vksdk/v2
dependabot[bot] 5a1fd7dadd
Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698)
Bumps [github.com/SevereCloud/vksdk/v2](https://github.com/SevereCloud/vksdk) from 2.11.0 to 2.13.0.
- [Release notes](https://github.com/SevereCloud/vksdk/releases)
- [Commits](https://github.com/SevereCloud/vksdk/compare/v2.11.0...v2.13.0)

---
updated-dependencies:
- dependency-name: github.com/SevereCloud/vksdk/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-28 23:48:40 +01:00
..
api Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698) 2022-01-28 23:48:40 +01:00
events Update vendor (#1461) 2021-05-05 22:03:28 +02:00
internal Update dependencies (#1521) 2021-06-16 21:00:49 +02:00
longpoll-bot Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698) 2022-01-28 23:48:40 +01:00
object Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698) 2022-01-28 23:48:40 +01:00
.gitignore Add vk bridge (#1372) 2021-01-29 00:25:14 +01:00
.golangci.yml Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698) 2022-01-28 23:48:40 +01:00
.markdownlint.yml Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698) 2022-01-28 23:48:40 +01:00
CONTRIBUTING.md Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698) 2022-01-28 23:48:40 +01:00
doc.go Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698) 2022-01-28 23:48:40 +01:00
LICENSE Add vk bridge (#1372) 2021-01-29 00:25:14 +01:00
README.md Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698) 2022-01-28 23:48:40 +01:00

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.131.

  • 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/v2@latest

Use by

Example

package main

import (
    "context"
    "log"

    "github.com/SevereCloud/vksdk/v2/api"
    "github.com/SevereCloud/vksdk/v2/api/params"
    "github.com/SevereCloud/vksdk/v2/events"
    "github.com/SevereCloud/vksdk/v2/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