Fix gitreset

This commit is contained in:
SileNce5k 2022-06-12 12:01:41 +02:00
parent 5feaa89583
commit a34f08a1a2
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -9,16 +9,14 @@ module.exports = {
execute({message, client}) {
let cmd = "git reset --hard master";
const exec = require("child_process").exec;
let sendText = "";
exec(cmd, (err, stdout, stderr) => {
reloadCommands(client);
sendText = `${stdout}\nCommands reloaded`;
if(err){
fs.writeFileSync("../../data/log.txt", `${convertDateToISOString(new Date())}\n${stderr}\n`, {flag: 'a'});
sendText = `Something went wrong, check data/log.txt for more information`;
message.channel.send(`Something went wrong, check data/log.txt for more information`);
return;
}
reloadCommands(client);
message.channel.send(`${stdout}\nCommands reloaded`);
});
message.channel.send(sendText);
}
};