Answer the question
In order to leave comments, you need to log in
How to display nickname in node js (VK bot)?
I am writing a bot in VK using the node-vk-bot-api library. I'm making a checker.
I need to somehow put the message at the end (so far it’s not clear, I don’t know how to explain)
const VkBot = require('node-vk-bot-api');
const Session = require('C:/Users/igago/Desktop/newBotVk/node_modules/node-vk-bot-api/lib/session');
const Stage = require('C:/Users/igago/Desktop/newBotVk/node_modules/node-vk-bot-api/lib/stage');
const Scene = require('C:/Users/igago/Desktop/newBotVk/node_modules/node-vk-bot-api/lib/scene');
const bot = new VkBot('');
const session = new Session();
const scene = new Scene('check',
(ctx) => {
ctx.scene.next();
ctx.reply('Введите ник');
},
(ctx) => {
ctx.session.name = ctx.message.text
ctx.scene.next();
ctx.reply('Подождите...');
},
(ctx) => {
ctx.scene.leave();
ctx.reply(`Проверка завершена.\nНик: ${ctx.session.name}`);
});
const stage = new Stage(scene);
bot.use(session.middleware());
bot.use(stage.middleware());
bot.command('/check', (ctx) => {
ctx.scene.enter('check');
});
bot.startPolling();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question