Сейчас код такой:
cmd.hear(/^(?:screen)/i, async (msg) => {
let args = msg.$match;
const { upload } = vk
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.youtube.com/watch?v=9ftb_pTdDKQ');
await page.screenshot({ path: 'result.png' });
msg.sendPhotos({
source: {
value: fs.readFileSync('./result.png')
}
})
await browser.close();
})
ошибка такая:
(node:8500) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'value' of 'media' as it is undefined.
at D:\mongo\node_modules\vk-io\lib\index.js:4740:19
at Array.map (<anonymous>)
at Upload.conduct (D:\mongo\node_modules\vk-io\lib\index.js:4711:18)
at Upload.messagePhoto (D:\mongo\node_modules\vk-io\lib\index.js:4250:36)
at D:\mongo\node_modules\vk-io\lib\index.js:6527:81
at Array.map (<anonymous>)
at MessageContext.sendPhotos (D:\mongo\node_modules\vk-io\lib\index.js:6527:54)
at D:\mongo\bot.js:48:7
at async D:\mongo\node_modules\middleware-io\lib\index.js:280:9
(node:8500) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function withoutI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:8500) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.