Socket
Socket
Sign inDemoInstall

github.com/zhuharev/go-vk-api

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/zhuharev/go-vk-api


Version published

Readme

Source

go-vk-api

GoDoc Go Report Card

Golang wrapper for VK API

Install

Install the package with:

go get github.com/urShadow/go-vk-api

Import it with:

import "github.com/urShadow/go-vk-api"

and use vk as the package name inside the code.

Example

package main

import (
	"github.com/urShadow/go-vk-api"
	"log"
	"strconv"
)

func main() {
	api := vk.New("ru")
	// set http proxy
	//api.Proxy = "localhost:8080"

	err := api.Init("TOKEN")

	if err != nil {
		log.Fatalln(err)
	}

	api.OnNewMessage(func(msg *vk.LPMessage) {
		if msg.Flags&vk.FlagMessageOutBox == 0 {
			if msg.Text == "/hello" {
				api.Messages.Send(vk.RequestParams{
					"peer_id":          strconv.FormatInt(msg.FromID, 10),
					"message":          "Hello!",
					"forward_messages": strconv.FormatInt(msg.ID, 10),
				})
			}
		}
	})

	api.RunLongPoll()
}

FAQs

Last updated on 15 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc