API Examples

Example 1: Image GIFs - Modules: Superagent (^5.1.0) & Discord.JS (^11.5.1)

const Discord = require("discord.js");
const superagent = require("superagent");
​
exports.run = async (bot, message, args) => {
​
let user = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if(!user) return message.channel.send("**Love πŸ’ž |** Please mention a user!");
​
const {body} = await superagent
.get(`https://natebot-api.glitch.me/api/pat/`);
​
let patembed = new Discord.RichEmbed()
.setAuthor('Pat πŸ˜‡', 'https://i.imgur.com/EVTiOBW.png')
.setDescription(`**${message.author.username}** patted **${message.mentions.users.first().username}!**`)
.setImage(body.response)
.setColor("#e889e0")
​
message.channel.send(patembed)
}

Example 2: Hangman - Modules: node-superfetch (^0.1.9) & Discord.JS (^11.5.1)

const { body } = await get('https://natebot-api.glitch.me/api/hangman');
const word = body[Math.floor(Math.random() * body.length)]

Example 3: Approved - Modules: Superagent (^5.1.0) & Discord.JS (^11.5.1)

const { RichEmbed } = require('discord.js')
const { get } = require('node-superfetch')
​
exports.run = async(client, message, args) => {
const user = message.mentions.users.first() || message.author
if(!user) return message.channel.send(`**Image Generator |** Please mention a User`)
const { body } = await get(`https://natebot-apibeta.glitch.me/image/approved?url=${user.displayAvatarURL}`)
​
const embed = new RichEmbed()
.setColor(0x68b6ff)
.setAuthor(`Approved`, 'https://i.imgur.com/EVTiOBW.png')
.attachFile({ attachment: body, name: "approved.png" })
.setImage("attachment://approved.png")
message.channel.send(embed)
}