update rip.js to use node-fetch instead of request

This commit is contained in:
Emily 2020-04-30 13:32:19 +10:00
parent d07a680b77
commit def26feab3

View file

@ -1,12 +1,15 @@
var request = require('request'); const fetch = require('node-fetch');
const Discord = require("discord.js") const Discord = require("discord.js")
exports.run = (client, message) => { exports.run = (client, message) => {
message.channel.startTyping(); message.channel.startTyping();
var r = request.get('http://mityurl.com/y/yKsQ/r', function (err, res, body) { try{
var rip = r.uri.href fetch('http://mityurl.com/y/yKsQ/r', { redirect: 'follow' })
message.channel.send(`>:] ${rip}`) .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(); message.channel.stopTyping();
});
} }
exports.conf = { exports.conf = {