From 44d24024d87470a53112907c7d0baf1944e5923e Mon Sep 17 00:00:00 2001 From: Taken Date: Thu, 30 Nov 2023 15:58:04 +0100 Subject: [PATCH 1/3] Updated dev deploy and unban command --- scripts/dev-deploy.js | 26 ++++++++++++++++++++------ src/commands/unban.js | 5 +++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/scripts/dev-deploy.js b/scripts/dev-deploy.js index cbaa84a..5cd42b4 100644 --- a/scripts/dev-deploy.js +++ b/scripts/dev-deploy.js @@ -3,17 +3,31 @@ require("dotenv").config() const token = process.env.DEVTOKEN const clientId = process.env.DEVID const guildId = process.env.GUILDID +const fs = require("fs") const rest = new REST({ version: "10" }).setToken(token) const commands = [] -const commandFiles = [ - "../commands/config.js", - "../commands/setup.js", -] +const commandFiles = fs.readdirSync("./src/commands/").filter(file => file.endsWith(".js")) +const contentMenuCommands = fs.readdirSync("./src/commands-contextmenu/").filter(file => file.endsWith(".js")) +const commandsTesting = fs.readdirSync("./src/commands-testing/").filter(file => file.endsWith(".js")) for (const file of commandFiles) { - const command = require(`${file}`) - commands.push(command.data.toJSON()) + const command = require(`../src/commands/${file}`) + if (command.dev) { + commands.push(command.data.toJSON()) + } +} +for (const file of contentMenuCommands) { + const command = require(`../src/commands-contextmenu/${file}`) + if (command.dev) { + commands.push(command.data.toJSON()) + } +} +for (const file of commandsTesting) { + const command = require(`../src/commands-testing/${file}`) + if (command.dev) { + commands.push(command.data.toJSON()) + } } (async () => { diff --git a/src/commands/unban.js b/src/commands/unban.js index ef30b60..d4a4636 100644 --- a/src/commands/unban.js +++ b/src/commands/unban.js @@ -5,7 +5,6 @@ module.exports = { name: "unban", description: "Unban a user from the server", type: "slash", - dev: true, data: new SlashCommandBuilder() .setName("unban") @@ -22,7 +21,9 @@ module.exports = { .setName("reason") .setDescription("The reason for unbanning the user") .setRequired(false) - ), + ) + .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) + .setDMPermission(false), /** @param { import("discord.js").ChatInputCommandInteraction } interaction */ From dcacf824d9b169bb6ead9f764c8c01acd2059269 Mon Sep 17 00:00:00 2001 From: Taken Date: Thu, 30 Nov 2023 16:09:18 +0100 Subject: [PATCH 2/3] Bug fix commands in dms --- src/commands/check.js | 7 +++---- src/commands/guild.js | 7 +++---- src/commands/guild/info.js | 4 ++-- src/commands/guild/member.js | 4 ++-- src/commands/help.js | 4 ++-- src/commands/ping.js | 4 ++-- src/commands/reqs.js | 4 ++-- src/commands/uuid.js | 4 ++-- 8 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/commands/check.js b/src/commands/check.js index 094e97a..eb28983 100644 --- a/src/commands/check.js +++ b/src/commands/check.js @@ -13,8 +13,7 @@ module.exports = { .setDescription("Check a player's stats.") .addStringOption((option) => option.setName("ign") .setDescription("The player's IGN.") - .setRequired(true)) - .setDMPermission(false), + .setRequired(true)), /** @param { import('discord.js').ChatInputCommandInteraction } interaction */ @@ -216,8 +215,8 @@ module.exports = { url: head }, footer: { - text: interaction.guild.name + " | " + devMessage, - icon_url: interaction.guild.iconURL() + text: interaction?.guild.name || interaction.user.username + " | " + devMessage, + icon_url: interaction?.guild.iconURL() || interaction.user.avatarURL() }, fields: statsFields }] diff --git a/src/commands/guild.js b/src/commands/guild.js index 86e9834..3c91a90 100644 --- a/src/commands/guild.js +++ b/src/commands/guild.js @@ -32,8 +32,7 @@ module.exports = { .setDescription("The IGN of a member.") .setRequired(true) ) - ) - .setDMPermission(false), + ), /** @param { import('discord.js').ChatInputCommandInteraction } interaction */ @@ -59,8 +58,8 @@ module.exports = { description: "This command is currently under development", color: embedColor, footer: { - text: interaction.guild.name + " | " + devMessage, - icon_url: interaction.guild.iconURL({ dynamic: true }) + text: interaction?.guild.name || interaction.user.username + " | " + devMessage, + icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }) } }] }) diff --git a/src/commands/guild/info.js b/src/commands/guild/info.js index a546646..7359e81 100644 --- a/src/commands/guild/info.js +++ b/src/commands/guild/info.js @@ -95,8 +95,8 @@ async function guildInfo(interaction) { ], color: embedColor, footer: { - text: interaction.guild.name + " | " + devMessage, - icon_url: interaction.guild.iconURL({ dynamic: true }) + text: interaction?.guild.name || interaction.user.username + " | " + devMessage, + icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }) } }] }) diff --git a/src/commands/guild/member.js b/src/commands/guild/member.js index c1ea205..9fd03e9 100644 --- a/src/commands/guild/member.js +++ b/src/commands/guild/member.js @@ -32,8 +32,8 @@ async function guildMember(interaction) { url: head, }, footer: { - text: interaction.guild.name + " | " + devMessage, - icon_url: interaction.guild.iconURL({ dynamic: true }), + text: interaction?.guild.name || interaction.user.username + " | " + devMessage, + icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }), }, }, ], diff --git a/src/commands/help.js b/src/commands/help.js index 3fb0d7a..2c8bf80 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -46,8 +46,8 @@ module.exports = { url: interaction.guild.iconURL({ dynamic: true }) }, footer: { - icon_url: interaction.guild.iconURL({ dynamic: true }), - text: interaction.guild.name + " | " + devMessage + icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }), + text: interaction?.guild.name || interaction.user.username + " | " + devMessage } }] }) diff --git a/src/commands/ping.js b/src/commands/ping.js index 49f3efb..7a4901e 100644 --- a/src/commands/ping.js +++ b/src/commands/ping.js @@ -27,8 +27,8 @@ module.exports = { description: "Ping of the bot is " + client.ws.ping + "ms.", color: embedColor, footer: { - text: interaction.guild.name, - icon_url: interaction.guild.iconURL({ dynamic: true }) + text: interaction?.guild.name || interaction.user.username, + icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }) }, timestamp: new Date() }] diff --git a/src/commands/reqs.js b/src/commands/reqs.js index 9d4f25c..93b91bd 100644 --- a/src/commands/reqs.js +++ b/src/commands/reqs.js @@ -44,8 +44,8 @@ module.exports = { } ], footer: { - text: interaction.guild.name + " | " + devMessage, - icon_url: interaction.guild.iconURL() + text: interaction?.guild.name || interaction.user.username + " | " + devMessage, + icon_url: interaction?.guild.iconURL() || interaction.user.avatarURL() } }] }) diff --git a/src/commands/uuid.js b/src/commands/uuid.js index f071b23..f88d194 100644 --- a/src/commands/uuid.js +++ b/src/commands/uuid.js @@ -47,8 +47,8 @@ module.exports = { url: head }, footer: { - text: interaction.guild.name + " | " + devMessage, - icon_url: interaction.guild.iconURL({ dynamic: true }) + text: interaction?.guild.name || interaction.user.username + " | " + devMessage, + icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }) } }] }) From b43391ae719149bf37e295d7939bc21a93d9c537 Mon Sep 17 00:00:00 2001 From: Taken Date: Thu, 30 Nov 2023 16:12:27 +0100 Subject: [PATCH 3/3] Updated docker compose file --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 1156cb1..ef51880 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: container_name: illegitimate build: https://gitlab.com/illegitimate/illegitimate-bot.git#main image: illegitimate:latest + restart: unless-stopped environment: - TOKEN=${TOKEN} - MONGOURI=${MONGOURI}