mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +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 { GIPHY_KEY } = process.env;
|
||||
|
||||
@@ -10,6 +11,7 @@ module.exports = class GiphyCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'giphy',
|
||||
description: 'Searches Giphy for your query.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
@@ -30,7 +32,17 @@ module.exports = class GiphyCommand extends Command {
|
||||
rating: msg.channel.nsfw ? 'r' : 'pg'
|
||||
});
|
||||
if (!body.data.length) return msg.say('Could not find any results.');
|
||||
return msg.say(body.data[Math.floor(Math.random() * body.data.length)].images.original.url);
|
||||
const data = body.data[Math.floor(Math.random() * body.data.length)];
|
||||
const embed = new MessageEmbed()
|
||||
.setAuthor('Giphy', 'https://i.imgur.com/rWphUCU.jpg')
|
||||
.setColor(0x4C177F)
|
||||
.setURL(data.url)
|
||||
.setImage(data.images.original.url.replace(/\?fingerprint=.+/gi, ''))
|
||||
.addField('❯ Uploader',
|
||||
data.username || 'N/A', true)
|
||||
.addField('❯ Upload Date',
|
||||
new Date(data.import_datetime).toDateString(), true);
|
||||
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