Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const vk = new(require('vk-io'));
- var groupId;
- var pollsId;
- var wallId;
- return vk.api.groups.create({
- title: 'Test',
- type: 'group'
- })
- .then((group) => {
- groupId = group.id;
- console.log('Создана группа ID:', groupId);
- vk.api.groups.edit({
- group_id: groupId,
- access: 2
- })
- return vk.api.polls.create({
- question: 'Владлен няшка? :>',
- owner_id: '-' + groupId,
- add_answers: JSON.stringify(['Да', 'Он молодец!'])
- })
- .then((polls) => {
- pollsId = polls.id;
- console.log('Создан опрос ID:', pollsId);
- return vk.api.wall.post({
- message: 'Просто тест ^_^',
- owner_id: '-' + groupId,
- from_group: 1,
- attachments: 'poll' + groupId + '_' + pollsId,
- signed: 1
- })
- .then((wall) => {
- wallId = wall.post_id;
- console.log('Получили пост:', wallId);
- vk.api.messages.send({
- user_id: '195624402',
- attachments: 'wall' + groupId + '_' + wallId
- })
- })
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement