Merge branch 'dev' into 'main'

Dev

See merge request illegitimate/illegitimate-bot!108
This commit is contained in:
2023-11-30 17:33:19 +00:00
26 changed files with 109 additions and 23 deletions

View File

@@ -6,6 +6,8 @@ module.exports = {
name: "ban",
description: "Ban a user",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("ban")

View File

@@ -7,6 +7,8 @@ module.exports = {
name: "check",
description: "Check a player's stats.",
type: "slash",
dev: false,
public: true,
data: new SlashCommandBuilder()
.setName("check")

View File

@@ -5,6 +5,8 @@ module.exports = {
name: "clear",
description: "Clears messages",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("clear")

View File

@@ -8,6 +8,7 @@ module.exports = {
description: "Configure the bot",
type: "slash",
dev: true,
public: false,
data: new SlashCommandBuilder()
.setName("config")

View File

@@ -4,6 +4,8 @@ module.exports = {
name: "admin",
description: "Admin command.",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("devel")

View File

@@ -8,6 +8,8 @@ module.exports = {
name: "forceunverify",
description: "Force unverify a user",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("forceunverify")

View File

@@ -9,6 +9,8 @@ module.exports = {
name: "forceupdate",
description: "Force update the user",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("forceupdate")

View File

@@ -10,6 +10,8 @@ module.exports = {
name: "forceverify",
description: "Force verify a user.",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("forceverify")

View File

@@ -7,6 +7,8 @@ module.exports = {
name: "guild",
description: "Subcommands for guilds",
type: "slash",
dev: false,
public: true,
data: new SlashCommandBuilder()
.setName("guild")

View File

@@ -1,10 +1,13 @@
const { SlashCommandBuilder } = require("discord.js")
const { color, devMessage } = require("../../config/options.json")
const fs = require("fs")
module.exports = {
name: "help",
description: "Help command",
type: "slash",
dev: true,
public: true,
data: new SlashCommandBuilder()
.setName("help")
@@ -17,8 +20,22 @@ module.exports = {
await interaction.deferReply({ ephemeral: true })
const embedColor = Number(color.replace("#", "0x"))
const commands = []
const commandFiles = fs.readdirSync(__dirname).filter(file => file.endsWith(".js"))
for (const file of commandFiles) {
const command = require(`./${file}`)
if (command.public) {
commands.push(command)
}
}
const commandList = commands.map((command) => {
return {
name: "**/" + command.name + "**",
value: "`" + command.description + "`"
}
})
const embedColor = Number(color.replace("#", "0x"))
const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage
const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true })
@@ -26,27 +43,10 @@ module.exports = {
embeds: [{
title: "Commands",
description: "List of commands",
fields: [
{
name: "/check",
value: "Check the stats of a player"
},
{
name: "/reqs",
value: "Check the requirements of the guild"
},
{
name: "/update",
value: "Update's your roles"
},
{
name: "/help",
value: "Shows this message"
}
],
fields: commandList,
color: embedColor,
thumbnail: {
url: interaction?.guild.iconURL({ dynamic: true }) || null
url: interaction?.guild?.iconURL({ dynamic: true }) || null
},
footer: {
icon_url: footerIcon,

View File

@@ -6,6 +6,8 @@ module.exports = {
name: "kick",
description: "Kick a member from the server.",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("kick")

View File

@@ -5,6 +5,8 @@ module.exports = {
name: "ping",
description: "Get the bot's ping.",
type: "slash",
dev: false,
public: true,
data: new SlashCommandBuilder()
.setName("ping")

View File

@@ -6,6 +6,8 @@ module.exports = {
name: "remove",
description: "Remove a person on the waiting list.",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("remove")

View File

@@ -1,11 +1,14 @@
const { SlashCommandBuilder } = require("discord.js")
const { color, devMessage } = require("../../config/options.json")
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../config/reqs.json")
const { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } = require("../../config/reqs.json")
module.exports = {
name: "reqs",
description: "Displays the requirements for the guild.",
type: "slash",
dev: false,
public: true,
data: new SlashCommandBuilder()
.setName("reqs")
.setDescription("Displays the requirements for the guild."),
@@ -26,7 +29,7 @@ module.exports = {
description: "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**",
color: embedColor,
thumbnail: {
url: interaction.guild.iconURL()
url: interaction?.guild?.iconURL({ dynamic: true }) || null
},
fields: [
{
@@ -37,7 +40,8 @@ module.exports = {
},
{
name: "**Skywars**",
value: "**Stars:** `" + swstars.toString() + "`"
value: "**Stars:** `" + swstars.toString() +
"`\n**KDR:** `" + swkdr.toString() + "`"
},
{
name: "**Duels**",

View File

@@ -5,6 +5,8 @@ module.exports = {
name: "send",
description: "Send a message to a channel.",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("send")

View File

@@ -4,6 +4,8 @@ module.exports = {
name: "setnick",
description: "Set your nickname",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("setnick")

View File

@@ -6,6 +6,7 @@ module.exports = {
description: "Used for setup of the bot.",
type: "slash",
dev: true,
public: false,
data: new SlashCommandBuilder()
.setName("setup")

View File

@@ -5,6 +5,8 @@ module.exports = {
name: "slowmode",
description: "Set the slowmode of a channel.",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("slowmode")

View File

@@ -6,6 +6,8 @@ module.exports = {
name: "timeout",
description: "Times out a memeber",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("timeout")

View File

@@ -5,6 +5,8 @@ module.exports = {
name: "unban",
description: "Unban a user from the server",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("unban")

View File

@@ -9,6 +9,8 @@ module.exports = {
name: "update",
description: "Update your guild rank.",
type: "slash",
dev: false,
public: true,
data: new SlashCommandBuilder()
.setName("update")

View File

@@ -6,6 +6,8 @@ module.exports = {
name: "uuid",
description: "Get a player's UUID",
type: "slash",
dev: false,
public: true,
data: new SlashCommandBuilder()
.setName("uuid")

View File

@@ -9,6 +9,8 @@ module.exports = {
name: "verify",
description: "Verify yourself as a member of the server.",
type: "slash",
dev: false,
public: true,
data: new SlashCommandBuilder()
.setName("verify")

View File

@@ -7,6 +7,8 @@ module.exports = {
name: "whois",
description: "Get's the ign of a user.",
type: "slash",
dev: false,
public: false,
data: new SlashCommandBuilder()
.setName("whois")

View File

@@ -1,6 +1,7 @@
const { Client, GatewayIntentBits, Partials, Collection } = require("discord.js")
const { loadSlashCommandsEvents, loadContextMenuEvents, loadModalEvents, loadButtonEvents, loadEvents, loadAutocompleteEvents } = require("./utils/eventHandler.js")
const { autoDeployCommands } = require("./utils/autodeploy.js")
const { init } = require("./utils/init.js")
require("dotenv").config()
const mongoURI = process.env.MONGOURI
const { connect } = require("mongoose")
@@ -26,6 +27,7 @@ client.commands = new Collection()
client.events = new Collection()
client.modals = new Collection()
init()
loadSlashCommandsEvents(client)
loadAutocompleteEvents(client)
loadContextMenuEvents(client)

38
src/utils/init.js Normal file
View File

@@ -0,0 +1,38 @@
const envars = [
"TOKEN",
"MONGOURI",
"DEV",
"HYPIXELAPIKEY"
]
const devenvars = [
"DEVTOKEN",
"CLIENTID",
"DEVID",
"GUILDID"
]
function init() {
if (process.env.NODe_ENV !== "dev") {
for (const envar of envars) {
if (!process.env[envar]) {
console.error(`Missing ${envar} environment variable!`)
process.exit(1)
}
}
} else {
for (const envar of envars) {
if (!process.env[envar]) {
console.error(`Missing ${envar} environment variable!`)
process.exit(1)
}
}
for (const envar of devenvars) {
if (!process.env[envar]) {
console.error(`Missing ${envar} environment variable!`)
process.exit(1)
}
}
}
}
module.exports = { init }