P
P
Pigeon12352019-08-28 22:27:14
API
Pigeon1235, 2019-08-28 22:27:14

How to send a document, photo, etc. in a text message?

VK bot on the VK-IO library
I can’t send an attachment in a message, I did this:

const msgText = msg.text.split(' ').slice(2).join(' ');
const attachment = msg.attachmets.map((attachment) => {
            return `${attachment.type}${attachment.ownerId || attachment.authorId}_${attachment.id}`
        }).join(',');
        vk.api.messages.send({
            user_id: ID,
            message: ` │ ${msgText}`,
            attachment

Error: ".map undefined"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stockholm Syndrome, 2019-08-28
@StockholmSyndrome

attachmets property does not exist

M
meqy1qub, 2019-08-31
@meqy1qub

{attachment: ['photo']}
I implemented it like this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question