Trigger Download Endpoint in Stock Photo

This commit is contained in:
Dragon Fire
2020-06-11 18:57:50 -04:00
parent b1cdd77941
commit 04f49ed095
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -40,9 +40,10 @@ module.exports = class StockPhotoCommand extends Command {
query,
content_filter: msg.channel.nsfw ? 'low' : 'high'
});
await this.triggerDownload(body);
const embed = new MessageEmbed()
.setTitle(body.description ? shorten(body.description, 256) : 'Unnamed Image')
.setURL(body.links.download)
.setURL(body.user.links.html)
.setColor(body.color)
.setAuthor(body.user.name || body.user.username, undefined, body.user.links.html)
.setImage(body.urls.raw)
@@ -54,4 +55,10 @@ module.exports = class StockPhotoCommand extends Command {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
triggerDownload(body) {
return request
.get(body.links.download_location)
.set({ Authorization: `Client-ID ${UNSPLASH_KEY}` });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "116.17.0",
"version": "116.17.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {