Answer the question
In order to leave comments, you need to log in
How to return an event from vk api?
I am writing a bot for VKontakte on node js, there was a need to invite him to conversations. How to get an event that the community was invited to a conversation and messages from the same conversation? Thank you.
Answer the question
In order to leave comments, you need to log in
import { VK } from 'vk-io';
const MY_GROUP_ID = 123456;
const vk = new VK({
// ...
pollingGroupId: MY_GROUP_ID
});
vk.updates.on('chat_invite_user', async (context, next) => {
const { eventMemberId } = context;
if (eventMemberId === -MY_GROUP_ID) {
console.log('It\'s invited my group!');
// ...
return;
}
console.log('Other invited', eventMemberId);
});
vk.updates.startPolling().catch(console.error);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question