MessageContext {
id: 0,
conversationMessageId: 0,
peerId: 0,
peerType: 'chat',
senderId: 0,
senderType: 'user',
createdAt: 0,
updatedAt: undefined,
pinnedAt: undefined,
text: undefined,
forwards: MessageForwardsCollection(1) [
MessageContext {
id: 0,
conversationMessageId: 0,
peerId: 0,
peerType: 'chat',
senderId: 0,
senderType: 'user',
createdAt: 0,
updatedAt: undefined,
pinnedAt: undefined,
text: undefined,
forwards: MessageForwardsCollection(1) [
MessageContext {
id: 0,
conversationMessageId: 0,
peerId: 0,
peerType: 'chat',
senderId: 0,
senderType: 'user',
createdAt: 0,
updatedAt: undefined,
pinnedAt: undefined,
text: undefined,
forwards: MessageForwardsCollection(0) [],
attachments: [
AudioMessageAttachment <audio_message0_0_0000> {
id: 0,
ownerId: 0,
accessKey: '000000',
duration: 0,
oggUrl: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.ogg',
mp3Url: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.mp3',
url: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.mp3',
locale: undefined,
transcript: undefined,
isTranscriptDone: false
}
],
isOutbox: false,
type: 'message',
subTypes: [
'message_new'
],
state: {}
}
],
attachments: [],
isOutbox: false,
type: 'message',
subTypes: [
'message_new'
],
state: {}
}
],
attachments: [],
isOutbox: true,
type: 'message',
subTypes: [
'message_new'
],
state: {}
}
мне нужно вывести только вот это:
attachments: [
AudioMessageAttachment <audio_message0_0_0000> {
id: 0,
ownerId: 0,
accessKey: '000000',
duration: 0,
oggUrl: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.ogg',
mp3Url: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.mp3',
url: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.mp3',
locale: undefined,
transcript: undefined,
isTranscriptDone: false
}
],
isOutbox: false,
type: 'message',
subTypes: [
'message_new'
],
state: {}
}
]
const attachment = message.attachments
const example = attachment.filter(x => x.text == message.text)[0] //без фильтра почему то не мог получить параметры..
const data = {
id: 0,
conversationMessageId: 0,
peerId: 0,
peerType: 'chat',
senderId: 0,
senderType: 'user',
createdAt: 0,
updatedAt: undefined,
pinnedAt: undefined,
text: undefined,
forwards: [
{
id: 0,
conversationMessageId: 0,
peerId: 0,
peerType: 'chat',
senderId: 0,
senderType: 'user',
createdAt: 0,
updatedAt: undefined,
pinnedAt: undefined,
text: undefined,
forwards: [
{
id: 0,
conversationMessageId: 0,
peerId: 0,
peerType: 'chat',
senderId: 0,
senderType: 'user',
createdAt: 0,
updatedAt: undefined,
pinnedAt: undefined,
text: undefined,
forwards: [],
attachments: [
{
id: 0,
ownerId: 0,
accessKey: '000000',
duration: 0,
oggUrl: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.ogg',
mp3Url: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.mp3',
url: 'https://psv4.userapi.com/c0//u0/audiomsg/d4/0.mp3',
locale: undefined,
transcript: undefined,
isTranscriptDone: false
}
],
isOutbox: false,
type: 'message',
subTypes: [
'message_new'
],
state: {}
}
],
attachments: [],
isOutbox: false,
type: 'message',
subTypes: [
'message_new'
],
state: {}
}
],
attachments: [],
isOutbox: true,
type: 'message',
subTypes: [
'message_new'
],
state: {}
};
console.log(data.forwards[0].forwards[0].attachments)