forked from Supositware/Haha-Yes
Fix command
This commit is contained in:
parent
f8f6684566
commit
d78b3a1e62
1 changed files with 3 additions and 2 deletions
|
@ -27,14 +27,15 @@ class removeytpCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(message, args) {
|
async exec(message, args) {
|
||||||
const hash = md5File.sync(args.filePath);
|
let filepath = `./asset/ytp/userVid/${args.messageID}.mp4`;
|
||||||
|
const hash = md5File.sync(filepath);
|
||||||
const ytphash = await ytpHash.findOne({where: {hash: hash}});
|
const ytphash = await ytpHash.findOne({where: {hash: hash}});
|
||||||
|
|
||||||
if (ytphash) {
|
if (ytphash) {
|
||||||
await ytpHash.destroy({where: {hash: hash}});
|
await ytpHash.destroy({where: {hash: hash}});
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.unlinkSync(`./asset/ytp/userVid/${args.messageID}.mp4`);
|
fs.unlinkSync(filepath);
|
||||||
return message.channel.send('Successfully removed the video.');
|
return message.channel.send('Successfully removed the video.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue