diff --git a/commands/Anime/highfive.js b/commands/Anime/highfive.js index 5992a9f..5d9c7fb 100644 --- a/commands/Anime/highfive.js +++ b/commands/Anime/highfive.js @@ -2,9 +2,33 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); const { requestAPI } = require("../../modules/requestAPI"); module.exports = { + name: "highfive", + aliases: ["hf"], + description: "Sends a highfive gif", + usage: "hf || highfive", + async run(message, args, client) { + try { + const highFive = await requestAPI("https://api.waifu.pics/sfw/highfive"); + const highFiveEmbed = { + color: "#9dcc37", + image: { + url: `${highFive.url}`, + }, + timestamp: new Date(), + footer: { + text: `Requested by ${message.member.user.username}`, + icon_url: `${message.member.user.avatarURL()}`, + }, + }; + await message.channel.send({ embeds: [highFiveEmbed] }); + } catch (error) { + client.logger(error.message, "error"); + await message.channel.send(`Couldn't retrieve a hug gif, Sorry!`); + } + }, data: new SlashCommandBuilder() .setName("highfive") - .setDescription("sends a highfive gif"), + .setDescription("Sends a highfive gif"), async execute(interaction, client) { await interaction.deferReply(); try { diff --git a/commands/Anime/hug.js b/commands/Anime/hug.js index db4f04a..e4dcce7 100644 --- a/commands/Anime/hug.js +++ b/commands/Anime/hug.js @@ -2,9 +2,33 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); const { requestAPI } = require("../../modules/requestAPI"); module.exports = { + name: "hug", + args: false, + description: "Sends a hug gif", + usage: "hug", + async run(message, args, client) { + try { + const hug = await requestAPI("https://api.waifu.pics/sfw/hug"); + const hugEmbed = { + color: "#9dcc37", + image: { + url: `${hug.url}`, + }, + timestamp: new Date(), + footer: { + text: `Requested by ${message.member.user.username}`, + icon_url: `${message.member.user.avatarURL()}`, + }, + }; + await message.channel.send({ embeds: [hugEmbed] }); + } catch (error) { + client.logger(error.message, "error"); + await message.channel.send(`Couldn't retrieve a hug gif, Sorry!`); + } + }, data: new SlashCommandBuilder() .setName("hug") - .setDescription("sends a hug gif"), + .setDescription("Sends a hug gif"), async execute(interaction, client) { await interaction.deferReply(); try { diff --git a/commands/Anime/waifu.js b/commands/Anime/waifu.js index d53236f..36433da 100644 --- a/commands/Anime/waifu.js +++ b/commands/Anime/waifu.js @@ -2,9 +2,33 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); const { requestAPI } = require("../../modules/requestAPI"); module.exports = { + name: "waifu", + args: false, + description: "Gets a waifu pic :P", + usage: "waifu", + async run(message, args, client) { + try { + const waifu = await requestAPI("https://api.waifu.pics/sfw/waifu"); + const waifuEmbed = { + color: "#9dcc37", + image: { + url: `${waifu.url}`, + }, + timestamp: new Date(), + footer: { + text: `Requested by ${message.member.user.username}`, + icon_url: `${message.member.user.avatarURL()}`, + }, + }; + await message.channel.send({ embeds: [waifuEmbed] }); + } catch (error) { + client.logger(error.message, "error"); + await message.channel.send(`Couldn't retrieve a waifu pic, Sorry!`); + } + }, data: new SlashCommandBuilder() .setName("waifu") - .setDescription("gets waifu pic :P"), + .setDescription("Gets a waifu pic :P"), async execute(interaction, client) { await interaction.deferReply(); try { diff --git a/commands/Anime/whatAnime.js b/commands/Anime/whatAnime.js index dec32b1..9adcc01 100644 --- a/commands/Anime/whatAnime.js +++ b/commands/Anime/whatAnime.js @@ -1,10 +1,60 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); +const { embedMessage } = require("../../modules/embedSimple"); const { getAnimeByImage } = require("../../modules/getAnimeByImage"); module.exports = { + name: "whatanime", + aliases: ["wa"], + args: true, + description: "Scans an Image to get the anime name!", + usage: "wa || whatanime ", + async run(message, args, client) { + if (!args[0]) + return await message.channel.send({ + embeds: [embedMessage("#9dcc37", `You have to provide an image link!`)], + }); + + try { + const res = await getAnimeByImage(args[0]); + const resultArray = res.result.slice(0, 3).map((info, index) => { + return ( + `${index + 1}: ` + + "`" + + `${ + info.anilist.title.english + ? info.anilist.title.english + : `Not Available` + }` + + "`" + + " **AKA** " + + "`" + + `${info.anilist.title.romaji}` + + "`" + + " **Similarity** " + + `${info.similarity.toFixed(2) * 100}%` + ); + }); + const infoEmbed = { + color: "#9dcc37", + title: "Search Result", + description: `${resultArray.join("\n")}`, + timestamp: new Date(), + footer: { + text: `Requested by ${message.member.user.username}`, + icon_url: `${message.member.user.avatarURL()}`, + }, + }; + await message.channel.send({ embeds: [infoEmbed] }); + } catch (error) { + client.logger(error.message, "error"); + await message.channel.send( + `${interaction.user.toString()}, There was an error processing this image!` + ); + } + }, data: new SlashCommandBuilder() .setName("whatanime") - .setDescription("Scans an Image to get the anime name! ") + .setDescription("Scans an Image to get the anime name!") .addStringOption((option) => option.setName("image").setDescription("Image Link").setRequired(true) ),