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

Я не понимаю как работает SendPhotos #569

Closed
MrCatplay opened this issue Jun 16, 2024 · 3 comments
Closed

Я не понимаю как работает SendPhotos #569

MrCatplay opened this issue Jun 16, 2024 · 3 comments
Labels
package: vk-io Issues related to vk-io

Comments

@MrCatplay
Copy link

MrCatplay commented Jun 16, 2024

У меня есть бот на vk-io который должен по команде test отправлять фото но когда я пишу test он выдаёт ошибку

void this.handleError(request, new APIError(response.error));
                                          ^

APIError: Code №100 - One of the parameters specified was missing or invalid: message is empty or invalid
   at SequentialWorker.execute (/home/mrkot/Рабочий стол/AutoBOT/node_modules/vk-io/lib/index.js:1803:44)
   at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
 code: 100,
 params: [
   { key: 'method', value: 'messages.send' },
   { key: 'oauth', value: '1' },
   { key: 'v', value: '5.199' },
   { key: 'random_id', value: '2486783344720413' },
   { key: 'peer_ids', value: '509042780' }
 ],
 [cause]: undefined
}

Node.js v20.14.0

вод код

bot.hear(/test/i, async (context) => {
    context.sendPhotos({
        value: "./5790.jpg",
        message: "test"
    });
});
@MrCatplay MrCatplay added the package: vk-io Issues related to vk-io label Jun 16, 2024
@depre33edBoy
Copy link

Я думаю, что в ошибке все достаточно ясно написано: один из указанных параметров отсутствовал или недействительным: сообщение пустое или недействительное.
Рекомендую изучить документацию: https://negezor.github.io/vk-io/ru/guide/upload.html

@MrCatplay
Copy link
Author

спасибо

@negezor
Copy link
Owner

negezor commented Jun 19, 2024

Нужно проверить наличие фотографии релативно на диске от PWD. Так же сообщение передаётся вторым параметром в методе sendPhotos()
https://negezor.github.io/vk-io/references/vk-io/classes/MessageContext.html#sendPhotos

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

3 participants