snekfetch

This commit is contained in:
Daniel Odendahl Jr
2017-05-15 03:31:13 +00:00
parent d1148a0966
commit 87c0646233
40 changed files with 236 additions and 210 deletions
+9 -3
View File
@@ -1,6 +1,6 @@
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const request = require('superagent');
const snekfetch = require('snekfetch');
const { WORDNIK_KEY } = process.env;
module.exports = class DefineCommand extends Command {
@@ -27,8 +27,14 @@ module.exports = class DefineCommand extends Command {
return msg.say('This Command requires the `Embed Links` Permission.');
const { query } = args;
try {
const { body } = await request
.get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${WORDNIK_KEY}`);
const { body } = await snekfetch
.get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions`)
.query({
limit: 1,
includeRelated: false,
useCanonical: false,
api_key: WORDNIK_KEY
});
if (!body.length) throw new Error('No Results.');
const embed = new RichEmbed()
.setColor(0x9797FF)