Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Version Checks #154

Merged
merged 3 commits into from
Jun 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const { Client, Collection, GatewayIntentBits } = require("discord.js");
const { token } = require("./config/token.json");
const { QuickDB, MySQLDriver } = require("quick.db");
const jsonc = require("jsonc");
const { exec } = require("child_process");

process.on("unhandledRejection", (reason, promise, a) => {
console.log(reason, promise, a);
Expand All @@ -38,6 +39,15 @@ process.stdout.write(`
Connecting to Discord...
`);

exec("git fetch",()=>{
exec("git show origin/main --format=%h -s", (_,remHash) => {
exec("git show main --format=%h -s", (_, locHash) => {
if(remHash.toString() !== locHash.toString())
console.log("There is a new update available! Please run \"git pull\" to update the bot!");
});
});
});

const config = jsonc.parse(fs.readFileSync(path.join(__dirname, "config/config.jsonc"), "utf8"));

const client = new Client({
Expand Down