From def26feab35054802c806bc84fde0f358cee7430 Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Thu, 30 Apr 2020 13:32:19 +1000 Subject: [PATCH] update rip.js to use node-fetch instead of request --- src/commands/rip.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/commands/rip.js b/src/commands/rip.js index d677655..968e08a 100644 --- a/src/commands/rip.js +++ b/src/commands/rip.js @@ -1,12 +1,15 @@ -var request = require('request'); +const fetch = require('node-fetch'); const Discord = require("discord.js") exports.run = (client, message) => { message.channel.startTyping(); - var r = request.get('http://mityurl.com/y/yKsQ/r', function (err, res, body) { - var rip = r.uri.href - message.channel.send(`>:] ${rip}`) - message.channel.stopTyping(); - }); + try{ + fetch('http://mityurl.com/y/yKsQ/r', { redirect: 'follow' }) + .then(res => res) + .then(res => message.channel.send(`>:] ${res.url}`)) + } catch(err) { + message.channel.send(`<:error:466995152976871434> An error has occurred: ${err}`); + }; + message.channel.stopTyping(); } exports.conf = {