Я использую пакет google-images и image-search-google npm, но результат из части «использование» пакета либо пуст, либо «ошибка: невозможно отправить пустое сообщение», я действительно запутался
Я попробовал точно со страницы, но все тот же результат, я нашел учебник, который похож, но тот же результат, теперь я действительно запутался
const {RichEmbed, Attachment} = require('discord.js')
const GoogleImage = require('image-search-google')
const {saveGoogle, google_api} = require('../config.json')
const google = new GoogleImage(saveGoogle, google_api);
module.exports.run = async(bot, message, args) => {
google.search("John Cena").then(result => {
if(!result) return console.log('FAILED');
console.log(result)
const attachment = new Attachment(result.url);
message.channel.send(attachment);
}).catch(e => console.log(e))
};
(node:12184) UnhandledPromiseRejectionWarning: TypeError: The resource must be a string or Buffer.
at ClientDataResolver.resolveFile (D:\Workspace\DiscordBot\node_modules\discord.js\src\client\ClientDataResolver.js:278:27)
at Promise.all.options.files.map.file (D:\Workspace\DiscordBot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:173:30)
at Array.map (<anonymous>)
at TextChannel.send (D:\Workspace\DiscordBot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:172:40)
at google.search.then.result (D:\Workspace\DiscordBot\commands\image.js:13:27)
at process._tickCallback (internal/process/next_tick.js:68:7)
Эторезультат, который я получаю с ошибкой «Не могу отправить пустое сообщение»