mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
const Discord = require("discord.js")
|
|
const giphy = require("giphy-api")("eW1dIGt8WPveUcxEZgXAFtEmuZ8MTxmy");
|
|
|
|
module.exports = {
|
|
name: 'gif',
|
|
utilisation: 'gif [terme de recherche]',
|
|
description: 'Recherche un gif basé sur le terme de recherche fourni.',
|
|
emote: '🎮',
|
|
category: 'utils',
|
|
async execute(message, args, client) {
|
|
|
|
|
|
if (args.length === 0) {
|
|
message.channel.send("Indiquez une recherche");
|
|
return;
|
|
}
|
|
if (args.length === 1) {
|
|
term = args.toString();
|
|
} else {
|
|
term = args.join(" ");
|
|
}
|
|
giphy.search(term).then(function (res) {
|
|
|
|
let id = res.data[0].id;
|
|
let msgurl = `https://media.giphy.com/media/${id}/giphy.gif`;
|
|
|
|
const embed = new Discord.EmbedBuilder()
|
|
.setTitle(`Résultat pour \`${term}\``)
|
|
.setImage(msgurl)
|
|
.setFooter({text: `${client.user.username}`})
|
|
message.channel.send({ embeds: [embed] });
|
|
});
|
|
|
|
message.delete();
|
|
},
|
|
}; |