M
M
meqy1qub2019-08-31 15:26:38
JavaScript
meqy1qub, 2019-08-31 15:26:38

How to make the bot, when receiving a group wall, throw a random picture from it?

vk.updates.hear(/^\лоли\s*$/i, async (context) => {
    // Получаем стену рандомного паблика
    let { items } = vk.api.call('wall.get', 
  {
        domain: getRandomElement(["lolyashii"]),
        offset: 1,
        count: 100
    });
    let item = getRandomElement(items);
    item = item.attachments[0].photo;
    await context.send({
        attachment: "photo" + item.owner_id + "_" + item.id
    });
});

help fix

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladislav Qwerty, 2019-08-31
@soba4kaka

Search in the element code of JPG files; PNG; SVG.

L
lightmanLP, 2019-09-02
@lightmanLP

Are you trying to send a photo without access_key?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question