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
build: https://gitlab.com/illegitimate/illegitimate-bot.git#main
image: illegitimate:latest
restart: unless-stopped
environment:
- TOKEN=${TOKEN}
- MONGOURI=${MONGOURI}

View File

@@ -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}`)
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 () => {

View File

@@ -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
}]

View File

@@ -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 })
}
}]
})

View File

@@ -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 })
}
}]
})

View File

@@ -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 }),
},
},
],

View File

@@ -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
}
}]
})

View File

@@ -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()
}]

View File

@@ -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()
}
}]
})

View File

@@ -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 */

View File

@@ -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 })
}
}]
})