vksnake

2.1.0-update • Public • Published

NPM version

📦 Installation

Node.js 12.20.0 or newer is required

  • Using Yarn (recommended)

    yarn add vksnake
  • Using npm

    npm i vksnake
  • Using pnpm

    pnpm add vksnake
  • Usage to methods VK

import { Method, VK } from 'vksnake';

const vk = new VK({ 
token: process.env.TOKEN
})

async function method () {

const body = await new Method().use('users.get', {
user_id: 501
})

console.log(body)

}

method ()
import { Method, VK } from 'vksnake';

const vk = new VK({
token: process.env.TOKEN
})

async function method () {

const body = await new Method().use('wall.get', {
owner_id: 1
})

console.log(body)

}

method ()

Usage to method

import { Method, VK } from 'vksnake';

const vk = new VK({
token: process.env.TOKEN
})

async function method () {

const body = await new Method().getInfoUser(501, { user_id: 501 })

console.log(body)

}

method()

Send message in chat

import { Method, VK, getRandomId } from 'vksnake';

const vk = new VK({
token: ''
})

async function method () {

const body = await new Method().use('messages.send', {
random_id: getRandomId(),
peer_id: ...userId or chatId,
message: 'Привет'
})

console.log(body) // Object
}

// or

async function method () {

const body = await new Method().send('Привет', {
senderId: ...userId or chatId
})

console.log(body) // Object
}

Checking token

import { Method, VK } from 'vksnake';

const vk = new VK({
token: process.env.TOKEN
})

const body = new Method().secretSnake();

console.log(body) // Boolean

API Limite

const { VK, Method, API, APILimite } = require('vksnake');

const vk = new VK({
token: process.env.TOKEN
});

async function getInfo () {

const body = await new Method().use('users.get', { user_id: 501 });

console.log(body)

}

const body = new API({
apiType: 'slize',
limite: 2
});

const confrim = new APILimite(body);

async function get () {

const value = confrim.limite();

console.log(value)

}

get()

console.log(confrim)

Invalid params

import { paramsInvalide } from 'vksnake';

const body = paramsInvalide('@id500, @id700, @id1, @id900, https://vk.com/id970');

console.log(body) // ['500', '700', '1', '900', '970']

Getters

const { Update, VK } = require("vksnake");

const vk = new VK({ token: "" })

const body = new Update();

console.log(body.api.options.token()) // get result token

Support

Пожертвовать / Support

Ник QIWI: NODEJSLUPUS

Contacts

- VK

- GitHub

Readme

Keywords

Package Sidebar

Install

npm i vksnake

Weekly Downloads

0

Version

2.1.0-update

License

ISC

Unpacked Size

12.7 kB

Total Files

9

Last publish

Collaborators

  • ostrovsky-swedesdart