Merge branch 'dev' into 'main'

Dev

See merge request illegitimate/illegitimate-bot!106
This commit is contained in:
2023-11-30 15:13:10 +00:00
11 changed files with 42 additions and 28 deletions

View File

@@ -4,6 +4,7 @@ services:
container_name: illegitimate container_name: illegitimate
build: https://gitlab.com/illegitimate/illegitimate-bot.git#main build: https://gitlab.com/illegitimate/illegitimate-bot.git#main
image: illegitimate:latest image: illegitimate:latest
restart: unless-stopped
environment: environment:
- TOKEN=${TOKEN} - TOKEN=${TOKEN}
- MONGOURI=${MONGOURI} - MONGOURI=${MONGOURI}

View File

@@ -3,17 +3,31 @@ require("dotenv").config()
const token = process.env.DEVTOKEN const token = process.env.DEVTOKEN
const clientId = process.env.DEVID const clientId = process.env.DEVID
const guildId = process.env.GUILDID const guildId = process.env.GUILDID
const fs = require("fs")
const rest = new REST({ version: "10" }).setToken(token) const rest = new REST({ version: "10" }).setToken(token)
const commands = [] const commands = []
const commandFiles = [ const commandFiles = fs.readdirSync("./src/commands/").filter(file => file.endsWith(".js"))
"../commands/config.js", const contentMenuCommands = fs.readdirSync("./src/commands-contextmenu/").filter(file => file.endsWith(".js"))
"../commands/setup.js", const commandsTesting = fs.readdirSync("./src/commands-testing/").filter(file => file.endsWith(".js"))
]
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`${file}`) const command = require(`../src/commands/${file}`)
commands.push(command.data.toJSON()) 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 () => { (async () => {

View File

@@ -13,8 +13,7 @@ module.exports = {
.setDescription("Check a player's stats.") .setDescription("Check a player's stats.")
.addStringOption((option) => option.setName("ign") .addStringOption((option) => option.setName("ign")
.setDescription("The player's IGN.") .setDescription("The player's IGN.")
.setRequired(true)) .setRequired(true)),
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */ /** @param { import('discord.js').ChatInputCommandInteraction } interaction */
@@ -216,8 +215,8 @@ module.exports = {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | " + devMessage, text: interaction?.guild.name || interaction.user.username + " | " + devMessage,
icon_url: interaction.guild.iconURL() icon_url: interaction?.guild.iconURL() || interaction.user.avatarURL()
}, },
fields: statsFields fields: statsFields
}] }]

View File

@@ -32,8 +32,7 @@ module.exports = {
.setDescription("The IGN of a member.") .setDescription("The IGN of a member.")
.setRequired(true) .setRequired(true)
) )
) ),
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */ /** @param { import('discord.js').ChatInputCommandInteraction } interaction */
@@ -59,8 +58,8 @@ module.exports = {
description: "This command is currently under development", description: "This command is currently under development",
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild.name + " | " + devMessage, text: interaction?.guild.name || interaction.user.username + " | " + devMessage,
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true })
} }
}] }]
}) })

View File

@@ -95,8 +95,8 @@ async function guildInfo(interaction) {
], ],
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild.name + " | " + devMessage, text: interaction?.guild.name || interaction.user.username + " | " + devMessage,
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true })
} }
}] }]
}) })

View File

@@ -32,8 +32,8 @@ async function guildMember(interaction) {
url: head, url: head,
}, },
footer: { footer: {
text: interaction.guild.name + " | " + devMessage, text: interaction?.guild.name || interaction.user.username + " | " + devMessage,
icon_url: interaction.guild.iconURL({ dynamic: true }), icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }),
}, },
}, },
], ],

View File

@@ -46,8 +46,8 @@ module.exports = {
url: interaction.guild.iconURL({ dynamic: true }) url: interaction.guild.iconURL({ dynamic: true })
}, },
footer: { footer: {
icon_url: interaction.guild.iconURL({ dynamic: true }), icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }),
text: interaction.guild.name + " | " + devMessage text: interaction?.guild.name || interaction.user.username + " | " + devMessage
} }
}] }]
}) })

View File

@@ -27,8 +27,8 @@ module.exports = {
description: "Ping of the bot is " + client.ws.ping + "ms.", description: "Ping of the bot is " + client.ws.ping + "ms.",
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild.name, text: interaction?.guild.name || interaction.user.username,
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true })
}, },
timestamp: new Date() timestamp: new Date()
}] }]

View File

@@ -44,8 +44,8 @@ module.exports = {
} }
], ],
footer: { footer: {
text: interaction.guild.name + " | " + devMessage, text: interaction?.guild.name || interaction.user.username + " | " + devMessage,
icon_url: interaction.guild.iconURL() icon_url: interaction?.guild.iconURL() || interaction.user.avatarURL()
} }
}] }]
}) })

View File

@@ -5,7 +5,6 @@ module.exports = {
name: "unban", name: "unban",
description: "Unban a user from the server", description: "Unban a user from the server",
type: "slash", type: "slash",
dev: true,
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName("unban") .setName("unban")
@@ -22,7 +21,9 @@ module.exports = {
.setName("reason") .setName("reason")
.setDescription("The reason for unbanning the user") .setDescription("The reason for unbanning the user")
.setRequired(false) .setRequired(false)
), )
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
.setDMPermission(false),
/** @param { import("discord.js").ChatInputCommandInteraction } interaction */ /** @param { import("discord.js").ChatInputCommandInteraction } interaction */

View File

@@ -47,8 +47,8 @@ module.exports = {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | " + devMessage, text: interaction?.guild.name || interaction.user.username + " | " + devMessage,
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true })
} }
}] }]
}) })