Compare commits

...

2 commits

Author SHA1 Message Date
f4ffcbebde
Use Date.now()
All checks were successful
CI / CI (push) Successful in 1m25s
2025-06-21 13:55:18 +02:00
2073a46715
Fix file check 2025-06-21 13:54:45 +02:00

View file

@ -9,8 +9,7 @@ module.exports = {
"Usage: <prefix>dl <url>" "Usage: <prefix>dl <url>"
], ],
async execute({message, args}) { async execute({message, args}) {
const downloadsDir = path.resolve(process.cwd(), 'data', 'downloads', Date.now().toString());
const downloadsDir = path.resolve(process.cwd(), 'data', 'downloads', Math.floor(new Date).toString());
const cookieFilepath = path.resolve(process.cwd(), 'data', 'cookies.txt') const cookieFilepath = path.resolve(process.cwd(), 'data', 'cookies.txt')
if(!fs.existsSync(cookieFilepath)) { if(!fs.existsSync(cookieFilepath)) {
message.channel.send("Some dependencies are needed for the command to work properly. Please let the bot's owner know.") message.channel.send("Some dependencies are needed for the command to work properly. Please let the bot's owner know.")
@ -46,7 +45,7 @@ module.exports = {
let files = fs.readdirSync(downloadsDir); let files = fs.readdirSync(downloadsDir);
if(files < 1) { if(files.length < 1) {
this.cleanUp(downloadsDir); this.cleanUp(downloadsDir);
originalMessage.edit("Something went wrong when downloading the video.") originalMessage.edit("Something went wrong when downloading the video.")
return; return;