negezor / vk-io

Modern VK API SDK for Node.js
https://npm.im/vk-io
MIT License
548 stars 85 forks source link

Не работает LongPoll (почти все возвращается null) #219

Closed nikitakoschelenko closed 4 years ago

nikitakoschelenko commented 4 years ago

Я пытаюсь слушать события LongPoll.

vk.updates.on(['new_message'], async (context, next) => { if (Number(context.senderId) <= 0) return; console.log(context); next(); });

pollingGroupId я указываю.

В консоли: MessageContext { id: undefined, conversationMessageId: null, peerId: undefined, peerType: 'user', senderId: undefined, senderType: 'user', createdAt: undefined, text: null, forwards: MessageForwardsCollection [], attachments: [], isOutbox: false, type: 'message', subTypes: [ 'new_message' ], state: {} }

Если не указывать pollingGroupId и изменить событие на message, то работает, но другие события Bots LongPoll не работают.

Версия последняя у vk-io, node, npm.

nikitakoschelenko commented 4 years ago

Решилось выбором версии vkapi 5.101 вместо 5.103.

xTCry commented 4 years ago

Запуская функцией updates.start() можно не указывать id группы, т. к. он получается автоматически

И поставь версию обратно на 5.103