Skip to content

Commit

Permalink
feat: restart command designed for pm2
Browse files Browse the repository at this point in the history
  • Loading branch information
kk committed Feb 27, 2023
1 parent 5c535f1 commit 28657a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/commands/misc/NameAvailabile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NameAvailableCommand extends CommandBase {
this.getBotInstance().getMineflayerInstance().chat("This name is available.");
} else if (status == 200) {
const cachedAt = new Date(data.data.player.meta.cached_at);
this.getBotInstance().getMineflayerInstance().chat(`[${ cachedAt.toLocaleString() }] ${ data.data.player.username } is unavailable.`);
this.getBotInstance().getMineflayerInstance().chat(`[${cachedAt.toLocaleString()}] ${data.data.player.username} is unavailable.`);
} else {
this.getBotInstance().getMineflayerInstance().chat(`There was an error with this request, please try again later. Code: ${status} | Response: ${data}`);
}
Expand Down
3 changes: 2 additions & 1 deletion src/discord/RestartBot.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { ChatInputCommandInteraction, Client } from "discord.js";
import { exit } from "process";

const RestartBot = async (client: Client, interaction: ChatInputCommandInteraction): Promise<void> => {
if (interaction.commandName == "restart") {
// This type of restart is designed to be used with PM2.
process.exitCode = 0;
exit(0);
}
};

Expand Down

0 comments on commit 28657a6

Please sign in to comment.