Add gitreset command for resetting to master
Useful for my testing bot Usually I'd have to go log onto my server to reset, but now I can just use this command like a lazy person instead :)
This commit is contained in:
parent
52e832101f
commit
5deecaa788
1 changed files with 24 additions and 0 deletions
24
commands/admin/gitreset.js
Normal file
24
commands/admin/gitreset.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const fs = require('fs');
|
||||
const reloadCommands = require("../../util/reloadCommands");
|
||||
const convertDateToISOString = require("../../util/convertDateToISOString");
|
||||
|
||||
module.exports = {
|
||||
name: 'gitreset',
|
||||
description: 'Reset head to master, and reload commands',
|
||||
admin: true,
|
||||
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(sendText);
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue