Merge branch 'dev' into 'main'
Dev See merge request illegitimate/illegitimate-bot!108
This commit is contained in:
@@ -6,6 +6,8 @@ module.exports = {
|
|||||||
name: "ban",
|
name: "ban",
|
||||||
description: "Ban a user",
|
description: "Ban a user",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("ban")
|
.setName("ban")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ module.exports = {
|
|||||||
name: "check",
|
name: "check",
|
||||||
description: "Check a player's stats.",
|
description: "Check a player's stats.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("check")
|
.setName("check")
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ module.exports = {
|
|||||||
name: "clear",
|
name: "clear",
|
||||||
description: "Clears messages",
|
description: "Clears messages",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("clear")
|
.setName("clear")
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ module.exports = {
|
|||||||
description: "Configure the bot",
|
description: "Configure the bot",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
dev: true,
|
dev: true,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("config")
|
.setName("config")
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ module.exports = {
|
|||||||
name: "admin",
|
name: "admin",
|
||||||
description: "Admin command.",
|
description: "Admin command.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("devel")
|
.setName("devel")
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ module.exports = {
|
|||||||
name: "forceunverify",
|
name: "forceunverify",
|
||||||
description: "Force unverify a user",
|
description: "Force unverify a user",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("forceunverify")
|
.setName("forceunverify")
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ module.exports = {
|
|||||||
name: "forceupdate",
|
name: "forceupdate",
|
||||||
description: "Force update the user",
|
description: "Force update the user",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("forceupdate")
|
.setName("forceupdate")
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ module.exports = {
|
|||||||
name: "forceverify",
|
name: "forceverify",
|
||||||
description: "Force verify a user.",
|
description: "Force verify a user.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("forceverify")
|
.setName("forceverify")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ module.exports = {
|
|||||||
name: "guild",
|
name: "guild",
|
||||||
description: "Subcommands for guilds",
|
description: "Subcommands for guilds",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("guild")
|
.setName("guild")
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
const { SlashCommandBuilder } = require("discord.js")
|
const { SlashCommandBuilder } = require("discord.js")
|
||||||
const { color, devMessage } = require("../../config/options.json")
|
const { color, devMessage } = require("../../config/options.json")
|
||||||
|
const fs = require("fs")
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "help",
|
name: "help",
|
||||||
description: "Help command",
|
description: "Help command",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: true,
|
||||||
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("help")
|
.setName("help")
|
||||||
@@ -17,8 +20,22 @@ module.exports = {
|
|||||||
|
|
||||||
await interaction.deferReply({ ephemeral: true })
|
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 footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage
|
||||||
const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true })
|
const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true })
|
||||||
|
|
||||||
@@ -26,27 +43,10 @@ module.exports = {
|
|||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Commands",
|
title: "Commands",
|
||||||
description: "List of commands",
|
description: "List of commands",
|
||||||
fields: [
|
fields: commandList,
|
||||||
{
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
color: embedColor,
|
color: embedColor,
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: interaction?.guild.iconURL({ dynamic: true }) || null
|
url: interaction?.guild?.iconURL({ dynamic: true }) || null
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
icon_url: footerIcon,
|
icon_url: footerIcon,
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ module.exports = {
|
|||||||
name: "kick",
|
name: "kick",
|
||||||
description: "Kick a member from the server.",
|
description: "Kick a member from the server.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("kick")
|
.setName("kick")
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ module.exports = {
|
|||||||
name: "ping",
|
name: "ping",
|
||||||
description: "Get the bot's ping.",
|
description: "Get the bot's ping.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("ping")
|
.setName("ping")
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ module.exports = {
|
|||||||
name: "remove",
|
name: "remove",
|
||||||
description: "Remove a person on the waiting list.",
|
description: "Remove a person on the waiting list.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("remove")
|
.setName("remove")
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
const { SlashCommandBuilder } = require("discord.js")
|
const { SlashCommandBuilder } = require("discord.js")
|
||||||
const { color, devMessage } = require("../../config/options.json")
|
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 = {
|
module.exports = {
|
||||||
name: "reqs",
|
name: "reqs",
|
||||||
description: "Displays the requirements for the guild.",
|
description: "Displays the requirements for the guild.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("reqs")
|
.setName("reqs")
|
||||||
.setDescription("Displays the requirements for the guild."),
|
.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**",
|
description: "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**",
|
||||||
color: embedColor,
|
color: embedColor,
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: interaction.guild.iconURL()
|
url: interaction?.guild?.iconURL({ dynamic: true }) || null
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
@@ -37,7 +40,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "**Skywars**",
|
name: "**Skywars**",
|
||||||
value: "**Stars:** `" + swstars.toString() + "`"
|
value: "**Stars:** `" + swstars.toString() +
|
||||||
|
"`\n**KDR:** `" + swkdr.toString() + "`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "**Duels**",
|
name: "**Duels**",
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ module.exports = {
|
|||||||
name: "send",
|
name: "send",
|
||||||
description: "Send a message to a channel.",
|
description: "Send a message to a channel.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("send")
|
.setName("send")
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ module.exports = {
|
|||||||
name: "setnick",
|
name: "setnick",
|
||||||
description: "Set your nickname",
|
description: "Set your nickname",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("setnick")
|
.setName("setnick")
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ module.exports = {
|
|||||||
description: "Used for setup of the bot.",
|
description: "Used for setup of the bot.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
dev: true,
|
dev: true,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("setup")
|
.setName("setup")
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ module.exports = {
|
|||||||
name: "slowmode",
|
name: "slowmode",
|
||||||
description: "Set the slowmode of a channel.",
|
description: "Set the slowmode of a channel.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("slowmode")
|
.setName("slowmode")
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ module.exports = {
|
|||||||
name: "timeout",
|
name: "timeout",
|
||||||
description: "Times out a memeber",
|
description: "Times out a memeber",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("timeout")
|
.setName("timeout")
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ 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: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("unban")
|
.setName("unban")
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ module.exports = {
|
|||||||
name: "update",
|
name: "update",
|
||||||
description: "Update your guild rank.",
|
description: "Update your guild rank.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("update")
|
.setName("update")
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ module.exports = {
|
|||||||
name: "uuid",
|
name: "uuid",
|
||||||
description: "Get a player's UUID",
|
description: "Get a player's UUID",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("uuid")
|
.setName("uuid")
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ module.exports = {
|
|||||||
name: "verify",
|
name: "verify",
|
||||||
description: "Verify yourself as a member of the server.",
|
description: "Verify yourself as a member of the server.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("verify")
|
.setName("verify")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ module.exports = {
|
|||||||
name: "whois",
|
name: "whois",
|
||||||
description: "Get's the ign of a user.",
|
description: "Get's the ign of a user.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
|
dev: false,
|
||||||
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("whois")
|
.setName("whois")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const { Client, GatewayIntentBits, Partials, Collection } = require("discord.js")
|
const { Client, GatewayIntentBits, Partials, Collection } = require("discord.js")
|
||||||
const { loadSlashCommandsEvents, loadContextMenuEvents, loadModalEvents, loadButtonEvents, loadEvents, loadAutocompleteEvents } = require("./utils/eventHandler.js")
|
const { loadSlashCommandsEvents, loadContextMenuEvents, loadModalEvents, loadButtonEvents, loadEvents, loadAutocompleteEvents } = require("./utils/eventHandler.js")
|
||||||
const { autoDeployCommands } = require("./utils/autodeploy.js")
|
const { autoDeployCommands } = require("./utils/autodeploy.js")
|
||||||
|
const { init } = require("./utils/init.js")
|
||||||
require("dotenv").config()
|
require("dotenv").config()
|
||||||
const mongoURI = process.env.MONGOURI
|
const mongoURI = process.env.MONGOURI
|
||||||
const { connect } = require("mongoose")
|
const { connect } = require("mongoose")
|
||||||
@@ -26,6 +27,7 @@ client.commands = new Collection()
|
|||||||
client.events = new Collection()
|
client.events = new Collection()
|
||||||
client.modals = new Collection()
|
client.modals = new Collection()
|
||||||
|
|
||||||
|
init()
|
||||||
loadSlashCommandsEvents(client)
|
loadSlashCommandsEvents(client)
|
||||||
loadAutocompleteEvents(client)
|
loadAutocompleteEvents(client)
|
||||||
loadContextMenuEvents(client)
|
loadContextMenuEvents(client)
|
||||||
|
|||||||
38
src/utils/init.js
Normal file
38
src/utils/init.js
Normal 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 }
|
||||||
Reference in New Issue
Block a user