M
M
Maxim Recipient2019-05-23 15:15:39
Node.js
Maxim Recipient, 2019-05-23 15:15:39

VK.api Node.js - How to check if a person is signed or not?

Please tell me how to check whether a person is signed or not through the groups.isMember method.
The user writes to the bot in VK, after which the bot answers whether it is signed or not.
Tried to do it myself, in the end, just wasted time.
My attempts:
cmd.hear(/^(?:check)$/i, async (message, bot) => {
if(vk.api.groups.isMember({ group_id: 178791490, user_id: message.senderId })) return bot(`you are subscribed.`);
});
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SagePtr, 2019-05-23
@ms_toster

Did not work with VK API, but I doubt that there are synchronous functions. Most likely, they either forgot to shove await, or pass a callback (depending on whether your library for working with api is on promises or not)

F
FastClick, 2019-05-24
@FastClick

I don’t understand why take the merged scripts of the bots Lesya, Gorila. You can write it yourself, the vk-io documentation is in the public domain.

cmd.hear(/^(?:проверка)$/i, async (message, bot) => {
vk.api.groups.isMember({ 
group_id: 178791490, 
user_id: message.senderId }).then((response) => {
if(response == 0) return bot(`Вы не подписаны`);
if(response== 1) return bot(`Вы подписаны`);
});
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question