Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bots longpoll #109

Closed
Jengas opened this issue Aug 23, 2018 · 15 comments
Closed

bots longpoll #109

Jengas opened this issue Aug 23, 2018 · 15 comments

Comments

@Jengas
Copy link

Jengas commented Aug 23, 2018

Здравствуйте! Поддерживает ли ваша библиотека bots longpoll? https://vk.com/dev/bots_longpoll
Если да, то есть ли на неё документация? (Желательно с примером кода)

@negezor
Copy link
Owner

negezor commented Aug 23, 2018

Да поддерживает, примеры в examples, достаточно в опция просто установить pollingGroupId.

@Jengas
Copy link
Author

Jengas commented Aug 23, 2018

Использовал пример https://github.com/negezor/vk-io/blob/master/examples/simple-updates-bot.js


vk.setOptions({
	token: config.token,
	apiMode: 'parallel_selected',
  pollingGroupId: '-156603484',
	webhookPath: '/webhook/secret-path'
});

При указании pollingGroupId выдается ошибка APIError: Code №15 - Access denied: no access to call this method Пробовал указывать pollingGroupId с "-" и без. Не работает у меня

@negezor
Copy link
Owner

negezor commented Aug 23, 2018

ID должен быть положительным числом. Мне кажется у токена нету доступа к сообщениям.

@Jengas
Copy link
Author

Jengas commented Aug 23, 2018

Без указания id, бот спокойно работает

@negezor
Copy link
Owner

negezor commented Aug 23, 2018

Какие у токена права?

@Jengas
Copy link
Author

Jengas commented Aug 23, 2018

image

@negezor
Copy link
Owner

negezor commented Aug 23, 2018

Кажется я понял в чём причина, в настройках сообщества отключен Long Poll API

@Jengas
Copy link
Author

Jengas commented Aug 23, 2018

image

@negezor
Copy link
Owner

negezor commented Aug 23, 2018

Сейчас попробую запустить пример и глянуть что не так.

@negezor
Copy link
Owner

negezor commented Aug 23, 2018

Токен
image
image
В настройках включено так
image
image
И в итоге всё запускается и отвечает
image

@Jengas
Copy link
Author

Jengas commented Aug 23, 2018

image
image
image
image

@negezor
Copy link
Owner

negezor commented Aug 23, 2018

Похоже требуется право управление сообществом
image

@Jengas
Copy link
Author

Jengas commented Aug 23, 2018

Хм, и в правду. Сработало. Спасибо! Кстати, я пытаюсь сейчас понять как используя VK-IO добавить Клавиатуру для ботов https://vk.com/dev/bots_docs_3. Я буду рад если будет решение от этого API

@negezor
Copy link
Owner

negezor commented Aug 23, 2018

Уже давно есть, а так же пример :)

@Jengas
Copy link
Author

Jengas commented Aug 23, 2018

Отлично! Спасибо большое за помощь!

@Jengas Jengas closed this as completed Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants