Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
},
"parser": "@typescript-eslint/parser",
"parserOptions": { "ecmaVersion": 2018, "sourceType": "module" },

"ignorePatterns": ["dist/**"],

"rules": {
"no-extra-parens": ["warn", "all", {
"nestedBinaryExpressions": false
Expand Down
6 changes: 3 additions & 3 deletions config.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ export const PREFIX = config.PREFIX;
export const BLACKLIST = [config.BLACKLIST];

export const GITHUB_TOKEN = config.ENV_GITHUB_TOKEN;
export const APP_ID = config.APP_ID;
export const APP_KEY = config.APP_KEY;
export const MAP_KEY = config.MAP_KEY;
export const { APP_ID } = config;
export const { APP_KEY } = config;
export const { MAP_KEY } = config;

// eslint-disable-next-line prefer-destructuring
export const MONGO = config.MONGO;
108 changes: 52 additions & 56 deletions install-deps.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,62 @@
const { spawnSync } = require("child_process");
const path = require("path");
const { spawnSync } = require('child_process');
const path = require('path');
const os = process.platform;

const isWindows = process.platform === "win32";
const isWindows = process.platform === 'win32';

//Function to check if running as Administrator
// Function to check if running as Administrator
function isAdmin() {
if (!isWindows) return true;
const result = spawnSync("powershell.exe", [
"-NoProfile", "-ExecutionPolicy", "Bypass",
"-Command", "([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)"
], { encoding: "utf8" });
if (!isWindows) return true;
const result = spawnSync('powershell.exe', [
'-NoProfile', '-ExecutionPolicy', 'Bypass',
'-Command', '([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)'
], { encoding: 'utf8' });

return result.stdout.trim() === "True";
return result.stdout.trim() === 'True';
}

if (isWindows) {
console.log("🟣 Installing Windows dependencies...");

if (!isAdmin()) {
console.log("🔴 Not running as admin. Restarting as administrator...");

//Relaunch as admin to keep window open
const scriptPath = path.join(__dirname, "install-deps-windows.ps1");
const result = spawnSync("powershell.exe", [
"-NoProfile", "-ExecutionPolicy", "Bypass",
"-Command", `Start-Process powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File \\"${scriptPath}\\"' -Verb RunAs -Wait`
], { stdio: "inherit", shell: true });

if (result.error) {
console.error("⚠️ Failed to elevate PowerShell:", result.error);
process.exit(1);
}

console.log("✅ Dependency installation completed!");
process.exit(result.status);
}

//Run PowerShell script synchronously (when already elevated)
const scriptPath = path.join(__dirname, "install-deps-windows.ps1");
const result = spawnSync("powershell.exe", [
"-NoProfile", "-ExecutionPolicy", "Bypass",
"-File", scriptPath
], { stdio: "inherit", shell: true });

if (result.status !== 0) {
console.error("⚠️ PowerShell script failed with exit code:", result.status);
process.exit(1);
}

console.log("✅ Windows dependency installation complete.");

} else if (os === "linux") {
console.log("🟢 Installing Linux dependencies...");
spawnSync("bash", ["./install-deps-linux.sh"], { stdio: "inherit" });

} else if (os === "darwin") {
console.log("🍎 Installing macOS dependencies...");
spawnSync("bash", ["./install-deps-mac.sh"], { stdio: "inherit" });

console.log('🟣 Installing Windows dependencies...');

if (!isAdmin()) {
console.log('🔴 Not running as admin. Restarting as administrator...');

// Relaunch as admin to keep window open
const scriptPath = path.join(__dirname, 'install-deps-windows.ps1');
const result = spawnSync('powershell.exe', [
'-NoProfile', '-ExecutionPolicy', 'Bypass',
'-Command', `Start-Process powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File \\"${scriptPath}\\"' -Verb RunAs -Wait`
], { stdio: 'inherit', shell: true });

if (result.error) {
console.error('⚠️ Failed to elevate PowerShell:', result.error);
process.exit(1);
}

console.log('✅ Dependency installation completed!');
process.exit(result.status);
}

// Run PowerShell script synchronously (when already elevated)
const scriptPath = path.join(__dirname, 'install-deps-windows.ps1');
const result = spawnSync('powershell.exe', [
'-NoProfile', '-ExecutionPolicy', 'Bypass',
'-File', scriptPath
], { stdio: 'inherit', shell: true });

if (result.status !== 0) {
console.error('⚠️ PowerShell script failed with exit code:', result.status);
process.exit(1);
}

console.log('✅ Windows dependency installation complete.');
} else if (os === 'linux') {
console.log('🟢 Installing Linux dependencies...');
spawnSync('bash', ['./install-deps-linux.sh'], { stdio: 'inherit' });
} else if (os === 'darwin') {
console.log('🍎 Installing macOS dependencies...');
spawnSync('bash', ['./install-deps-mac.sh'], { stdio: 'inherit' });
} else {
console.log("❌ Unsupported OS detected.");
process.exit(1);

console.log('❌ Unsupported OS detected.');
process.exit(1);
}
2 changes: 2 additions & 0 deletions src/commands/jobs/jobform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const questions: string[] = [
];

export default class JobFormCommand extends Command {

name = 'jobform';
description = 'Starts a job preferences form via direct message.';
options: ApplicationCommandOptionData[] = [];
Expand Down Expand Up @@ -148,4 +149,5 @@ export default class JobFormCommand extends Command {
// start the first question
ask();
}

}
Loading