Answer the question
In order to leave comments, you need to log in
How to make a dialogue in a chat bot for VK?
Greetings. I am writing a chat bot for VKontakte using Node.JS, using the VK-IO library.
There is an array table. It contains data on lessons at the Moscow Electronic School (MES).
Teachers add their lessons to the array via the "add" command. The command syntax is:
add [Lesson ID] [Lesson Name] [Subject] [Codeword].
The command code is:
cmd.hear(/^(?:добавить)\s?([0-9]+)?\s([^]+)?\s([^]+)?\s([^]+)?/i, async (message, args, bot) => {
if(message.user.adm < 3) return;
tabl.push(
{
id: `${message.args[1]}`,
name: `${message.args[2]}`,
predmet: `${message.args[3]}`,
kod1: `${message.args[4]}`,
uid: tablcount
});
tablcount = tablcount + 1
saveConfig();
await message.send(`Вы успешно добавили урок в Библиотеку уроков бота.\n Посмотреть его можно по команде: "мэш [кодовое слово]".`);
});
[
{
"id": "691326",
"name": "Файловая_система",
"predmet": "Информатика",
"kod1": "Файл",
"uid": 0
}
]
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