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...');