mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 15:19:14 +02:00
Trigger Download Endpoint in Stock Photo
This commit is contained in:
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "116.17.0",
|
||||
"version": "116.17.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user