mrmBot-Matrix/commands/general/restart.js

26 lines
698 B
JavaScript
Raw Normal View History

2023-03-15 14:09:09 +00:00
import Command from "../../classes/command.js";
class RestartCommand extends Command {
2023-03-19 05:10:48 +00:00
static category = "general"
2023-03-15 14:09:09 +00:00
async run() {
const owners = process.env.OWNER.split(",");
2023-03-15 14:12:35 +00:00
if (!owners.includes(this.author)) {
2023-03-15 14:09:09 +00:00
this.success = false;
return "Only the bot owner can restart me!";
}
2023-03-15 14:45:14 +00:00
const content = {
body: "mrmBot is restarting",
msgtype: "m.text",
};
2023-03-15 14:47:39 +00:00
this.client.sendEvent(this.channel, "m.room.message", content, "", (err, res) => {
2023-03-15 14:45:14 +00:00
console.log(err);
});
2023-03-15 14:09:09 +00:00
process.exit(1);
}
static description = "Restarts me";
static aliases = ["reboot"];
static adminOnly = true;
}
export default RestartCommand;