samdark / yiiframework-ru

yiiframework.ru
http://yiiframework.ru/
Other
52 stars 21 forks source link

Нужно перейти на библиотеку VK IO #141

Closed MA1EV1CH closed 5 years ago

MA1EV1CH commented 5 years ago

Мне нужно код из библиотеки VK BOTS переводить на VK IO Там всего 26 строк

Язык Node JS

Сам код: const {Bot, Receiver} = require('vk-bots');

let bot = new Bot({token: 'Токен группы'}), data = {}; const numb = new Receiver('number'), voice = new Receiver('voice'); bot.start(); console.log('бот запущен!'); // аудио: voice.onInit(async (msg) => msg.reply('выберите аудиофайл:')); voice.command("[0-9]+", async (msg, history) => { // вызов: data[toString(msg.peer_id)]['audio'] = msg.text; console.log(data[toString(msg.peer_id)]); msg.reply('Вызов принят!'); history.clear() }); // номер телефона: numb.onInit(async (msg) => msg.reply('введите номер телефона:')); numb.command("^7[0-9]{9}", async (msg, history) => { // верный ввод: data[toString(msg.peer_id)] = { 'phone': msg.text, 'audio': 0 }; history.go('voice'); }); numb.command('.*', async (msg) => msg.reply('Данные введены не верно!\nПовторите еще раз!')); bot.addReceivers([numb, voice]); bot.command('позвонить', async (msg, history) => history.go('number'));