diff --git a/index.js b/index.js index d561b06..0198f61 100644 --- a/index.js +++ b/index.js @@ -72,7 +72,9 @@ 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 { @@ -80,12 +82,9 @@ 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'); } - // Force update by resetting to the latest commit on the remote main branch - await git.reset(['--hard', 'origin/main']); + await git.pull('origin', 'main'); console.log('Bot updated from GitHub.');