Move to snekfetch 🐍

This commit is contained in:
Daniel Odendahl Jr
2017-04-16 01:12:22 +00:00
parent 90d3e66e89
commit 8074fe51bd
36 changed files with 252 additions and 311 deletions
+3 -6
View File
@@ -1,6 +1,6 @@
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const request = require('superagent');
const snekfetch = require('snekfetch');
module.exports = class TodayCommand extends Command {
constructor(client) {
@@ -22,12 +22,9 @@ module.exports = class TodayCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
}
try {
const response = await request
const response = await snekfetch
.get('http://history.muffinlabs.com/date')
.set({
'Accept': 'application/json'
})
.buffer(true);
.buffer();
const parsedResponse = JSON.parse(response.text);
const events = parsedResponse.data.Events;
const randomNumber = Math.floor(Math.random() * events.length);