diff --git a/commands/ask.js b/commands/ask.js index 63f4e43..3295fe0 100644 --- a/commands/ask.js +++ b/commands/ask.js @@ -8,7 +8,7 @@ import { SlashCommandBuilder } from 'discord.js'; import axios from 'axios'; -import Command from '../utils/Command.js'; +import Command from '../utils/command.js'; const config = { webSearch: { diff --git a/commands/help.js b/commands/help.js index 9cf5712..1c6eec7 100644 --- a/commands/help.js +++ b/commands/help.js @@ -7,7 +7,7 @@ // (at your option) any later version. import { SlashCommandBuilder, EmbedBuilder } from 'discord.js'; -import Command from '../utils/Command.js'; +import Command from '../utils/command.js'; export default class HelpCommand extends Command { defineCommand() { diff --git a/commands/kick.js b/commands/kick.js index 0edfc7c..3f1a291 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -7,7 +7,7 @@ // (at your option) any later version. import { SlashCommandBuilder, PermissionFlagsBits } from 'discord.js'; -import Command from '../utils/Command.js'; +import Command from '../utils/command.js'; export default class KickCommand extends Command { defineCommand() { diff --git a/commands/ping.js b/commands/ping.js index d3a915c..2831b22 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -7,7 +7,7 @@ // (at your option) any later version. import { SlashCommandBuilder } from 'discord.js'; -import Command from '../utils/Command.js'; +import Command from '../utils/command.js'; export default class PingCommand extends Command { defineCommand() { diff --git a/commands/prune.js b/commands/prune.js index bd87b3f..5f3b6f1 100644 --- a/commands/prune.js +++ b/commands/prune.js @@ -7,7 +7,7 @@ // (at your option) any later version. import { SlashCommandBuilder, PermissionFlagsBits } from 'discord.js'; -import Command from '../utils/Command.js'; +import Command from '../utils/command.js'; export default class PruneCommand extends Command { defineCommand() { diff --git a/package.json b/package.json index b7e3a62..c74cf16 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "deploy": "node deploy-commands.js", "test": "jest", "test:watch": "jest --watch", - "test:coverage": "jest --coverage" + "test:coverage": "jest --coverage", + "deploy:ansible": "ansible-playbook -i inventory.ini playbook.yml" }, "keywords": [], "author": "", diff --git a/playbook.yml b/playbook.yml index 3d3d900..4d57323 100644 --- a/playbook.yml +++ b/playbook.yml @@ -4,12 +4,23 @@ become: yes # This enables sudo privileges vars: app_dir: /opt/kekbot - node_version: "20.x" # Latest LTS version + node_version: "22.x" # Latest LTS version tasks: + - name: Check if Node.js, npm, and git are installed + command: "which {{ item }}" + register: check_commands + with_items: + - node + - npm + - git + ignore_errors: yes + changed_when: false + - name: Install Node.js repository shell: | curl -fsSL https://deb.nodesource.com/setup_{{ node_version }} | bash - + when: check_commands.results | select('failed') | list | length > 0 - name: Install Node.js, npm, and git apt: @@ -19,6 +30,7 @@ - git state: present update_cache: yes + when: check_commands.results | select('failed') | list | length > 0 - name: Create application directory file: diff --git a/utils/command.js b/utils/command.js index 5ac7b3b..40ed4e3 100644 --- a/utils/command.js +++ b/utils/command.js @@ -1,4 +1,4 @@ -// utils/Command.js - Base command class for Discord bot commands +// utils/command.js - Base command class for Discord bot commands // Copyright (C) 2025 Luis Bauza // // This program is free software: you can redistribute it and/or modify diff --git a/utils/commandLoader.js b/utils/commandLoader.js index 534419c..a00ebac 100644 --- a/utils/commandLoader.js +++ b/utils/commandLoader.js @@ -25,7 +25,7 @@ export async function loadCommands(commandsPath, logger) { const commandModule = await import(filePath); const Command = commandModule.default; - const CommandBase = (await import('./Command.js')).default; + const CommandBase = (await import('./command.js')).default; if (Command.prototype instanceof CommandBase) { // New style - class extending Command const commandInstance = new Command();