简体   繁体   中英

how to use execute in node-vk-bot-api? why do I get promise { <pending> }?

How to get information using the users method.get using node-vk-bot-api? I don't understand how to work with execute. Why am I getting Promise { Pending }?

const token = "";
const VkBot = require("node-vk-bot-api"),
bot = new VkBot(token);

let id = msg.message.from_id
const response = bot.execute('users.get', {user_ids: id});
console.log(response) --> Promise { <pending> }

or


let id = msg.message.from_id
const api = require('node-vk-bot-api/lib/api');
let user = api('users.get', { user_ids: id, access_token: token });
console.log(user) --> Promise { <pending> }

bot.command('Дуров', async (test) => {
user = await bot.execute('users.get', {user_id: 1})
    console.log(test)
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM