parent
6faa6aa040
commit
ead508ebc9
1 changed files with 3 additions and 4 deletions
7
index.js
7
index.js
|
@ -72,7 +72,9 @@ async function registerSlashCommands() {
|
||||||
// Call the async function to register slash commands
|
// Call the async function to register slash commands
|
||||||
registerSlashCommands();
|
registerSlashCommands();
|
||||||
|
|
||||||
|
// Function to update the bot from GitHub repository
|
||||||
async function updateBotFromGitHub() {
|
async function updateBotFromGitHub() {
|
||||||
|
|
||||||
const git = simpleGit(path.resolve(__dirname));
|
const git = simpleGit(path.resolve(__dirname));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -80,12 +82,9 @@ async function updateBotFromGitHub() {
|
||||||
|
|
||||||
if (!await git.checkIsRepo()) {
|
if (!await git.checkIsRepo()) {
|
||||||
await git.init().addRemote('origin', 'https://git.shadowhosting.xyz/shadowvr/AI_botter.git').fetch();
|
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.pull('origin', 'main');
|
||||||
await git.reset(['--hard', 'origin/main']);
|
|
||||||
|
|
||||||
console.log('Bot updated from GitHub.');
|
console.log('Bot updated from GitHub.');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue