Skip to content
Merged
Changes from all commits
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
18 changes: 13 additions & 5 deletions classes/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,33 @@ export class App {
public deploy(bot: DBbot): void {
this.generateConfigFile(bot);

// Resolve the full path to deploy.sh relative to this file
const scriptPath = path.resolve(__dirname, "..", "deploy.sh");

// Check if the script exists
if (!fs.existsSync(scriptPath)) {
console.error("deploy.sh not found at:", scriptPath);
return;
}

let shell: string;
let args: string[];

if (process.platform === "win32") {
// Try Git Bash path (adjust if needed)
// Git Bash (adjust path if needed)
shell = "C:\\Program Files\\Git\\bin\\bash.exe";
args = ["deploy.sh"];
args = [scriptPath];
} else {
shell = "sh";
args = ["deploy.sh"];
args = [scriptPath];
}

const child = spawn(shell, args, {
cwd: process.cwd(),
stdio: "inherit",
});

child.on("error", (error) => {
console.error("Error while deploying the bot:", error);
});
}
}
}