From 2a14a78fbf697b4b5c5915a61110cfd6e2b39c36 Mon Sep 17 00:00:00 2001 From: ShadowVR Date: Fri, 31 May 2024 16:36:15 -0400 Subject: [PATCH] Updated index.js --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 357d823..12a2042 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,5 @@ + + const Discord = require('discord.js'); const chalk = require('chalk'); const fs = require('node:fs'); @@ -71,9 +73,7 @@ async function registerSlashCommands() { // Call the async function to register slash commands registerSlashCommands(); -// Function to update the bot from GitHub repository async function updateBotFromGitHub() { - const git = simpleGit(path.resolve(__dirname)); try { @@ -81,9 +81,12 @@ async function updateBotFromGitHub() { if (!await git.checkIsRepo()) { await git.init().addRemote('origin', 'https://git.shadowhosting.xyz/shadowvr/AI_botter.git').fetch(); + } else { + await git.fetch('origin', 'main'); } - await git.pull('origin', 'main'); + // Force update by resetting to the latest commit on the remote main branch + await git.reset(['--hard', 'origin/main']); console.log('Bot updated from GitHub. Restarting...');