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

В объекте MessageContext отображаются не все вложения #536

Closed
fakemancat opened this issue Mar 23, 2023 · 2 comments
Labels
package: vk-io Issues related to vk-io

Comments

@fakemancat
Copy link

What did you do?

При получении сообщения от пользователя я хочу получить все вложения, которые он отправил.

handler: async (context) => {
    console.log(context.attachments);
    console.log(context.getAllAttachments('photo'));
    return context.send('ok');
}

What did you expect to happen?

Ожидалось получения всех вложений, которые отправил пользователь

What was the actual result?

При отправке от 1 до 3 вложений всё хорошо, но при отправке свыше 4-х отображается только одно - первое

Additional Info

context.loadMessagePayload()

пробовал, результат такой же

заметил такую беду с фото-вложениями, другие не пробовал

Versions

package version
vk-io 4.8.1
node 16.17.0
TypeScript 4.8.3
npm or yarn 1.22.19
@fakemancat fakemancat added the package: vk-io Issues related to vk-io label Mar 23, 2023
@negezor
Copy link
Owner

negezor commented Mar 23, 2023

У сообщения есть context.isCropped, новая фича ВКонтакте, не отправлять больше 5 вложений. По этому свойству можно орентироваться, чтобы перезагрузить полное сообщение, нужно вызвать так:

if (context.isCropped) {
  await context.loadMessagePayload({ force: true });
}

@fakemancat
Copy link
Author

Помогло, спасибо

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: vk-io Issues related to vk-io
Projects
None yet
Development

No branches or pull requests

2 participants