Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Loïc Bersier
Haha Yes
Commits
b2062cdf
Commit
b2062cdf
authored
Feb 04, 2021
by
Loïc Bersier
😎
Browse files
Use Hapi when possible
Signed-off-by:
loicbersier
<
loic.bersier1@gmail.com
>
parent
c33c3299
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
14 deletions
+2
-14
commands/utility/download.js
commands/utility/download.js
+2
-14
No files found.
commands/utility/download.js
View file @
b2062cdf
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment