mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 15:57:42 +02:00
LOGOS :(
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { FLICKR_KEY } = process.env;
|
||||
|
||||
@@ -10,6 +11,7 @@ module.exports = class FlickrCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'flickr',
|
||||
description: 'Searches Flickr for your query.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
@@ -32,8 +34,14 @@ module.exports = class FlickrCommand extends Command {
|
||||
nojsoncallback: true
|
||||
});
|
||||
if (!body.photos.photo.length) return msg.say('Could not find any results.');
|
||||
const photo = body.photos.photo[Math.floor(Math.random() * body.photos.photo.length)];
|
||||
return msg.say(`https://farm${photo.farm}.staticflickr.com/${photo.server}/${photo.id}_${photo.secret}.jpg`);
|
||||
const data = body.photos.photo[Math.floor(Math.random() * body.photos.photo.length)];
|
||||
const embed = new MessageEmbed()
|
||||
.setAuthor('Flickr', 'https://i.imgur.com/8QPPlV9.png')
|
||||
.setColor(0x0059D4)
|
||||
.setImage(`https://farm${data.farm}.staticflickr.com/${data.server}/${data.id}_${data.secret}.jpg`)
|
||||
.setTitle(data.title)
|
||||
.setURL(`https://www.flickr.com/photos/${data.owner}/${data.id}`);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user