
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
node-vk-bot-sdk
Advanced tools
Небольшое SDK для создания чат-ботов с использованием Node.JS на платформе сообществ ВКонтакте.
Рекомендуется использовать с версиями VK API выше 5.103.
$ npm install node-vk-bot-sdk
или
$ yarn add node-vk-bot-sdk
const express = require('express');
const { VkBotSdk } = require('node-vk-bot-sdk');
const app = express();
const sdk = new VkBotSdk({
group_id: 0,
secret: '',
confirmation: '',
access_token: ''
});
const bot = sdk.getCallback();
bot.command(/test/, (ctx, params) => {
ctx.reply(`reply to ${ctx.from_id}`);
});
bot.defaultReply((ctx, params) => {
ctx.reply('Default reply');
});
app.use(express.json());
app.all('/callback', bot.eventsCallback);
app.listen(8080);
Значение | Тип | Описание |
---|---|---|
ctx.event | string | Тип полученного события |
ctx.data | object | Полученные данные в событии |
ctx.group_id | number | ID сообщества |
ctx.event_id | number | ID события |
ctx.user_id | number | Псевдоним для ctx.from_id |
ctx.from_id | number | ID автора сообщения (ID затрагиваемого пользователя для других событий) |
ctx.peer_id | number | ID дилога (ID затрагиваемого пользователя события для других событий) |
ctx.message | string | Преобразованный текст сообщения (пустая строка для других событий) |
ctx.orig_message | string | Оригинальный текст сообщения |
ctx.client_info | object | Данные о клиенте пользователя или стандартный объект |
ctx.reply(text, attachment, keyboard) | function | Отправляет ответ с текстом, вложениями и клавиатурой |
ctx.replyKeyboard(text, keyboard) | function | Отправляет ответ с текстом и клавиатурой |
ctx.replyAttachment(attachment) | function | Отправляет ответ только с вложениями |
ctx.replyCustom(params) | function | Отправляет ответ с кастомными параметрами |
ctx.isKeyboardSupported() | function | Возвращает информацию из client_info |
ctx.isInlineKeyboardSupported() | function | Возвращает информацию из client_info |
ctx.isCarouselSupported() | function | Возвращает информацию из client_info |
FAQs
A simple bot SDK for vk.com
The npm package node-vk-bot-sdk receives a total of 59 weekly downloads. As such, node-vk-bot-sdk popularity was classified as not popular.
We found that node-vk-bot-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.