mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-18 21:39:16 +02:00
ajouter gif commande and corrige help and loadCommande
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
const Discord = require("discord.js")
|
||||
const giphy = require("giphy-api")("eW1dIGt8WPveUcxEZgXAFtEmuZ8MTxmy");
|
||||
|
||||
module.exports = {
|
||||
name: 'gif',
|
||||
usage: '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();
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user