Commit b2062cdf authored by Loïc Bersier's avatar Loïc Bersier 😎
Browse files

Use Hapi when possible


Signed-off-by: Loïc Bersier's avatarloicbersier <loic.bersier1@gmail.com>
parent c33c3299
const { Command } = require('discord-akairo');
const downloader = require('../../utils/download');
const compress = require('../../utils/compress');
const { proxy } = require('../../config.json');
const { proxy, Hapi } = require('../../config.json');
const os = require('os');
const fs = require('fs');
const fetch = require('node-fetch');
class DownloadCommand extends Command {
constructor() {
......@@ -71,8 +72,6 @@ class DownloadCommand extends Command {
}
if (!args.link) return message.channel.send('Please try again with a valid URL.');
let loadingmsg = await message.channel.send('Downloading <a:loadingmin:527579785212329984>');
let filename = `${message.id}_video`;
if (args.proxy && !args.proxyAuto) { // args.proxyAuto is only provided when the command is run after a error 429
......@@ -84,12 +83,6 @@ class DownloadCommand extends Command {
filename = `SPOILER_${message.id}_video`;
}
const Embed = this.client.util.embed()
.setColor(message.member ? message.member.displayHexColor : 'NAVY')
.setAuthor(`Downloaded by ${message.author.username}`, message.author.displayAvatarURL(), args.link)
.setDescription(args.caption ? args.caption : '')
.setFooter(`You can get the original video by clicking on the "downloaded by ${message.author.username}" message!`);
downloader(args.link.href, args.proxy != null ? ['--proxy', proxy[args.proxy].ip] : null, `${os.tmpdir()}/${filename}.mp4`)
.on('error', async err => {
if (err.includes('HTTP Error 429: Too Many Requests')) {
......@@ -116,11 +109,6 @@ class DownloadCommand extends Command {
if (fileSize > 8) {
loadingmsg.delete();
let compressEmbed = this.client.util.embed()
.setColor(message.member ? message.member.displayHexColor : 'NAVY')
.setTitle('This one will need compression!')
.setDescription('Starting compression now!')
.setFooter('Want it to go faster? Donate to the dev with the donate command, so i can get a better server and do it faster!');
let compressmsg = await message.channel.send(compressEmbed);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment