Panda

discord.js-phin

This tutorial needs some work if you dont have a command handler or have another way you setup your command handler.

Getting Started

We expect you to know basic node commands and javascript. If not please go here: https://www.codecademy.com/learn/introduction-to-javascript and learn then come back!

First of we are going to use a node package called "phin" I hope you atleast know how discord.js works if not GOOGLE! Do the following in the terminal in your folder:

CONSOLE
npm i phin

Once you're done installing the package make a file named panda.js inside your commands folder.

panda.js
// Importing the packages :
const p = require('phin')
// Fix the command handler stuff
module.exports = {
name: "panda",
category: "fun",
description: "Sends a cute panda",
usage: '!!panda',
run: async (client, message, args) => {
// making a function for getting the response for the embed
const getResponse = async function () {
let resp;
const response = await p({
url: `https://some-random-api.ml/animal/panda`,
method: 'get',
parse: 'json'
})
resp = response.body
return resp;
}
// assigning the data to a variable
let Data = await getResponse()
// Making a embed
const embed = new MessageEmbed()
.setColor(`#00008b`)
.setTitle(`**Cute panda!**`)
.setImage(Data.image)
.setFooter(`Hi! This photo came from some-random-api.ml! You should totally check it out!`)
.setTimestamp()
// Sending the embed
message.channel.send(embed)
}
}

Once thats done you can test it out and get a wonderful panda! ❤

NOTE: Wanna support us by donating and get fun perks in return? Feel free to donate here!