|
|
@ -2,6 +2,7 @@ const { Command } = require('discord-akairo');
|
|
|
|
const YTPGenerator = require('ytpplus-node');
|
|
|
|
const YTPGenerator = require('ytpplus-node');
|
|
|
|
const os = require('os');
|
|
|
|
const os = require('os');
|
|
|
|
const fs = require('fs');
|
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
const attachment = require('../../utils/attachment');
|
|
|
|
const downloader = require('../../utils/download');
|
|
|
|
const downloader = require('../../utils/download');
|
|
|
|
const md5File = require('md5-file');
|
|
|
|
const md5File = require('md5-file');
|
|
|
|
const ytpHash = require('../../models').ytpHash;
|
|
|
|
const ytpHash = require('../../models').ytpHash;
|
|
|
@ -99,11 +100,18 @@ class ytpCommand extends Command {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'link',
|
|
|
|
id: 'link',
|
|
|
|
type: 'string'
|
|
|
|
type: 'url',
|
|
|
|
|
|
|
|
prompt: {
|
|
|
|
|
|
|
|
start: 'Please send the URL of which video you want to download. Say `cancel` to stop the command',
|
|
|
|
|
|
|
|
retry: 'Please send a valid URL of the video you want to download. Say `cancel` to stop the command',
|
|
|
|
|
|
|
|
optional: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
unordered: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'max',
|
|
|
|
id: 'max',
|
|
|
|
type: 'string'
|
|
|
|
type: 'string',
|
|
|
|
|
|
|
|
unordered: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
description: {
|
|
|
|
description: {
|
|
|
@ -128,12 +136,12 @@ class ytpCommand extends Command {
|
|
|
|
|
|
|
|
|
|
|
|
if (args.add) {
|
|
|
|
if (args.add) {
|
|
|
|
let loadingmsg = await message.channel.send('Downloading <a:loadingmin:527579785212329984>');
|
|
|
|
let loadingmsg = await message.channel.send('Downloading <a:loadingmin:527579785212329984>');
|
|
|
|
let Attachment = (message.attachments).array();
|
|
|
|
let url;
|
|
|
|
let url = args.link;
|
|
|
|
|
|
|
|
// Get attachment link
|
|
|
|
if (args.link)
|
|
|
|
if (Attachment[0] && !args.link) {
|
|
|
|
url = args.link.href;
|
|
|
|
url = Attachment[0].url;
|
|
|
|
else
|
|
|
|
}
|
|
|
|
url = await attachment(message);
|
|
|
|
|
|
|
|
|
|
|
|
if (url) {
|
|
|
|
if (url) {
|
|
|
|
return downloader(url, ['--format=mp4'], `./asset/ytp/userVid/${message.id}.mp4`)
|
|
|
|
return downloader(url, ['--format=mp4'], `./asset/ytp/userVid/${message.id}.mp4`)
|
|
|
|