diff --git a/commands/analyze/face.js b/commands/analyze/face.js
index f2710298..ece31bdc 100644
--- a/commands/analyze/face.js
+++ b/commands/analyze/face.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { KAIROS_KEY, KAIROS_ID } = process.env;
const races = ['asian', 'black', 'hispanic', 'other', 'white'];
@@ -23,7 +23,7 @@ module.exports = class FaceAnalyzeCommand extends Command {
async run(msg, { face }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.post('https://api.kairos.com/detect')
.set({
app_id: KAIROS_ID,
diff --git a/commands/analyze/gender.js b/commands/analyze/gender.js
index 3cbdbd4d..561a8e8e 100644
--- a/commands/analyze/gender.js
+++ b/commands/analyze/gender.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class GenderAnalyzeCommand extends Command {
constructor(client) {
@@ -33,7 +33,7 @@ module.exports = class GenderAnalyzeCommand extends Command {
async run(msg, { first, last }) {
try {
- const { body } = await snekfetch.get(`https://api.namsor.com/onomastics/api/json/gender/${first}/${last}`);
+ const { body } = await request.get(`https://api.namsor.com/onomastics/api/json/gender/${first}/${last}`);
if (body.gender === 'unknown') return msg.say(`I have no idea what gender ${body.firstName} is.`);
return msg.say(`I'm ${Math.abs(body.scale * 100)}% sure ${body.firstName} is a ${body.gender} name.`);
} catch (err) {
diff --git a/commands/analyze/read-qr-code.js b/commands/analyze/read-qr-code.js
index f77149bc..716cb574 100644
--- a/commands/analyze/read-qr-code.js
+++ b/commands/analyze/read-qr-code.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
module.exports = class ReadQRCodeCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class ReadQRCodeCommand extends Command {
async run(msg, { image }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://api.qrserver.com/v1/read-qr-code/')
.query({ fileurl: image });
const data = body[0].symbol[0];
diff --git a/commands/analyze/severe-toxicity.js b/commands/analyze/severe-toxicity.js
index 3b3a0997..1d4e581b 100644
--- a/commands/analyze/severe-toxicity.js
+++ b/commands/analyze/severe-toxicity.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { GOOGLE_KEY } = process.env;
module.exports = class SevereToxicityCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class SevereToxicityCommand extends Command {
async run(msg, { text }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.post('https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze')
.query({ key: GOOGLE_KEY })
.send({
diff --git a/commands/analyze/spoopy-link.js b/commands/analyze/spoopy-link.js
index b96eef00..4a7b9860 100644
--- a/commands/analyze/spoopy-link.js
+++ b/commands/analyze/spoopy-link.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
module.exports = class SpoopyLinkCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class SpoopyLinkCommand extends Command {
async run(msg, { site }) {
try {
- const { body } = await snekfetch.get(`https://spoopy.link/api/${site}`);
+ const { body } = await request.get(`https://spoopy.link/api/${site}`);
return msg.say(stripIndents`
${body.safe ? 'Safe!' : 'Not safe...'}
${body.chain.map(url => `<${url.url}> ${url.safe ? '✅' : `❌ (${url.reasons.join(', ')})`}`).join('\n')}
diff --git a/commands/analyze/toxicity.js b/commands/analyze/toxicity.js
index 15ff6ad4..06133b0d 100644
--- a/commands/analyze/toxicity.js
+++ b/commands/analyze/toxicity.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { GOOGLE_KEY } = process.env;
module.exports = class ToxicityCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class ToxicityCommand extends Command {
async run(msg, { text }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.post('https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze')
.query({ key: GOOGLE_KEY })
.send({
diff --git a/commands/avatar-edit/3000-years.js b/commands/avatar-edit/3000-years.js
index 6b04cdde..a63c5441 100644
--- a/commands/avatar-edit/3000-years.js
+++ b/commands/avatar-edit/3000-years.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class ThreeThousandYearsCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class ThreeThousandYearsCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', '3000-years.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/approved.js b/commands/avatar-edit/approved.js
index 8086dd3d..bd9f8136 100644
--- a/commands/avatar-edit/approved.js
+++ b/commands/avatar-edit/approved.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class ApprovedCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class ApprovedCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'approved.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(avatar.width, avatar.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/avatar-fusion.js b/commands/avatar-edit/avatar-fusion.js
index b15448f5..ceb2b8af 100644
--- a/commands/avatar-edit/avatar-fusion.js
+++ b/commands/avatar-edit/avatar-fusion.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class AvatarFusionCommand extends Command {
constructor(client) {
@@ -35,9 +35,9 @@ module.exports = class AvatarFusionCommand extends Command {
const baseAvatarURL = base.displayAvatarURL({ format: 'png', size: 512 });
const overlayAvatarURL = overlay.displayAvatarURL({ format: 'png', size: 512 });
try {
- const baseAvatarData = await snekfetch.get(baseAvatarURL);
+ const baseAvatarData = await request.get(baseAvatarURL);
const baseAvatar = await loadImage(baseAvatarData.body);
- const overlayAvatarData = await snekfetch.get(overlayAvatarURL);
+ const overlayAvatarData = await request.get(overlayAvatarURL);
const overlayAvatar = await loadImage(overlayAvatarData.body);
const canvas = createCanvas(baseAvatar.width, baseAvatar.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/beautiful.js b/commands/avatar-edit/beautiful.js
index 36c8ff19..98c18f3d 100644
--- a/commands/avatar-edit/beautiful.js
+++ b/commands/avatar-edit/beautiful.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class BeautifulCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class BeautifulCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'beautiful.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/bob-ross.js b/commands/avatar-edit/bob-ross.js
index 60209e2b..2c7acf32 100644
--- a/commands/avatar-edit/bob-ross.js
+++ b/commands/avatar-edit/bob-ross.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class BobRossCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class BobRossCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'bob-ross.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/card.js b/commands/avatar-edit/card.js
index a98a3182..e4e7451f 100644
--- a/commands/avatar-edit/card.js
+++ b/commands/avatar-edit/card.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { randomRange } = require('../../util/Util');
const { version } = require('../../package');
@@ -41,7 +41,7 @@ module.exports = class CardCommand extends Command {
else if (cardID < 9000) rarity = 'U';
else rarity = 'R';
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'card.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/challenger.js b/commands/avatar-edit/challenger.js
index 104c785a..a86c07f0 100644
--- a/commands/avatar-edit/challenger.js
+++ b/commands/avatar-edit/challenger.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class ChallengerCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class ChallengerCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'challenger.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/dexter.js b/commands/avatar-edit/dexter.js
index b7283b66..62cdea3e 100644
--- a/commands/avatar-edit/dexter.js
+++ b/commands/avatar-edit/dexter.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class DexterCommand extends Command {
@@ -30,7 +30,7 @@ module.exports = class DexterCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'dexter.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/distracted-boyfriend.js b/commands/avatar-edit/distracted-boyfriend.js
index cf628e7c..9362d226 100644
--- a/commands/avatar-edit/distracted-boyfriend.js
+++ b/commands/avatar-edit/distracted-boyfriend.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class DistractedBoyfriendCommand extends Command {
@@ -43,11 +43,11 @@ module.exports = class DistractedBoyfriendCommand extends Command {
const otherGirlAvatarURL = otherGirl.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'distracted-boyfriend.png'));
- const boyfriendAvatarData = await snekfetch.get(boyfriendAvatarURL);
+ const boyfriendAvatarData = await request.get(boyfriendAvatarURL);
const boyfriendAvatar = await loadImage(boyfriendAvatarData.body);
- const girlfriendAvatarData = await snekfetch.get(girlfriendAvatarURL);
+ const girlfriendAvatarData = await request.get(girlfriendAvatarURL);
const girlfriendAvatar = await loadImage(girlfriendAvatarData.body);
- const otherGirlAvatarData = await snekfetch.get(otherGirlAvatarURL);
+ const otherGirlAvatarData = await request.get(otherGirlAvatarURL);
const otherGirlAvatar = await loadImage(otherGirlAvatarData.body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/fire.js b/commands/avatar-edit/fire.js
index 253a4c4b..4dc4783b 100644
--- a/commands/avatar-edit/fire.js
+++ b/commands/avatar-edit/fire.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { drawImageWithTint } = require('../../util/Canvas');
@@ -32,7 +32,7 @@ module.exports = class FireCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'fire.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(avatar.width, avatar.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/food-broke.js b/commands/avatar-edit/food-broke.js
index f56aa1a5..69e8a87a 100644
--- a/commands/avatar-edit/food-broke.js
+++ b/commands/avatar-edit/food-broke.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { contrast } = require('../../util/Canvas');
@@ -32,7 +32,7 @@ module.exports = class FoodBrokeCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 128 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'food-broke.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/hat.js b/commands/avatar-edit/hat.js
index d7a2b4c9..559a1180 100644
--- a/commands/avatar-edit/hat.js
+++ b/commands/avatar-edit/hat.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { list } = require('../../util/Util');
const hats = require('../../assets/json/hat');
@@ -40,7 +40,7 @@ module.exports = class HatCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hat', `${type}.png`));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(avatar.width, avatar.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/he-lives-in-you.js b/commands/avatar-edit/he-lives-in-you.js
index cd3e725c..1c6d2556 100644
--- a/commands/avatar-edit/he-lives-in-you.js
+++ b/commands/avatar-edit/he-lives-in-you.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { drawImageWithTint } = require('../../util/Canvas');
@@ -32,7 +32,7 @@ module.exports = class HeLivesInYouCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'he-lives-in-you.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/i-have-the-power.js b/commands/avatar-edit/i-have-the-power.js
index 877fa3f7..7b015a6f 100644
--- a/commands/avatar-edit/i-have-the-power.js
+++ b/commands/avatar-edit/i-have-the-power.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class IHaveThePowerCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class IHaveThePowerCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'i-have-the-power.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/look-at-this-photograph.js b/commands/avatar-edit/look-at-this-photograph.js
index ff2627c8..81069cd2 100644
--- a/commands/avatar-edit/look-at-this-photograph.js
+++ b/commands/avatar-edit/look-at-this-photograph.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class LookAtThisPhotographCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class LookAtThisPhotographCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'look-at-this-photograph.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/look-what-karen-have.js b/commands/avatar-edit/look-what-karen-have.js
index 2ec4eeb1..d84995dd 100644
--- a/commands/avatar-edit/look-what-karen-have.js
+++ b/commands/avatar-edit/look-what-karen-have.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class LookWhatKarenHaveCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class LookWhatKarenHaveCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'look-what-karen-have.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/pixelize.js b/commands/avatar-edit/pixelize.js
index 81ba9c0c..56f7b470 100644
--- a/commands/avatar-edit/pixelize.js
+++ b/commands/avatar-edit/pixelize.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class PixelizeCommand extends Command {
constructor(client) {
@@ -28,7 +28,7 @@ module.exports = class PixelizeCommand extends Command {
async run(msg, { user }) {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 64 });
try {
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(512, 512);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/rainbow.js b/commands/avatar-edit/rainbow.js
index b592eee3..bebeb5d4 100644
--- a/commands/avatar-edit/rainbow.js
+++ b/commands/avatar-edit/rainbow.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class RainbowCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class RainbowCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'rainbow.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(avatar.width, avatar.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/rejected.js b/commands/avatar-edit/rejected.js
index 6f52c262..fbfe75b4 100644
--- a/commands/avatar-edit/rejected.js
+++ b/commands/avatar-edit/rejected.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class RejctedCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class RejctedCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'rejected.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(avatar.width, avatar.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/rip.js b/commands/avatar-edit/rip.js
index 751a2fea..32ce1997 100644
--- a/commands/avatar-edit/rip.js
+++ b/commands/avatar-edit/rip.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { greyscale } = require('../../util/Canvas');
@@ -32,7 +32,7 @@ module.exports = class RipCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'rip.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/steam-card.js b/commands/avatar-edit/steam-card.js
index 65d2d625..73cff4a9 100644
--- a/commands/avatar-edit/steam-card.js
+++ b/commands/avatar-edit/steam-card.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
@@ -34,7 +34,7 @@ module.exports = class SteamCardCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'steam-card.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/steam-now-playing.js b/commands/avatar-edit/steam-now-playing.js
index cca4702d..9094a3ce 100644
--- a/commands/avatar-edit/steam-now-playing.js
+++ b/commands/avatar-edit/steam-now-playing.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
@@ -40,7 +40,7 @@ module.exports = class SteamNowPlayingCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 64 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'steam-now-playing.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/the-ultimate-tattoo.js b/commands/avatar-edit/the-ultimate-tattoo.js
index 8dba968f..a3c29c50 100644
--- a/commands/avatar-edit/the-ultimate-tattoo.js
+++ b/commands/avatar-edit/the-ultimate-tattoo.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class TheUltimateTattooCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class TheUltimateTattooCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'the-ultimate-tattoo.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/thug-life.js b/commands/avatar-edit/thug-life.js
index 51bd1486..b832bb76 100644
--- a/commands/avatar-edit/thug-life.js
+++ b/commands/avatar-edit/thug-life.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { greyscale } = require('../../util/Canvas');
@@ -31,7 +31,7 @@ module.exports = class ThugLifeCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'thug-life.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(avatar.width, avatar.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/triggered.js b/commands/avatar-edit/triggered.js
index 710e330a..9a558842 100644
--- a/commands/avatar-edit/triggered.js
+++ b/commands/avatar-edit/triggered.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { drawImageWithTint } = require('../../util/Canvas');
@@ -31,7 +31,7 @@ module.exports = class TriggeredCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'triggered.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/wanted.js b/commands/avatar-edit/wanted.js
index 766898d4..c444bfe0 100644
--- a/commands/avatar-edit/wanted.js
+++ b/commands/avatar-edit/wanted.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { sepia } = require('../../util/Canvas');
@@ -32,7 +32,7 @@ module.exports = class WantedCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'wanted.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/avatar-edit/yu-gi-oh-token.js b/commands/avatar-edit/yu-gi-oh-token.js
index b6136e19..3ebc46be 100644
--- a/commands/avatar-edit/yu-gi-oh-token.js
+++ b/commands/avatar-edit/yu-gi-oh-token.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class YuGiOhTokenCommand extends Command {
@@ -31,7 +31,7 @@ module.exports = class YuGiOhTokenCommand extends Command {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-token.png'));
- const { body } = await snekfetch.get(avatarURL);
+ const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/events/astronomy-picture-of-the-day.js b/commands/events/astronomy-picture-of-the-day.js
index e021b3c4..8f09c882 100644
--- a/commands/events/astronomy-picture-of-the-day.js
+++ b/commands/events/astronomy-picture-of-the-day.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
const { GOV_KEY } = process.env;
@@ -17,7 +17,7 @@ module.exports = class AstronomyPictureOfTheDayCommand extends Command {
async run(msg) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://api.nasa.gov/planetary/apod')
.query({ api_key: GOV_KEY });
return msg.say(shorten(body.explanation), { files: [body.url] });
diff --git a/commands/events/doomsday-clock.js b/commands/events/doomsday-clock.js
index eda908b5..b7c88913 100644
--- a/commands/events/doomsday-clock.js
+++ b/commands/events/doomsday-clock.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
module.exports = class DoomsdayClockCommand extends Command {
@@ -14,8 +14,7 @@ module.exports = class DoomsdayClockCommand extends Command {
async run(msg) {
try {
- const { raw } = await snekfetch.get('https://thebulletin.org/timeline');
- const text = raw.toString();
+ const { text } = await request.get('https://thebulletin.org/timeline');
const time = text.match(/IT IS (.+) MINUTES TO MIDNIGHT/)[0];
const desc = text.match(/
(.+)<\/span>: (.+)<\/div>/);
return msg.say(stripIndents`
diff --git a/commands/events/google-doodle.js b/commands/events/google-doodle.js
index 2121668f..76569f69 100644
--- a/commands/events/google-doodle.js
+++ b/commands/events/google-doodle.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class GoogleDoodleCommand extends Command {
constructor(client) {
@@ -32,7 +32,7 @@ module.exports = class GoogleDoodleCommand extends Command {
if (latest) month = now.getMonth() + 1;
if (!year) year = now.getFullYear();
try {
- const { body } = await snekfetch.get(`https://www.google.com/doodles/json/${year}/${month}`);
+ const { body } = await request.get(`https://www.google.com/doodles/json/${year}/${month}`);
if (!body.length) return msg.say('Could not find any results.');
const data = body[latest ? 0 : Math.floor(Math.random() * body.length)];
const runDate = new Date(data.run_date_array.join('-')).toDateString();
diff --git a/commands/events/holidays.js b/commands/events/holidays.js
index 10d6f110..5bdf18a1 100644
--- a/commands/events/holidays.js
+++ b/commands/events/holidays.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { today, tomorrow } = require('../../util/Util');
const { GOOGLE_KEY, GOOGLE_CALENDAR_ID } = process.env;
@@ -16,7 +16,7 @@ module.exports = class HolidaysCommand extends Command {
async run(msg) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(GOOGLE_CALENDAR_ID)}/events`)
.query({
maxResults: 10,
diff --git a/commands/events/horoscope.js b/commands/events/horoscope.js
index 0ef714d8..035e8caa 100644
--- a/commands/events/horoscope.js
+++ b/commands/events/horoscope.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { list } = require('../../util/Util');
const signs = require('../../assets/json/horoscope');
@@ -27,7 +27,7 @@ module.exports = class HoroscopeCommand extends Command {
async run(msg, { sign }) {
try {
- const { body } = await snekfetch.get(`http://theastrologer-api.herokuapp.com/api/horoscope/${sign}/today`);
+ const { body } = await request.get(`http://theastrologer-api.herokuapp.com/api/horoscope/${sign}/today`);
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setTitle(`Horoscope for ${body.sunsign}...`)
diff --git a/commands/events/neko-atsume-password.js b/commands/events/neko-atsume-password.js
index c214548d..ac84b887 100644
--- a/commands/events/neko-atsume-password.js
+++ b/commands/events/neko-atsume-password.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
const { list, duration, tomorrow } = require('../../util/Util');
const { GOLD_FISH_EMOJI_ID, SILVER_FISH_EMOJI_ID } = process.env;
@@ -42,9 +42,9 @@ module.exports = class NekoAtsumePasswordCommand extends Command {
}
async fetchPassword(locale) {
- const { raw } = await snekfetch
+ const { text } = await request
.get(`http://hpmobile.jp/app/nekoatsume/neko_daily${locale !== 'jp' ? `_${locale}` : ''}.php`);
- const data = raw.toString().split(',');
+ const data = text.split(',');
const date = new Date();
date.setUTCHours(date.getUTCHours() + 9);
return {
diff --git a/commands/events/today-in-history.js b/commands/events/today-in-history.js
index c2be26b4..39c775ec 100644
--- a/commands/events/today-in-history.js
+++ b/commands/events/today-in-history.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class TodayInHistoryCommand extends Command {
constructor(client) {
@@ -33,8 +33,8 @@ module.exports = class TodayInHistoryCommand extends Command {
async run(msg, { month, day }) {
const date = month && day ? `/${month}/${day}` : '';
try {
- const { raw } = await snekfetch.get(`http://history.muffinlabs.com/date${date}`);
- const body = JSON.parse(raw.toString());
+ const { text } = await request.get(`http://history.muffinlabs.com/date${date}`);
+ const body = JSON.parse(text);
const events = body.data.Events;
const event = events[Math.floor(Math.random() * events.length)];
const embed = new MessageEmbed()
@@ -47,7 +47,7 @@ module.exports = class TodayInHistoryCommand extends Command {
event.links.map(link => `[${link.title}](${link.link.replace(/\)/g, '%29')})`).join(', '));
return msg.embed(embed);
} catch (err) {
- if (err.statusCode === 404 || err.statusCode === 500) return msg.say('Invalid date.');
+ if (err.status === 404 || err.status === 500) return msg.say('Invalid date.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/events/word-of-the-day.js b/commands/events/word-of-the-day.js
index 31d1f324..a24c0e38 100644
--- a/commands/events/word-of-the-day.js
+++ b/commands/events/word-of-the-day.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
const { WORDNIK_KEY } = process.env;
@@ -16,7 +16,7 @@ module.exports = class WordOfTheDayCommand extends Command {
async run(msg) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://api.wordnik.com/v4/words.json/wordOfTheDay')
.query({ api_key: WORDNIK_KEY });
return msg.say(stripIndents`
diff --git a/commands/games/akinator.js b/commands/games/akinator.js
index 1bf98d60..0efa0162 100644
--- a/commands/games/akinator.js
+++ b/commands/games/akinator.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
const { verify } = require('../../util/Util');
@@ -64,7 +64,7 @@ module.exports = class AkinatorCommand extends Command {
}
async createSession(channel) {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://192.99.38.142:8126/ws/new_session')
.query({
partner: 1,
@@ -87,7 +87,7 @@ module.exports = class AkinatorCommand extends Command {
async progress(channel, answer) {
const session = this.sessions.get(channel.id);
- const { body } = await snekfetch
+ const { body } = await request
.get('http://192.99.38.142:8126/ws/answer')
.query({
session: session.id,
@@ -110,7 +110,7 @@ module.exports = class AkinatorCommand extends Command {
async finish(channel) {
const session = this.sessions.get(channel.id);
- const { body } = await snekfetch
+ const { body } = await request
.get('http://192.99.38.142:8126/ws/list')
.query({
session: session.id,
diff --git a/commands/games/google-feud.js b/commands/games/google-feud.js
index 450404f5..c5dac5dd 100644
--- a/commands/games/google-feud.js
+++ b/commands/games/google-feud.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { MessageEmbed } = require('discord.js');
const questions = require('../../assets/json/google-feud');
@@ -66,13 +66,13 @@ module.exports = class GoogleFeudCommand extends Command {
}
async fetchSuggestions(question) {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://suggestqueries.google.com/complete/search')
.query({
client: 'firefox',
q: question
});
- const suggestions = JSON.parse(raw.toString())[1]
+ const suggestions = JSON.parse(text)[1]
.filter(suggestion => suggestion.toLowerCase() !== question.toLowerCase());
if (!suggestions.length) return null;
return suggestions.map(suggestion => suggestion.toLowerCase().replace(question.toLowerCase(), '').trim());
diff --git a/commands/games/hangman.js b/commands/games/hangman.js
index 2e2cdfef..456d1ceb 100644
--- a/commands/games/hangman.js
+++ b/commands/games/hangman.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
const { WORDNIK_KEY } = process.env;
@@ -19,7 +19,7 @@ module.exports = class HangmanCommand extends Command {
if (this.playing.has(msg.channel.id)) return msg.reply('Only one game may be occurring per channel.');
this.playing.add(msg.channel.id);
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://api.wordnik.com/v4/words.json/randomWord')
.query({ api_key: WORDNIK_KEY });
const word = body.word.toLowerCase().replace(/ /g, '-');
diff --git a/commands/games/quiz.js b/commands/games/quiz.js
index c8e15a41..f3957838 100644
--- a/commands/games/quiz.js
+++ b/commands/games/quiz.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shuffle, list } = require('../../util/Util');
const types = ['multiple', 'boolean'];
const difficulties = ['easy', 'medium', 'hard'];
@@ -41,7 +41,7 @@ module.exports = class QuizCommand extends Command {
async run(msg, { type, difficulty }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://opentdb.com/api.php')
.query({
amount: 1,
diff --git a/commands/games/whos-that-pokemon.js b/commands/games/whos-that-pokemon.js
index 6e6c9100..a527c8b1 100644
--- a/commands/games/whos-that-pokemon.js
+++ b/commands/games/whos-that-pokemon.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { silhouette } = require('../../util/Canvas');
module.exports = class WhosThatPokemonCommand extends Command {
@@ -52,13 +52,13 @@ module.exports = class WhosThatPokemonCommand extends Command {
async fetchPokemon(pokemon) {
if (this.cache.has(pokemon)) return this.cache.get(pokemon);
- const { body } = await snekfetch.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
+ const { body } = await request.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
this.cache.set(body.id, body);
return body;
}
async fetchImage(id, hide = false) {
- const image = await snekfetch.get(`https://www.serebii.net/sunmoon/pokemon/${id}.png`);
+ const image = await request.get(`https://www.serebii.net/sunmoon/pokemon/${id}.png`);
if (!hide) return image.body;
const base = await loadImage(image.body);
const canvas = createCanvas(base.width, base.height);
diff --git a/commands/image-edit/contrast.js b/commands/image-edit/contrast.js
index 8f70903e..3febf5ce 100644
--- a/commands/image-edit/contrast.js
+++ b/commands/image-edit/contrast.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { contrast } = require('../../util/Canvas');
module.exports = class ContrastCommand extends Command {
@@ -28,7 +28,7 @@ module.exports = class ContrastCommand extends Command {
async run(msg, { image }) {
try {
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/create-qr-code.js b/commands/image-edit/create-qr-code.js
index 3a59de50..894134a2 100644
--- a/commands/image-edit/create-qr-code.js
+++ b/commands/image-edit/create-qr-code.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class CreateQRCodeCommand extends Command {
constructor(client) {
@@ -21,7 +21,7 @@ module.exports = class CreateQRCodeCommand extends Command {
async run(msg, { text }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://api.qrserver.com/v1/create-qr-code/')
.query({ data: text });
return msg.say({ files: [{ attachment: body, name: 'qr-code.png' }] });
diff --git a/commands/image-edit/demotivational-poster.js b/commands/image-edit/demotivational-poster.js
index 0f275db0..7b69e2bb 100644
--- a/commands/image-edit/demotivational-poster.js
+++ b/commands/image-edit/demotivational-poster.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
@@ -45,7 +45,7 @@ module.exports = class DemotivationalPosterCommand extends Command {
async run(msg, { title, text, image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'demotivational-poster.png'));
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/distort.js b/commands/image-edit/distort.js
index 94571d71..e55231ab 100644
--- a/commands/image-edit/distort.js
+++ b/commands/image-edit/distort.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { distort } = require('../../util/Canvas');
module.exports = class DistortCommand extends Command {
@@ -34,7 +34,7 @@ module.exports = class DistortCommand extends Command {
async run(msg, { level, image }) {
try {
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/frame.js b/commands/image-edit/frame.js
index 4a5b7482..2527430f 100644
--- a/commands/image-edit/frame.js
+++ b/commands/image-edit/frame.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class FrameCommand extends Command {
@@ -30,7 +30,7 @@ module.exports = class FrameCommand extends Command {
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'frame.png'));
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/glitch.js b/commands/image-edit/glitch.js
index 8ba7b3c9..fe20cfe7 100644
--- a/commands/image-edit/glitch.js
+++ b/commands/image-edit/glitch.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { distort } = require('../../util/Canvas');
module.exports = class GlitchCommand extends Command {
@@ -28,7 +28,7 @@ module.exports = class GlitchCommand extends Command {
async run(msg, { image }) {
try {
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/greyscale.js b/commands/image-edit/greyscale.js
index 3e029ca0..6517ef1e 100644
--- a/commands/image-edit/greyscale.js
+++ b/commands/image-edit/greyscale.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { greyscale } = require('../../util/Canvas');
module.exports = class GreyscaleCommand extends Command {
@@ -29,7 +29,7 @@ module.exports = class GreyscaleCommand extends Command {
async run(msg, { image }) {
try {
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/ifunny.js b/commands/image-edit/ifunny.js
index ca82bf75..291fc64a 100644
--- a/commands/image-edit/ifunny.js
+++ b/commands/image-edit/ifunny.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const path = require('path');
module.exports = class IfunnyCommand extends Command {
@@ -29,7 +29,7 @@ module.exports = class IfunnyCommand extends Command {
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'ifunny.png'));
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/illegal.js b/commands/image-edit/illegal.js
index db0d3705..0ef663ac 100644
--- a/commands/image-edit/illegal.js
+++ b/commands/image-edit/illegal.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { wait } = require('../../util/Util');
module.exports = class IllegalCommand extends Command {
@@ -46,7 +46,7 @@ module.exports = class IllegalCommand extends Command {
}
async createGIF(text) {
- const { body } = await snekfetch
+ const { body } = await request
.post('https://is-now-illegal.firebaseio.com/queue/tasks.json')
.send({
task: 'gif',
@@ -57,7 +57,7 @@ module.exports = class IllegalCommand extends Command {
}
async fetchGIF(text) {
- const { body } = await snekfetch.get(`https://is-now-illegal.firebaseio.com/gifs/${text}.json`);
+ const { body } = await request.get(`https://is-now-illegal.firebaseio.com/gifs/${text}.json`);
if (!body) return null;
return body.url;
}
diff --git a/commands/image-edit/invert.js b/commands/image-edit/invert.js
index b3c2b96a..57f2fd56 100644
--- a/commands/image-edit/invert.js
+++ b/commands/image-edit/invert.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { invert } = require('../../util/Canvas');
module.exports = class InvertCommand extends Command {
@@ -28,7 +28,7 @@ module.exports = class InvertCommand extends Command {
async run(msg, { image }) {
try {
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/meme.js b/commands/image-edit/meme.js
index 59c95d40..d6f0f9f5 100644
--- a/commands/image-edit/meme.js
+++ b/commands/image-edit/meme.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class MemeCommand extends Command {
constructor(client) {
@@ -36,9 +36,9 @@ module.exports = class MemeCommand extends Command {
async run(msg, { type, top, bottom }) {
try {
- const search = await snekfetch.get(`https://memegen.link/api/search/${type}`);
+ const search = await request.get(`https://memegen.link/api/search/${type}`);
if (!search.body.length) return msg.say('Could not find any results.');
- const { body } = await snekfetch.get(search.body[0].template.blank.replace(/\/_/, `/${top}/${bottom}`));
+ const { body } = await request.get(search.body[0].template.blank.replace(/\/_/, `/${top}/${bottom}`));
return msg.say({ files: [{ attachment: body, name: 'meme.jpg' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
diff --git a/commands/image-edit/osu-signature.js b/commands/image-edit/osu-signature.js
index 504642f6..40324813 100644
--- a/commands/image-edit/osu-signature.js
+++ b/commands/image-edit/osu-signature.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { list } = require('../../util/Util');
const colors = require('../../assets/json/osu-signature');
@@ -35,7 +35,7 @@ module.exports = class OsuSignatureCommand extends Command {
async run(msg, { user, color }) {
try {
- const { body, raw } = await snekfetch
+ const { body, raw } = await request
.get('https://lemmmy.pw/osusig/sig.php')
.query({
colour: color,
diff --git a/commands/image-edit/robohash.js b/commands/image-edit/robohash.js
index b00972eb..ea99bdca 100644
--- a/commands/image-edit/robohash.js
+++ b/commands/image-edit/robohash.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class RobohashCommand extends Command {
constructor(client) {
@@ -22,7 +22,7 @@ module.exports = class RobohashCommand extends Command {
async run(msg, { text }) {
try {
- const { body } = await snekfetch.get(`https://robohash.org/${text}`);
+ const { body } = await request.get(`https://robohash.org/${text}`);
return msg.say({ files: [{ attachment: body, name: 'robohash.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
diff --git a/commands/image-edit/sepia.js b/commands/image-edit/sepia.js
index 9f4f75a3..9b5b4ee3 100644
--- a/commands/image-edit/sepia.js
+++ b/commands/image-edit/sepia.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { sepia } = require('../../util/Canvas');
module.exports = class SepiaCommand extends Command {
@@ -28,7 +28,7 @@ module.exports = class SepiaCommand extends Command {
async run(msg, { image }) {
try {
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/shields-io-badge.js b/commands/image-edit/shields-io-badge.js
index f00421e3..4b00ec22 100644
--- a/commands/image-edit/shields-io-badge.js
+++ b/commands/image-edit/shields-io-badge.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class ShieldsIoBadgeCommand extends Command {
constructor(client) {
@@ -35,10 +35,10 @@ module.exports = class ShieldsIoBadgeCommand extends Command {
async run(msg, { subject, status, color }) {
try {
- const { body } = await snekfetch.get(`https://img.shields.io/badge/${subject}-${status}-${color}.png`);
+ const { body } = await request.get(`https://img.shields.io/badge/${subject}-${status}-${color}.png`);
return msg.say({ files: [{ attachment: body, name: 'badge.png' }] });
} catch (err) {
- if (err.statusCode === 404) return msg.reply('Could not create the badge...');
+ if (err.status === 404) return msg.reply('Could not create the badge...');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/image-edit/silhouette.js b/commands/image-edit/silhouette.js
index d1c2c4e9..78ef32f0 100644
--- a/commands/image-edit/silhouette.js
+++ b/commands/image-edit/silhouette.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { silhouette } = require('../../util/Canvas');
module.exports = class SilhouetteCommand extends Command {
@@ -28,7 +28,7 @@ module.exports = class SilhouetteCommand extends Command {
async run(msg, { image }) {
try {
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/image-edit/tint.js b/commands/image-edit/tint.js
index e911df02..9c515938 100644
--- a/commands/image-edit/tint.js
+++ b/commands/image-edit/tint.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { drawImageWithTint } = require('../../util/Canvas');
module.exports = class TintCommand extends Command {
@@ -34,7 +34,7 @@ module.exports = class TintCommand extends Command {
async run(msg, { color, image }) {
try {
- const { body } = await snekfetch.get(image);
+ const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
diff --git a/commands/number-edit/currency.js b/commands/number-edit/currency.js
index 14fbcf8f..f3f9a9c0 100644
--- a/commands/number-edit/currency.js
+++ b/commands/number-edit/currency.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { list } = require('../../util/Util');
const codes = require('../../assets/json/currency');
@@ -39,7 +39,7 @@ module.exports = class CurrencyCommand extends Command {
async run(msg, { base, target, amount }) {
if (base === target) return msg.say(`Converting ${base} to ${target} is the same value, dummy.`);
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://api.fixer.io/latest')
.query({
base,
diff --git a/commands/other/strawpoll.js b/commands/other/strawpoll.js
index 52489ce3..e4e81945 100644
--- a/commands/other/strawpoll.js
+++ b/commands/other/strawpoll.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class StrawpollCommand extends Command {
constructor(client) {
@@ -32,7 +32,7 @@ module.exports = class StrawpollCommand extends Command {
if (options.length < 2) return msg.reply('Please provide more than one choice.');
if (options.length > 31) return msg.reply('Please provide thirty or less choices.');
try {
- const { body } = await snekfetch
+ const { body } = await request
.post('https://www.strawpoll.me/api/v2/polls')
.set({ 'Content-Type': 'application/json' })
.send({ title, options });
diff --git a/commands/random/advice-slip.js b/commands/random/advice-slip.js
index 31fa031d..59d3763d 100644
--- a/commands/random/advice-slip.js
+++ b/commands/random/advice-slip.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class AdviceSlipCommand extends Command {
constructor(client) {
@@ -14,8 +14,8 @@ module.exports = class AdviceSlipCommand extends Command {
async run(msg) {
try {
- const { raw } = await snekfetch.get('http://api.adviceslip.com/advice');
- return msg.say(JSON.parse(raw.toString()).slip.advice);
+ const { text } = await request.get('http://api.adviceslip.com/advice');
+ return msg.say(JSON.parse(text).slip.advice);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
diff --git a/commands/random/cat.js b/commands/random/cat.js
index b91f0738..7a6556c6 100644
--- a/commands/random/cat.js
+++ b/commands/random/cat.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { THE_CAT_API_KEY } = process.env;
module.exports = class CatCommand extends Command {
@@ -16,7 +16,7 @@ module.exports = class CatCommand extends Command {
async run(msg) {
try {
- const { body, headers } = await snekfetch
+ const { body, headers } = await request
.get('http://thecatapi.com/api/images/get')
.query({ api_key: THE_CAT_API_KEY });
const format = headers['content-type'].replace(/image\//i, '');
diff --git a/commands/random/chuck-norris.js b/commands/random/chuck-norris.js
index 9b03b3de..f05ca2e1 100644
--- a/commands/random/chuck-norris.js
+++ b/commands/random/chuck-norris.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class ChuckNorrisCommand extends Command {
constructor(client) {
@@ -22,7 +22,7 @@ module.exports = class ChuckNorrisCommand extends Command {
async run(msg, { name }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://api.icndb.com/jokes/random')
.query({
escape: 'javascript',
diff --git a/commands/random/dog.js b/commands/random/dog.js
index 66cf3181..3f86c861 100644
--- a/commands/random/dog.js
+++ b/commands/random/dog.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class DogCommand extends Command {
constructor(client) {
@@ -15,7 +15,7 @@ module.exports = class DogCommand extends Command {
async run(msg) {
try {
- const { body } = await snekfetch.get('https://dog.ceo/api/breeds/image/random');
+ const { body } = await request.get('https://dog.ceo/api/breeds/image/random');
return msg.say({ files: [body.message] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
diff --git a/commands/random/fact.js b/commands/random/fact.js
index 112459a6..d0c3e574 100644
--- a/commands/random/fact.js
+++ b/commands/random/fact.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class FactCommand extends Command {
constructor(client) {
@@ -15,7 +15,7 @@ module.exports = class FactCommand extends Command {
async run(msg) {
try {
const article = await this.randomWikipediaArticle();
- const { body } = await snekfetch
+ const { body } = await request
.get('https://en.wikipedia.org/w/api.php')
.query({
action: 'query',
@@ -40,7 +40,7 @@ module.exports = class FactCommand extends Command {
}
async randomWikipediaArticle() {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://en.wikipedia.org/w/api.php')
.query({
action: 'query',
diff --git a/commands/random/new-york-times.js b/commands/random/new-york-times.js
index 5efbe891..6cf7e35c 100644
--- a/commands/random/new-york-times.js
+++ b/commands/random/new-york-times.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
const { NYTIMES_KEY } = process.env;
@@ -26,7 +26,7 @@ module.exports = class NewYorkTimesCommand extends Command {
async run(msg, { query }) {
try {
- const fetch = snekfetch
+ const fetch = request
.get('https://api.nytimes.com/svc/search/v2/articlesearch.json')
.query({
'api-key': NYTIMES_KEY,
diff --git a/commands/random/number-fact.js b/commands/random/number-fact.js
index 50135d38..846480ba 100644
--- a/commands/random/number-fact.js
+++ b/commands/random/number-fact.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class NumberFactCommand extends Command {
constructor(client) {
@@ -20,10 +20,10 @@ module.exports = class NumberFactCommand extends Command {
async run(msg, { number }) {
try {
- const { raw } = await snekfetch.get(`http://numbersapi.com/${number}`);
- return msg.say(raw.toString());
+ const { text } = await request.get(`http://numbersapi.com/${number}`);
+ return msg.say(text);
} catch (err) {
- if (err.statusCode === 404) return msg.say('Could not find any results.');
+ if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/random/reddit.js b/commands/random/reddit.js
index cbf9ddb5..28a675bd 100644
--- a/commands/random/reddit.js
+++ b/commands/random/reddit.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
module.exports = class RedditCommand extends Command {
@@ -23,7 +23,7 @@ module.exports = class RedditCommand extends Command {
async run(msg, { subreddit }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://www.reddit.com/r/${subreddit}/new.json`)
.query({ sort: 'new' });
const allowed = msg.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18);
@@ -37,8 +37,8 @@ module.exports = class RedditCommand extends Command {
⬇ ${post.downs}
`);
} catch (err) {
- if (err.statusCode === 403) return msg.say('This subreddit is private.');
- if (err.statusCode === 404) return msg.say('Could not find any results.');
+ if (err.status === 403) return msg.say('This subreddit is private.');
+ if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/random/shower-thought.js b/commands/random/shower-thought.js
index 2223d13a..6399eba3 100644
--- a/commands/random/shower-thought.js
+++ b/commands/random/shower-thought.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class ShowerThoughtCommand extends Command {
constructor(client) {
@@ -14,7 +14,7 @@ module.exports = class ShowerThoughtCommand extends Command {
async run(msg) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://www.reddit.com/r/Showerthoughts.json')
.query({ limit: 1000 });
const allowed = msg.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18);
diff --git a/commands/search/bulbapedia.js b/commands/search/bulbapedia.js
index 40fe0960..e4a40fb3 100644
--- a/commands/search/bulbapedia.js
+++ b/commands/search/bulbapedia.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
module.exports = class BulbapediaCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class BulbapediaCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://bulbapedia.bulbagarden.net/w/api.php')
.query({
action: 'query',
diff --git a/commands/search/danbooru.js b/commands/search/danbooru.js
index 9abbad4d..8b2d0173 100644
--- a/commands/search/danbooru.js
+++ b/commands/search/danbooru.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class DanbooruCommand extends Command {
constructor(client) {
@@ -27,7 +27,7 @@ module.exports = class DanbooruCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://danbooru.donmai.us/posts.json')
.query({
tags: `${query} order:random`,
diff --git a/commands/search/deviantart.js b/commands/search/deviantart.js
index a93a0d33..00de0b04 100644
--- a/commands/search/deviantart.js
+++ b/commands/search/deviantart.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { list } = require('../../util/Util');
const { DEVIANTART_ID, DEVIANTART_SECRET } = process.env;
const sections = ['dailydeviations', 'hot', 'newest', 'popular', 'undiscovered'];
@@ -35,7 +35,7 @@ module.exports = class DeviantartCommand extends Command {
async run(msg, { section, query }) {
try {
if (!this.token) await this.fetchToken();
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://www.deviantart.com/api/v1/oauth2/browse/${section}`)
.query({
q: query,
@@ -52,7 +52,7 @@ module.exports = class DeviantartCommand extends Command {
}
async fetchToken() {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://www.deviantart.com/oauth2/token')
.query({
grant_type: 'client_credentials',
diff --git a/commands/search/dictionary.js b/commands/search/dictionary.js
index c768db07..6852dd72 100644
--- a/commands/search/dictionary.js
+++ b/commands/search/dictionary.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
const { WORDNIK_KEY } = process.env;
@@ -24,7 +24,7 @@ module.exports = class DictionaryCommand extends Command {
async run(msg, { word }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get(`http://api.wordnik.com/v4/word.json/${word}/definitions`)
.query({
limit: 1,
diff --git a/commands/search/flickr.js b/commands/search/flickr.js
index 4eef725d..aee91322 100644
--- a/commands/search/flickr.js
+++ b/commands/search/flickr.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { FLICKR_KEY } = process.env;
module.exports = class FlickrCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class FlickrCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://api.flickr.com/services/rest/')
.query({
api_key: FLICKR_KEY,
diff --git a/commands/search/forecast.js b/commands/search/forecast.js
index d5bcbd70..3e00a1c2 100644
--- a/commands/search/forecast.js
+++ b/commands/search/forecast.js
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class ForecastCommand extends Command {
constructor(client) {
@@ -24,7 +24,7 @@ module.exports = class ForecastCommand extends Command {
async run(msg, { location }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://query.yahooapis.com/v1/public/yql')
.query({
// eslint-disable-next-line max-len
diff --git a/commands/search/gelbooru.js b/commands/search/gelbooru.js
index 4b01da03..d42db308 100644
--- a/commands/search/gelbooru.js
+++ b/commands/search/gelbooru.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class GelbooruCommand extends Command {
constructor(client) {
@@ -23,7 +23,7 @@ module.exports = class GelbooruCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://gelbooru.com/index.php')
.query({
page: 'dapi',
diff --git a/commands/search/giphy.js b/commands/search/giphy.js
index 34e95222..0792cdda 100644
--- a/commands/search/giphy.js
+++ b/commands/search/giphy.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { GIPHY_KEY } = process.env;
module.exports = class GiphyCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class GiphyCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://api.giphy.com/v1/gifs/search')
.query({
q: query,
diff --git a/commands/search/github.js b/commands/search/github.js
index 8b07d9f1..0a1ed337 100644
--- a/commands/search/github.js
+++ b/commands/search/github.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten, base64 } = require('../../util/Util');
const { GITHUB_USERNAME, GITHUB_PASSWORD } = process.env;
@@ -32,7 +32,7 @@ module.exports = class GithubCommand extends Command {
async run(msg, { author, repository }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://api.github.com/repos/${author}/${repository}`)
.set({ Authorization: `Basic ${base64(`${GITHUB_USERNAME}:${GITHUB_PASSWORD}`)}` });
const embed = new MessageEmbed()
@@ -50,7 +50,7 @@ module.exports = class GithubCommand extends Command {
.addField('❯ Modification Date', new Date(body.updated_at).toDateString(), true);
return msg.embed(embed);
} catch (err) {
- if (err.statusCode === 404) return msg.say('Could not find any results.');
+ if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/google-autofill.js b/commands/search/google-autofill.js
index b4e7c16b..e5637abb 100644
--- a/commands/search/google-autofill.js
+++ b/commands/search/google-autofill.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class GoogleAutofillCommand extends Command {
constructor(client) {
@@ -21,13 +21,13 @@ module.exports = class GoogleAutofillCommand extends Command {
async run(msg, { query }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://suggestqueries.google.com/complete/search')
.query({
client: 'firefox',
q: query
});
- const data = JSON.parse(raw.toString())[1];
+ const data = JSON.parse(text)[1];
if (!data.length) return msg.say('Could not find any results.');
return msg.say(data.join('\n'));
} catch (err) {
diff --git a/commands/search/google-book.js b/commands/search/google-book.js
index c69d4f5a..6d2f4c77 100644
--- a/commands/search/google-book.js
+++ b/commands/search/google-book.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
const { GOOGLE_KEY } = process.env;
@@ -25,7 +25,7 @@ module.exports = class GoogleBookCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://www.googleapis.com/books/v1/volumes')
.query({
apiKey: GOOGLE_KEY,
diff --git a/commands/search/google.js b/commands/search/google.js
index 9f5a0746..3bc20beb 100644
--- a/commands/search/google.js
+++ b/commands/search/google.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { GOOGLE_KEY, CUSTOM_SEARCH_ID } = process.env;
module.exports = class GoogleCommand extends Command {
@@ -26,7 +26,7 @@ module.exports = class GoogleCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://www.googleapis.com/customsearch/v1')
.query({
key: GOOGLE_KEY,
diff --git a/commands/search/gravatar.js b/commands/search/gravatar.js
index f9e56af3..41c5dcf0 100644
--- a/commands/search/gravatar.js
+++ b/commands/search/gravatar.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { hash } = require('../../util/Util');
module.exports = class GravatarCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class GravatarCommand extends Command {
async run(msg, { email }) {
const emailHash = hash(email, 'md5');
try {
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://www.gravatar.com/avatar/${emailHash}`)
.query({
size: 500,
@@ -33,7 +33,7 @@ module.exports = class GravatarCommand extends Command {
});
return msg.say({ files: [{ attachment: body, name: `${emailHash}.jpg` }] });
} catch (err) {
- if (err.statusCode === 404) return msg.say('Could not find any results.');
+ if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/http-cat.js b/commands/search/http-cat.js
index fad8559c..e707c519 100644
--- a/commands/search/http-cat.js
+++ b/commands/search/http-cat.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class HttpCatCommand extends Command {
constructor(client) {
@@ -21,7 +21,7 @@ module.exports = class HttpCatCommand extends Command {
async run(msg, { code }) {
try {
- const { body, headers } = await snekfetch.get(`https://http.cat/${code}.jpg`);
+ const { body, headers } = await request.get(`https://http.cat/${code}.jpg`);
if (headers['content-type'] === 'text/html') return msg.say('Could not find any results.');
return msg.say({ files: [{ attachment: body, name: `${code}.jpg` }] });
} catch (err) {
diff --git a/commands/search/imgur.js b/commands/search/imgur.js
index 00eafecc..efe3a296 100644
--- a/commands/search/imgur.js
+++ b/commands/search/imgur.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { IMGUR_KEY } = process.env;
module.exports = class ImgurCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class ImgurCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://api.imgur.com/3/gallery/search')
.query({ q: query })
.set({ Authorization: `Client-ID ${IMGUR_KEY}` });
diff --git a/commands/search/itunes.js b/commands/search/itunes.js
index 45022632..f2bbf277 100644
--- a/commands/search/itunes.js
+++ b/commands/search/itunes.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class ItunesCommand extends Command {
constructor(client) {
@@ -30,7 +30,7 @@ module.exports = class ItunesCommand extends Command {
async run(msg, { country, query }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://itunes.apple.com/search')
.query({
term: query,
@@ -40,7 +40,7 @@ module.exports = class ItunesCommand extends Command {
explicit: msg.channel.nsfw ? 'yes' : 'no',
country
});
- const body = JSON.parse(raw.toString());
+ const body = JSON.parse(text);
if (!body.results.length) return msg.say('Could not find any results.');
const data = body.results[0];
const embed = new MessageEmbed()
@@ -55,7 +55,7 @@ module.exports = class ItunesCommand extends Command {
.addField('❯ Genre', data.primaryGenreName, true);
return msg.embed(embed);
} catch (err) {
- if (err.statusCode === 400) {
+ if (err.status === 400) {
return msg.reply('Invalid country code. Refer to .');
}
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
diff --git a/commands/search/jisho.js b/commands/search/jisho.js
index d81a46b5..1aafffc1 100644
--- a/commands/search/jisho.js
+++ b/commands/search/jisho.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
module.exports = class JishoCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class JishoCommand extends Command {
async run(msg, { word }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://jisho.org/api/v1/search/words')
.query({ keyword: word });
if (!body.data.length) return msg.say('Could not find any results.');
diff --git a/commands/search/kickstarter.js b/commands/search/kickstarter.js
index f5b2a565..83adc00e 100644
--- a/commands/search/kickstarter.js
+++ b/commands/search/kickstarter.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
module.exports = class KickstarterCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class KickstarterCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://www.kickstarter.com/projects/search.json')
.query({
search: '',
diff --git a/commands/search/konachan.js b/commands/search/konachan.js
index f872ed4b..9b8d7c5b 100644
--- a/commands/search/konachan.js
+++ b/commands/search/konachan.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class KonachanCommand extends Command {
constructor(client) {
@@ -23,7 +23,7 @@ module.exports = class KonachanCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://konachan.net/post.json')
.query({
tags: `${query} order:random`,
diff --git a/commands/search/league-of-legends-champion.js b/commands/search/league-of-legends-champion.js
index 74cc7477..50ad5fed 100644
--- a/commands/search/league-of-legends-champion.js
+++ b/commands/search/league-of-legends-champion.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { RIOT_KEY } = process.env;
const buttons = ['Q', 'W', 'E', 'R'];
@@ -66,7 +66,7 @@ module.exports = class LeagueOfLegendsChampionCommand extends Command {
}
async fetchVersion() {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://na1.api.riotgames.com/lol/static-data/v3/versions')
.query({ api_key: RIOT_KEY });
[this.version] = body;
@@ -76,7 +76,7 @@ module.exports = class LeagueOfLegendsChampionCommand extends Command {
async fetchChampions() {
if (this.champions && this.champions.version === this.version) return this.champions;
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://ddragon.leagueoflegends.com/cdn/${this.version}/data/en_US/champion.json`);
this.champions = body;
return body;
@@ -87,7 +87,7 @@ module.exports = class LeagueOfLegendsChampionCommand extends Command {
const name = Object.keys(champions.data).find(key => key.toLowerCase() === champion);
if (!name) return null;
const { id } = champions.data[name];
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://ddragon.leagueoflegends.com/cdn/${this.version}/data/en_US/champion/${id}.json`);
return body.data[id];
}
diff --git a/commands/search/map.js b/commands/search/map.js
index 07f19d5a..04241d9d 100644
--- a/commands/search/map.js
+++ b/commands/search/map.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { GOOGLE_KEY } = process.env;
module.exports = class MapCommand extends Command {
@@ -35,7 +35,7 @@ module.exports = class MapCommand extends Command {
async run(msg, { zoom, location }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://maps.googleapis.com/maps/api/staticmap')
.query({
center: location,
diff --git a/commands/search/mdn.js b/commands/search/mdn.js
index f3aba39b..917081cf 100644
--- a/commands/search/mdn.js
+++ b/commands/search/mdn.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class MDNCommand extends Command {
constructor(client) {
@@ -24,7 +24,7 @@ module.exports = class MDNCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://developer.mozilla.org/en-US/search.json')
.query({
q: query,
diff --git a/commands/search/my-anime-list-anime.js b/commands/search/my-anime-list-anime.js
index c23d8d2c..2f3b69d0 100644
--- a/commands/search/my-anime-list-anime.js
+++ b/commands/search/my-anime-list-anime.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { parseString } = require('xml2js');
const { promisify } = require('util');
const xml = promisify(parseString);
@@ -28,11 +28,11 @@ module.exports = class MyAnimeListAnimeCommand extends Command {
async run(msg, { query }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://myanimelist.net/api/anime/search.xml')
.query({ q: query })
.set({ Authorization: `Basic ${base64(`${MAL_USERNAME}:${MAL_PASSWORD}`)}` });
- const body = await xml(raw.toString());
+ const body = await xml(text);
const data = body.anime.entry[0];
const embed = new MessageEmbed()
.setColor(0x2D54A2)
diff --git a/commands/search/my-anime-list-manga.js b/commands/search/my-anime-list-manga.js
index 4bec1441..77a1d400 100644
--- a/commands/search/my-anime-list-manga.js
+++ b/commands/search/my-anime-list-manga.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { parseString } = require('xml2js');
const { promisify } = require('util');
const xml = promisify(parseString);
@@ -28,11 +28,11 @@ module.exports = class MyAnimeListMangaCommand extends Command {
async run(msg, { query }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://myanimelist.net/api/manga/search.xml')
.query({ q: query })
.set({ Authorization: `Basic ${base64(`${MAL_USERNAME}:${MAL_PASSWORD}`)}` });
- const body = await xml(raw.toString());
+ const body = await xml(text);
const data = body.manga.entry[0];
const embed = new MessageEmbed()
.setColor(0x2D54A2)
diff --git a/commands/search/nasa.js b/commands/search/nasa.js
index b49f7a5a..9ff8d13b 100644
--- a/commands/search/nasa.js
+++ b/commands/search/nasa.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
module.exports = class NASACommand extends Command {
@@ -23,7 +23,7 @@ module.exports = class NASACommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://images-api.nasa.gov/search')
.query({
q: query,
diff --git a/commands/search/neopet.js b/commands/search/neopet.js
index 5a10cfe5..f2cd6d5e 100644
--- a/commands/search/neopet.js
+++ b/commands/search/neopet.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { list } = require('../../util/Util');
const moods = {
happy: 1,
@@ -40,14 +40,14 @@ module.exports = class NeopetCommand extends Command {
async run(msg, { pet, mood }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('http://www.sunnyneo.com/petimagefinder.php')
.query({
name: pet,
size: 5,
mood: moods[mood]
});
- const link = raw.toString().match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/);
+ const link = text.match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/);
if (!link) return msg.say('Could not find any results.');
return msg.say(link[0]);
} catch (err) {
diff --git a/commands/search/neopets-item.js b/commands/search/neopets-item.js
index e619816f..12b374b5 100644
--- a/commands/search/neopets-item.js
+++ b/commands/search/neopets-item.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { MessageEmbed } = require('discord.js');
module.exports = class NeopetsItemCommand extends Command {
@@ -40,18 +40,17 @@ module.exports = class NeopetsItemCommand extends Command {
}
async fetchItem(query) {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://items.jellyneo.net/search/')
.query({
name: query,
name_type: 3
});
- const text = raw.toString();
const id = text.match(/\/item\/([0-9]+)/);
if (!id) return null;
const price = text.match(/([0-9,]+) (NP|NC)/);
const url = `https://items.jellyneo.net/item/${id[1]}/`;
- const details = await snekfetch.get(url);
+ const details = await request.get(url);
const detailsText = details.raw.toString();
return {
id: id[1],
diff --git a/commands/search/npm.js b/commands/search/npm.js
index 0aa82e19..1cd97917 100644
--- a/commands/search/npm.js
+++ b/commands/search/npm.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { trimArray } = require('../../util/Util');
module.exports = class NPMCommand extends Command {
@@ -26,7 +26,7 @@ module.exports = class NPMCommand extends Command {
async run(msg, { pkg }) {
try {
- const { body } = await snekfetch.get(`https://registry.npmjs.com/${pkg}`);
+ const { body } = await request.get(`https://registry.npmjs.com/${pkg}`);
if (body.time.unpublished) return msg.say('This package no longer exists.');
const version = body.versions[body['dist-tags'].latest];
const maintainers = trimArray(body.maintainers.map(user => user.name));
@@ -47,7 +47,7 @@ module.exports = class NPMCommand extends Command {
.addField('❯ Maintainers', maintainers.join(', '));
return msg.embed(embed);
} catch (err) {
- if (err.statusCode === 404) return msg.say('Could not find any results.');
+ if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/osu.js b/commands/search/osu.js
index 3fc88606..a5e06a91 100644
--- a/commands/search/osu.js
+++ b/commands/search/osu.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { OSU_KEY } = process.env;
module.exports = class OsuCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class OsuCommand extends Command {
async run(msg, { user }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://osu.ppy.sh/api/get_user')
.query({
k: OSU_KEY,
diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js
index 8a0919db..c95ee301 100644
--- a/commands/search/pokedex.js
+++ b/commands/search/pokedex.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
module.exports = class PokedexCommand extends Command {
@@ -25,7 +25,7 @@ module.exports = class PokedexCommand extends Command {
async run(msg, { pokemon }) {
try {
- const { body } = await snekfetch.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
+ const { body } = await request.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
const id = body.id.toString().padStart(3, '0');
const embed = new MessageEmbed()
.setColor(0xED1C24)
@@ -41,7 +41,7 @@ module.exports = class PokedexCommand extends Command {
.setThumbnail(`https://www.serebii.net/sunmoon/pokemon/${id}.png`);
return msg.embed(embed);
} catch (err) {
- if (err.statusCode === 404) return msg.say('Could not find any results.');
+ if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/recipe.js b/commands/search/recipe.js
index faeb2a02..928f9808 100644
--- a/commands/search/recipe.js
+++ b/commands/search/recipe.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class RecipeCommand extends Command {
constructor(client) {
@@ -23,10 +23,10 @@ module.exports = class RecipeCommand extends Command {
async run(msg, { query }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('http://www.recipepuppy.com/api/')
.query({ q: query });
- const body = JSON.parse(raw.toString());
+ const body = JSON.parse(text);
if (!body.results.length) return msg.say('Could not find any results.');
const recipe = body.results[Math.floor(Math.random() * body.results.length)];
const embed = new MessageEmbed()
@@ -38,7 +38,7 @@ module.exports = class RecipeCommand extends Command {
.setThumbnail(recipe.thumbnail);
return msg.embed(embed);
} catch (err) {
- if (err.statusCode === 500) return msg.say('Could not find any results.');
+ if (err.status === 500) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/rotten-tomatoes.js b/commands/search/rotten-tomatoes.js
index 123fd066..869670b7 100644
--- a/commands/search/rotten-tomatoes.js
+++ b/commands/search/rotten-tomatoes.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
module.exports = class RottenTomatoesCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class RottenTomatoesCommand extends Command {
async run(msg, { query }) {
try {
- const search = await snekfetch
+ const search = await request
.get('https://www.rottentomatoes.com/api/private/v2.0/search/')
.query({
limit: 10,
@@ -33,8 +33,8 @@ module.exports = class RottenTomatoesCommand extends Command {
if (!search.body.movies.length) return msg.say('Could not find any results.');
const find = search.body.movies.find(m => m.name.toLowerCase() === query.toLowerCase()) || search.body.movies[0];
const urlID = find.url.replace('/m/', '');
- const { raw } = await snekfetch.get(`https://www.rottentomatoes.com/api/private/v1.0/movies/${urlID}`);
- const body = JSON.parse(raw.toString());
+ const { text } = await request.get(`https://www.rottentomatoes.com/api/private/v1.0/movies/${urlID}`);
+ const body = JSON.parse(text);
const criticScore = body.ratingSummary.allCritics;
const audienceScore = body.ratingSummary.audience;
const embed = new MessageEmbed()
diff --git a/commands/search/rule34.js b/commands/search/rule34.js
index 0f33320f..a13dcfc4 100644
--- a/commands/search/rule34.js
+++ b/commands/search/rule34.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class Rule34Command extends Command {
constructor(client) {
@@ -23,7 +23,7 @@ module.exports = class Rule34Command extends Command {
async run(msg, { query }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://rule34.xxx/index.php')
.query({
page: 'dapi',
@@ -33,7 +33,6 @@ module.exports = class Rule34Command extends Command {
tags: query,
limit: 200
});
- const text = raw.toString();
if (!text) return msg.say('Could not find any results.');
const body = JSON.parse(text);
const data = body[Math.floor(Math.random() * body.length)];
diff --git a/commands/search/safebooru.js b/commands/search/safebooru.js
index fdd17cfd..4260ed59 100644
--- a/commands/search/safebooru.js
+++ b/commands/search/safebooru.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class SafebooruCommand extends Command {
constructor(client) {
@@ -22,7 +22,7 @@ module.exports = class SafebooruCommand extends Command {
async run(msg, { query }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://safebooru.org/index.php')
.query({
page: 'dapi',
@@ -32,7 +32,6 @@ module.exports = class SafebooruCommand extends Command {
tags: query,
limit: 200
});
- const text = raw.toString();
if (!text) return msg.say('Could not find any results.');
const body = JSON.parse(text);
const data = body[Math.floor(Math.random() * body.length)];
diff --git a/commands/search/stack-overflow.js b/commands/search/stack-overflow.js
index d9d5d54b..f73dd0c2 100644
--- a/commands/search/stack-overflow.js
+++ b/commands/search/stack-overflow.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { STACKOVERFLOW_KEY } = process.env;
module.exports = class StackOverflowCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class StackOverflowCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://api.stackexchange.com/2.2/search/advanced')
.query({
page: 1,
diff --git a/commands/search/steam.js b/commands/search/steam.js
index e57cf5f8..05c6a31a 100644
--- a/commands/search/steam.js
+++ b/commands/search/steam.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class SteamCommand extends Command {
constructor(client) {
@@ -23,7 +23,7 @@ module.exports = class SteamCommand extends Command {
async run(msg, { query }) {
try {
- const search = await snekfetch
+ const search = await request
.get('https://store.steampowered.com/api/storesearch')
.query({
cc: 'us',
@@ -32,7 +32,7 @@ module.exports = class SteamCommand extends Command {
});
if (!search.body.items.length) return msg.say('Could not find any results.');
const { id, tiny_image } = search.body.items[0];
- const { body } = await snekfetch
+ const { body } = await request
.get('https://store.steampowered.com/api/appdetails')
.query({ appids: id });
const { data } = body[id.toString()];
diff --git a/commands/search/stocks.js b/commands/search/stocks.js
index fcb1cd89..2b5b9a6d 100644
--- a/commands/search/stocks.js
+++ b/commands/search/stocks.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { ALPHA_VANTAGE_KEY } = process.env;
module.exports = class StocksCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class StocksCommand extends Command {
async run(msg, { symbol }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://www.alphavantage.co/query')
.query({
function: 'TIME_SERIES_INTRADAY',
diff --git a/commands/search/tmdb-movie.js b/commands/search/tmdb-movie.js
index 8171fdbc..0522f160 100644
--- a/commands/search/tmdb-movie.js
+++ b/commands/search/tmdb-movie.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
const { TMDB_KEY } = process.env;
@@ -25,7 +25,7 @@ module.exports = class TMDBMovieCommand extends Command {
async run(msg, { query }) {
try {
- const search = await snekfetch
+ const search = await request
.get('http://api.themoviedb.org/3/search/movie')
.query({
api_key: TMDB_KEY,
@@ -33,7 +33,7 @@ module.exports = class TMDBMovieCommand extends Command {
query
});
if (!search.body.results.length) return msg.say('Could not find any results.');
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://api.themoviedb.org/3/movie/${search.body.results[0].id}`)
.query({ api_key: TMDB_KEY });
const embed = new MessageEmbed()
diff --git a/commands/search/tmdb-tv-show.js b/commands/search/tmdb-tv-show.js
index 5e1d04d7..8083d484 100644
--- a/commands/search/tmdb-tv-show.js
+++ b/commands/search/tmdb-tv-show.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
const { TMDB_KEY } = process.env;
@@ -25,7 +25,7 @@ module.exports = class TMDBTVShowCommand extends Command {
async run(msg, { query }) {
try {
- const search = await snekfetch
+ const search = await request
.get('http://api.themoviedb.org/3/search/tv')
.query({
api_key: TMDB_KEY,
@@ -33,7 +33,7 @@ module.exports = class TMDBTVShowCommand extends Command {
query
});
if (!search.body.results.length) return msg.say('Could not find any results.');
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://api.themoviedb.org/3/tv/${search.body.results[0].id}`)
.query({ api_key: TMDB_KEY });
const embed = new MessageEmbed()
diff --git a/commands/search/tumblr.js b/commands/search/tumblr.js
index 97c66815..34e7250d 100644
--- a/commands/search/tumblr.js
+++ b/commands/search/tumblr.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { TUMBLR_KEY } = process.env;
module.exports = class TumblrCommand extends Command {
@@ -25,7 +25,7 @@ module.exports = class TumblrCommand extends Command {
async run(msg, { blog }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://api.tumblr.com/v2/blog/${blog}/info`)
.query({ api_key: TUMBLR_KEY });
const data = body.response.blog;
@@ -39,7 +39,7 @@ module.exports = class TumblrCommand extends Command {
.addField('❯ A.M.A.?', data.ask ? 'Yes' : 'No', true);
return msg.embed(embed);
} catch (err) {
- if (err.statusCode === 404) return msg.say('Could not find any results.');
+ if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/twitter.js b/commands/search/twitter.js
index 633ce6d3..87793ac9 100644
--- a/commands/search/twitter.js
+++ b/commands/search/twitter.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { base64 } = require('../../util/Util');
const { TWITTER_KEY, TWITTER_SECRET } = process.env;
@@ -28,7 +28,7 @@ module.exports = class TwitterCommand extends Command {
async run(msg, { user }) {
try {
if (!this.token) await this.fetchToken();
- const { body } = await snekfetch
+ const { body } = await request
.get('https://api.twitter.com/1.1/users/show.json')
.set({ Authorization: `Bearer ${this.token}` })
.query({ screen_name: user });
@@ -48,14 +48,14 @@ module.exports = class TwitterCommand extends Command {
.addField('❯ Latest Tweet', body.status ? body.status.text : '???');
return msg.embed(embed);
} catch (err) {
- if (err.statusCode === 401) await this.fetchToken();
- if (err.statusCode === 404) return msg.say('Could not find any results.');
+ if (err.status === 401) await this.fetchToken();
+ if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
async fetchToken() {
- const { body } = await snekfetch
+ const { body } = await request
.post('https://api.twitter.com/oauth2/token')
.set({
Authorization: `Basic ${base64(`${TWITTER_KEY}:${TWITTER_SECRET}`)}`,
diff --git a/commands/search/urban-dictionary.js b/commands/search/urban-dictionary.js
index c34b2981..b8821b26 100644
--- a/commands/search/urban-dictionary.js
+++ b/commands/search/urban-dictionary.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
const types = ['random', 'top'];
@@ -34,7 +34,7 @@ module.exports = class UrbanDictionaryCommand extends Command {
async run(msg, { word, type }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://api.urbandictionary.com/v0/define')
.query({ term: word });
if (!body.list.length) return msg.say('Could not find any results.');
diff --git a/commands/search/vocaloid.js b/commands/search/vocaloid.js
index 1728e32f..bf34eee9 100644
--- a/commands/search/vocaloid.js
+++ b/commands/search/vocaloid.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
module.exports = class VocaloidCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class VocaloidCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://vocadb.net/api/songs')
.query({
query,
diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js
index c59445a2..bccfbe2e 100644
--- a/commands/search/wattpad.js
+++ b/commands/search/wattpad.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
const { WATTPAD_KEY } = process.env;
@@ -25,7 +25,7 @@ module.exports = class WattpadCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://api.wattpad.com/v4/stories')
.query({
query,
diff --git a/commands/search/weather.js b/commands/search/weather.js
index ad8a38d0..d1bf8d39 100644
--- a/commands/search/weather.js
+++ b/commands/search/weather.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class WeatherCommand extends Command {
constructor(client) {
@@ -23,7 +23,7 @@ module.exports = class WeatherCommand extends Command {
async run(msg, { location }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://query.yahooapis.com/v1/public/yql')
.query({
// eslint-disable-next-line max-len
diff --git a/commands/search/wikia.js b/commands/search/wikia.js
index d4763f9e..0bc6c249 100644
--- a/commands/search/wikia.js
+++ b/commands/search/wikia.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
module.exports = class WikiaCommand extends Command {
@@ -30,14 +30,14 @@ module.exports = class WikiaCommand extends Command {
async run(msg, { wiki, query }) {
try {
- const search = await snekfetch
+ const search = await request
.get(`http://${wiki}.wikia.com/api/v1/Search/List/`)
.query({
query,
limit: 1,
namespaces: 0
});
- const { body } = await snekfetch
+ const { body } = await request
.get(`http://${wiki}.wikia.com/api/v1/Articles/AsSimpleJson/`)
.query({ id: search.body.items[0].id });
const data = body.sections[0];
diff --git a/commands/search/wikihow.js b/commands/search/wikihow.js
index 81a09247..f3179d32 100644
--- a/commands/search/wikihow.js
+++ b/commands/search/wikihow.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
module.exports = class WikihowCommand extends Command {
@@ -23,7 +23,7 @@ module.exports = class WikihowCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://www.wikihow.com/api.php')
.query({
action: 'query',
diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js
index 015b3f49..b34d16c5 100644
--- a/commands/search/wikipedia.js
+++ b/commands/search/wikipedia.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { shorten } = require('../../util/Util');
module.exports = class WikipediaCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class WikipediaCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://en.wikipedia.org/w/api.php')
.query({
action: 'query',
diff --git a/commands/search/xkcd.js b/commands/search/xkcd.js
index e4aa8c75..97723ecb 100644
--- a/commands/search/xkcd.js
+++ b/commands/search/xkcd.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const types = ['random', 'today'];
module.exports = class XKCDCommand extends Command {
@@ -32,7 +32,7 @@ module.exports = class XKCDCommand extends Command {
async run(msg, { query }) {
try {
- const current = await snekfetch.get('https://xkcd.com/info.0.json');
+ const current = await request.get('https://xkcd.com/info.0.json');
if (query === 'today') {
const embed = new MessageEmbed()
.setTitle(`${current.body.num} - ${current.body.title}`)
@@ -44,7 +44,7 @@ module.exports = class XKCDCommand extends Command {
}
if (query === 'random') {
const random = Math.floor(Math.random() * current.body.num) + 1;
- const { body } = await snekfetch.get(`https://xkcd.com/${random}/info.0.json`);
+ const { body } = await request.get(`https://xkcd.com/${random}/info.0.json`);
const embed = new MessageEmbed()
.setTitle(`${body.num} - ${body.title}`)
.setColor(0x9797FF)
@@ -55,7 +55,7 @@ module.exports = class XKCDCommand extends Command {
}
const choice = Number.parseInt(query, 10);
if (current.body.num < choice) return msg.say('Could not find any results.');
- const { body } = await snekfetch.get(`https://xkcd.com/${choice}/info.0.json`);
+ const { body } = await request.get(`https://xkcd.com/${choice}/info.0.json`);
const embed = new MessageEmbed()
.setTitle(`${body.num} - ${body.title}`)
.setColor(0x9797FF)
diff --git a/commands/search/youtube.js b/commands/search/youtube.js
index f5ed35de..254115d9 100644
--- a/commands/search/youtube.js
+++ b/commands/search/youtube.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { GOOGLE_KEY } = process.env;
module.exports = class YoutubeCommand extends Command {
@@ -24,7 +24,7 @@ module.exports = class YoutubeCommand extends Command {
async run(msg, { query }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://www.googleapis.com/youtube/v3/search')
.query({
part: 'snippet',
diff --git a/commands/search/yu-gi-oh.js b/commands/search/yu-gi-oh.js
index 20f69e29..b30f56aa 100644
--- a/commands/search/yu-gi-oh.js
+++ b/commands/search/yu-gi-oh.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { stripIndents } = require('common-tags');
const { shorten } = require('../../util/Util');
@@ -25,10 +25,10 @@ module.exports = class YuGiOhCommand extends Command {
async run(msg, { card }) {
try {
- const { raw } = await snekfetch
+ const { text } = await request
.get('https://www.ygohub.com/api/card_info')
.query({ name: card });
- const body = JSON.parse(raw.toString());
+ const body = JSON.parse(text);
if (body.status === 'error') return msg.say('Could not find any results.');
const data = body.card;
const embed = new MessageEmbed()
diff --git a/commands/text-edit/cow-say.js b/commands/text-edit/cow-say.js
index 083d9260..b2202106 100644
--- a/commands/text-edit/cow-say.js
+++ b/commands/text-edit/cow-say.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class CowSayCommand extends Command {
constructor(client) {
@@ -21,7 +21,7 @@ module.exports = class CowSayCommand extends Command {
async run(msg, { text }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('http://cowsay.morecode.org/say')
.query({
message: text,
diff --git a/commands/text-edit/shorten-url.js b/commands/text-edit/shorten-url.js
index bfc3de49..2f899f13 100644
--- a/commands/text-edit/shorten-url.js
+++ b/commands/text-edit/shorten-url.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { GOOGLE_KEY } = process.env;
module.exports = class ShortenURLCommand extends Command {
@@ -22,7 +22,7 @@ module.exports = class ShortenURLCommand extends Command {
async run(msg, { url }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.post('https://www.googleapis.com/urlshortener/v1/url')
.query({ key: GOOGLE_KEY })
.send({ longUrl: url });
diff --git a/commands/text-edit/translate.js b/commands/text-edit/translate.js
index ee1d90a6..ebe7ac02 100644
--- a/commands/text-edit/translate.js
+++ b/commands/text-edit/translate.js
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { list } = require('../../util/Util');
const codes = require('../../assets/json/translate');
const { YANDEX_KEY } = process.env;
@@ -59,7 +59,7 @@ module.exports = class TranslateCommand extends Command {
async run(msg, { text, target, base }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://translate.yandex.net/api/v1.5/tr.json/translate')
.query({
key: YANDEX_KEY,
diff --git a/commands/text-edit/yoda.js b/commands/text-edit/yoda.js
index f8fc431b..685a3722 100644
--- a/commands/text-edit/yoda.js
+++ b/commands/text-edit/yoda.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { YODA_KEY } = process.env;
module.exports = class YodaCommand extends Command {
@@ -23,7 +23,7 @@ module.exports = class YodaCommand extends Command {
async run(msg, { sentence }) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.get('https://yoda-speak-api.herokuapp.com/')
.query({
text: sentence,
diff --git a/commands/voice/dec-talk.js b/commands/voice/dec-talk.js
index 2885c6d4..52228d08 100644
--- a/commands/voice/dec-talk.js
+++ b/commands/voice/dec-talk.js
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
-const snekfetch = require('snekfetch');
+const request = require('superagent');
module.exports = class DECTalkCommand extends Command {
constructor(client) {
@@ -35,9 +35,10 @@ module.exports = class DECTalkCommand extends Command {
if (this.client.voiceConnections.has(channel.guild.id)) return msg.say('I am already playing a sound.');
try {
const connection = await channel.join();
- const data = await snekfetch
- .get('http://tts.cyzon.us/tts', { redirect: false })
- .query({ text });
+ const data = await request
+ .get('http://tts.cyzon.us/tts')
+ .query({ text })
+ .redirects(0);
const dispatcher = connection.play(`http://tts.cyzon.us${data.headers.location}`);
dispatcher.once('finish', () => channel.leave());
dispatcher.once('error', () => channel.leave());
diff --git a/package.json b/package.json
index d89e7ffb..03129271 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"pg-hstore": "^2.3.2",
"random-js": "^1.0.8",
"sequelize": "^4.37.10",
- "snekfetch": "^4.0.1",
+ "superagent": "^3.8.3",
"uws": "^10.148.0",
"xml2js": "^0.4.19",
"zlib-sync": "^0.1.4"
diff --git a/util/BotList.js b/util/BotList.js
index b942e839..28083ef3 100644
--- a/util/BotList.js
+++ b/util/BotList.js
@@ -1,10 +1,10 @@
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const { DISCORD_BOTS_TOKEN } = process.env;
class BotListUtil {
static async discordBots(client) {
try {
- const { body } = await snekfetch
+ const { body } = await request
.post(`https://bots.discord.pw/api/bots/${client.user.id}/stats`)
.set({ Authorization: DISCORD_BOTS_TOKEN })
.send({ server_count: client.guilds.size });
diff --git a/util/Util.js b/util/Util.js
index 942f1554..87484763 100644
--- a/util/Util.js
+++ b/util/Util.js
@@ -1,4 +1,4 @@
-const snekfetch = require('snekfetch');
+const request = require('superagent');
const crypto = require('crypto');
const { IMGUR_KEY } = process.env;
const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea'];
@@ -60,7 +60,7 @@ class Util {
}
static async randomFromImgurAlbum(album) {
- const { body } = await snekfetch
+ const { body } = await request
.get(`https://api.imgur.com/3/album/${album}`)
.set({ Authorization: `Client-ID ${IMGUR_KEY}` });
if (!body.data.images.length) return null;