From 0952d89809efc9c1bf157585651aed489628ec2d Mon Sep 17 00:00:00 2001 From: Taken Date: Thu, 31 Aug 2023 23:13:47 +0200 Subject: [PATCH] Revert "Making all files use prettier" This reverts commit 5aa85986cd107f225f85a85046c7cac2b2d3a970. --- .gitignore | 1 + .gitlab-ci.yml | 49 +- README.md | 2 +- commands-contextmenu/congratsmessage.js | 31 +- commands-contextmenu/resetnick.js | 28 +- commands-testing/dev-info.js | 40 +- commands-testing/mute.js | 196 ++- commands/check.js | 378 +++-- commands/config.js | 410 +++--- commands/devel.js | 102 +- commands/forceunverify.js | 82 +- commands/forceupdate.js | 481 ++++--- commands/forceverify.js | 224 ++- commands/help.js | 81 +- commands/reqs.js | 85 +- commands/send.js | 53 +- commands/setnick.js | 43 +- commands/slowmode.js | 82 +- commands/update.js | 454 +++--- commands/verify.js | 198 ++- commands/whois.js | 66 +- config/limitmessages.json | 4 +- config/options.json | 2 +- config/questions.json | 14 +- docker-compose.yml | 26 +- events/buttons/checkstats.js | 202 ++- events/buttons/guilapply.js | 697 +++++---- events/buttons/guildapplicationaccept.js | 70 +- events/buttons/guildapplicationdeny.js | 31 +- events/buttons/guildinactivitylog.js | 553 ++++---- events/buttons/inactiveapplicationaccept.js | 16 +- events/buttons/inactiveapplicationdeny.js | 16 +- events/buttons/staffapplicationaccept.js | 62 +- events/buttons/staffapplicationdeny.js | 29 +- events/buttons/staffapply.js | 785 +++++------ events/buttons/verify.js | 49 +- events/buttons/waitingListUpdate.js | 96 +- events/modals/denyreasonbox.js | 71 +- events/modals/staffdenyreasonbox.js | 75 +- index.js | 133 +- package-lock.json | 1412 +++++++++---------- package.json | 32 +- schemas/guildAppSchema.js | 4 +- schemas/staffAppSchema.js | 4 +- schemas/verifySchema.js | 4 +- schemas/waitinglistSchema.js | 6 +- scripts/deploy-commands.js | 147 +- scripts/dev-deploy.js | 40 +- utils/functions.js | 129 +- 49 files changed, 3777 insertions(+), 4018 deletions(-) diff --git a/.gitignore b/.gitignore index 3c5f3af..bbeb5e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/* .env +.prettierrc .editorconfig diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 482b03b..fb13cb0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,25 +1,26 @@ + docker-build: - image: docker:latest - stage: build - services: - - docker:dind - before_script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - # Default branch leaves tag empty (= latest tag) - # All other branches are tagged with the escaped branch name (commit ref slug) - script: - - | - if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then - tag="" - echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" - else - tag=":$CI_COMMIT_REF_SLUG" - echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" - fi - - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . - - docker push "$CI_REGISTRY_IMAGE${tag}" - # Run this job in a branch where a Dockerfile exists - rules: - - if: $CI_COMMIT_BRANCH - exists: - - Dockerfile + image: docker:latest + stage: build + services: + - docker:dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + # Default branch leaves tag empty (= latest tag) + # All other branches are tagged with the escaped branch name (commit ref slug) + script: + - | + if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then + tag="" + echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" + else + tag=":$CI_COMMIT_REF_SLUG" + echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" + fi + - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . + - docker push "$CI_REGISTRY_IMAGE${tag}" + # Run this job in a branch where a Dockerfile exists + rules: + - if: $CI_COMMIT_BRANCH + exists: + - Dockerfile diff --git a/README.md b/README.md index 630993d..73f616d 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ This is a public repo for the illegitimate discord bot -If you wish to join the discord or guild head to this [link](https://discord.gg/Wbyaw6w8DU). +If you wish to join the discord or guild head to this [link](https://discord.gg/Wbyaw6w8DU). \ No newline at end of file diff --git a/commands-contextmenu/congratsmessage.js b/commands-contextmenu/congratsmessage.js index 56f4154..3091964 100644 --- a/commands-contextmenu/congratsmessage.js +++ b/commands-contextmenu/congratsmessage.js @@ -1,35 +1,34 @@ -const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention } = require("discord.js"); +const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention} = require('discord.js'); module.exports = { - name: "congratsmessage", - description: "Congratulate a user.", - type: "contextmenu", + name: 'congratsmessage', + description: 'Congratulate a user.', + type: 'contextmenu', data: new ContextMenuCommandBuilder() - .setName("Congratulate") + .setName('Congratulate') .setType(ApplicationCommandType.Message) .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages), async execute(interaction) { - const { targetId } = interaction; + + const { targetId } = interaction const message = await interaction.channel.messages.fetch(targetId); if (!message) { - return interaction.reply({ content: "That user does not exist.", ephemeral: true }); + return interaction.reply({ content: 'That user does not exist.', ephemeral: true }); } const target = message.author; await message.reply({ - embeds: [ - { - title: "Congratulations!", - description: `GG to ${userMention(target.id)}!`, - }, - ], + embeds:[{ + title: 'Congratulations!', + description: `GG to ${userMention(target.id)}!`, + }] }); - await message.react("🎉"); + await message.react('🎉'); await interaction.reply({ content: `Sent a congrats message`, ephemeral: true }); - }, -}; + } +}; \ No newline at end of file diff --git a/commands-contextmenu/resetnick.js b/commands-contextmenu/resetnick.js index bfc67a9..9344417 100644 --- a/commands-contextmenu/resetnick.js +++ b/commands-contextmenu/resetnick.js @@ -1,36 +1,34 @@ -const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits } = require("discord.js"); +const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits } = require('discord.js'); module.exports = { - name: "resetnick", - description: "Reset your nickname.", - type: "contextmenu", + name: 'resetnick', + description: 'Reset your nickname.', + type: 'contextmenu', data: new ContextMenuCommandBuilder() - .setName("Reset Nickname") + .setName('Reset Nickname') .setType(ApplicationCommandType.User) .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames), async execute(interaction) { - const { targetId } = interaction; + + const { targetId } = interaction const target = await interaction.guild.members.fetch(targetId); if (!target) { - return interaction.reply({ content: "That user does not exist.", ephemeral: true }); + return interaction.reply({ content: 'That user does not exist.', ephemeral: true }); } if (target.id === interaction.user.id) { - return interaction.reply({ content: "You can't reset your own nickname.", ephemeral: true }); + return interaction.reply({ content: 'You can\'t reset your own nickname.', ephemeral: true }); } if (!target.manageable) { - return interaction.reply({ content: "I cannot reset that user's nickname.", ephemeral: true }); + return interaction.reply({ content: 'I cannot reset that user\'s nickname.', ephemeral: true }); } - await target.setNickname( - target.user.username, - "Reset by " + interaction.user.username + "#" + interaction.user.discriminator, - ); + await target.setNickname(target.user.username, 'Reset by ' + interaction.user.username + "#" + interaction.user.discriminator); return interaction.reply({ content: `Reset ${target.user.username}'s nickname.`, ephemeral: true }); - }, -}; + } +}; \ No newline at end of file diff --git a/commands-testing/dev-info.js b/commands-testing/dev-info.js index 985be7f..ada9215 100644 --- a/commands-testing/dev-info.js +++ b/commands-testing/dev-info.js @@ -1,24 +1,34 @@ -const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js"); -const getuuid = require("../utils/functions"); +const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); +const getuuid = require('../utils/functions'); module.exports = { - name: "dev-info", - description: "Test command for the bot.", - type: "slash", + name: 'dev-info', + description: 'Test command for the bot.', + type: 'slash', data: new SlashCommandBuilder() - .setName("dev-info") - .setDescription("Test command for the bot.") - .addStringOption((option) => option.setName("test").setDescription("Test option.")) - .addStringOption((option) => option.setName("test2").setDescription("Test option.")) - .addStringOption((option) => option.setName("test3").setDescription("Test option.")) + .setName('dev-info') + .setDescription('Test command for the bot.') + .addStringOption(option => + option + .setName('test') + .setDescription('Test option.')) + .addStringOption(option => + option + .setName('test2') + .setDescription('Test option.')) + .addStringOption(option => + option + .setName('test3') + .setDescription('Test option.')) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), async execute(interaction) { - const test = interaction.options.getString("test"); - const test2 = interaction.options.getString("test2"); - const test3 = interaction.options.getString("test3"); + + const test = interaction.options.getString('test'); + const test2 = interaction.options.getString('test2'); + const test3 = interaction.options.getString('test3'); const message = await interaction.channel.messages.fetch(test); const embed = message.embeds[0]; @@ -27,6 +37,6 @@ module.exports = { console.log(field1.value); - await interaction.reply({ content: "Test command.", ephemeral: true }); - }, + await interaction.reply({ content: 'Test command.', ephemeral: true }); + } }; diff --git a/commands-testing/mute.js b/commands-testing/mute.js index 21254f1..607cbed 100644 --- a/commands-testing/mute.js +++ b/commands-testing/mute.js @@ -1,87 +1,88 @@ -const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js"); -const env = require("dotenv").config(); +const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js'); +const env = require('dotenv').config(); const dev = process.env.DEV; -const { color } = require("../config/options.json"); -const { admin, helper, muted } = require("../config/roles.json"); -const { staffOtherChannel } = require("../config/options.json"); +const { color } = require('../config/options.json'); +const { admin, helper, muted } = require('../config/roles.json'); +const { staffOtherChannel } = require('../config/options.json'); module.exports = { - name: "mute", - description: "Mute a user", - type: "slash", + name: 'mute', + description: 'Mute a user', + type: 'slash', data: new SlashCommandBuilder() - .setName("mute") - .setDescription("Mute a user") - .addUserOption((option) => option.setName("user").setDescription("The user to mute").setRequired(true)) - .addStringOption((option) => option.setName("reason").setDescription("The reason for the mute")) - .addStringOption((option) => option.setName("duration").setDescription("The duration of the mute")) + .setName('mute') + .setDescription('Mute a user') + .addUserOption(option => + option + .setName('user') + .setDescription('The user to mute') + .setRequired(true)) + .addStringOption(option => + option + .setName('reason') + .setDescription('The reason for the mute')) + .addStringOption(option => + option + .setName('duration') + .setDescription('The duration of the mute')) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), async execute(interaction) { - const member1 = interaction.options.getUser("user"); - const member = interaction.guild.members.cache.get(member1.id); - const reason = interaction.options.getString("reason") ?? "No reason provided"; - const duration = interaction.options.getString("duration"); - const guild = interaction.guild; - const embedColor = Number(color.replace("#", "0x")); - const userRoles = await guild.members - .fetch(interaction.user.id) - .then((member) => member.roles.cache.map((role) => role.id)); - const memberRoles = await guild.members - .fetch(member1.id) - .then((member) => member.roles.cache.map((role) => role.id)); + const member1 = interaction.options.getUser('user'); + const member = interaction.guild.members.cache.get(member1.id); + const reason = interaction.options.getString('reason') ?? 'No reason provided'; + const duration = interaction.options.getString('duration'); + const guild = interaction.guild; + const embedColor = Number(color.replace('#', '0x')); + + const userRoles = await guild.members.fetch(interaction.user.id).then(member => member.roles.cache.map(role => role.id)); + const memberRoles = await guild.members.fetch(member1.id).then(member => member.roles.cache.map(role => role.id)); await interaction.deferReply({}); if (!userRoles.includes(admin || helper)) { await interaction.editReply({ - embeds: [ - { - description: "You don't have permission to use this command.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], + embeds: [{ + description: "You don't have permission to use this command.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] }); - return; + return } if (member.id === interaction.user.id) { await interaction.editReply({ - embeds: [ - { - description: "You can't mute yourself.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], + embeds: [{ + description: "You can't mute yourself.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] }); - return; + return } if (member.id === dev) { await interaction.editReply({ - embeds: [ - { - description: "You can't mute my developer.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], + embeds: [{ + description: "You can't mute my developer.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] }); - return; + return } // if (memberRoles.includes(admin) || memberRoles.includes(helper)) { @@ -101,27 +102,25 @@ module.exports = { if (!duration) { await member.roles.add(muted, reason); await interaction.editReply({ - embeds: [ - { - description: "Successfully muted " + userMention(member1.id) + " forever.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; + embeds: [{ + description: "Successfully muted " + userMention(member1.id) + " forever.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return } console.log(duration); - const weeks = duration.replace(/[0-9][dhms]/g, "").replace(/w/g, ""); - const days = duration.replace(/[0-9][whms]/g, "").replace(/d/g, ""); - const hours = duration.replace(/[0-9][wdms]/g, "").replace(/h/g, ""); - const minutes = duration.replace(/[0-9][wdhs]/g, "").replace(/m/g, ""); - const seconds = duration.replace(/[0-9][wdhm]/g, "").replace(/s/g, ""); + const weeks = duration.replace(/[0-9][dhms]/g, '').replace(/w/g, '') + const days = duration.replace(/[0-9][whms]/g, '').replace(/d/g, '') + const hours = duration.replace(/[0-9][wdms]/g, '').replace(/h/g, '') + const minutes = duration.replace(/[0-9][wdhs]/g, '').replace(/m/g, '') + const seconds = duration.replace(/[0-9][wdhm]/g, '').replace(/s/g, '') const nweeks = Number(weeks) ?? 0; const ndays = Number(days) ?? 0; @@ -130,25 +129,18 @@ module.exports = { const nseconds = Number(seconds) ?? 0; const time = nweeks * 604800000 + ndays * 86400000 + nhours * 3600000 + nminutes * 60000 + nseconds * 1000; - const mutedTime = - (nweeks > 0 ? nweeks + " week(s), " : "") + - (ndays > 0 ? ndays + " day(s), " : "") + - (nhours > 0 ? nhours + " hour(s), " : "") + - (nminutes > 0 ? nminutes + " minute(s), " : "") + - (nseconds > 0 ? nseconds + " second(s)" : ""); + const mutedTime = (nweeks > 0 ? nweeks + " week(s), " : "") + (ndays > 0 ? ndays + " day(s), " : "") + (nhours > 0 ? nhours + " hour(s), " : "") + (nminutes > 0 ? nminutes + " minute(s), " : "") + (nseconds > 0 ? nseconds + " second(s)" : ""); await member.roles.add(muted, reason); await interaction.editReply({ - embeds: [ - { - description: "Successfully muted " + userMention(member1.id) + " for " + mutedTime + ".", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], + embeds: [{ + description: "Successfully muted " + userMention(member1.id) + " for " + mutedTime + ".", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] }); const logChannel = interaction.guild.channels.cache.get(staffOtherChannel); @@ -156,17 +148,15 @@ module.exports = { setTimeout(async () => { await member.roles.remove(muted, "Mute duration has ended."); await logChannel.send({ - embeds: [ - { - description: userMention(member1.id) + " has been unmuted.", - color: embedColor, - footer: { - text: "ID: " + member1.id, - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); + embeds: [{ + description: userMention(member1.id) + " has been unmuted.", + color: embedColor, + footer: { + text: "ID: " + member1.id, + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) }, time); - }, + } }; diff --git a/commands/check.js b/commands/check.js index 0ba79d3..090fe48 100644 --- a/commands/check.js +++ b/commands/check.js @@ -7,212 +7,198 @@ const fetch = require("axios"); const { getExactLevel, skywarsLevel, getLevelForExp } = require("../utils/functions.js"); module.exports = { - name: "check", - description: "Check a player's stats.", - type: "slash", + name: "check", + description: "Check a player's stats.", + type: "slash", - data: new SlashCommandBuilder() - .setName("check") - .setDescription("Check a player's stats.") - .addStringOption((option) => option.setName("ign").setDescription("The player's IGN.").setRequired(true)) - .setDMPermission(false), + data: new SlashCommandBuilder() + .setName("check") + .setDescription("Check a player's stats.") + .addStringOption((option) => option.setName("ign") + .setDescription("The player's IGN.") + .setRequired(true)) + .setDMPermission(false), - async execute(interaction) { - await interaction.deferReply({}); + async execute(interaction) { + await interaction.deferReply({}); - const ign = interaction.options.getString("ign"); - const mojang = "https://api.mojang.com/users/profiles/minecraft/"; - const hypixel = "https://api.hypixel.net/player"; - const guildAPI = "https://api.hypixel.net/guild"; - const minotar = "https://minotar.net/helm/"; - const embedColor = Number(color.replace("#", "0x")); - const head = minotar + ign; + const ign = interaction.options.getString("ign"); + const mojang = "https://api.mojang.com/users/profiles/minecraft/"; + const hypixel = "https://api.hypixel.net/player" + const guildAPI = "https://api.hypixel.net/guild" + const minotar = "https://minotar.net/helm/"; + const embedColor = Number(color.replace("#", "0x")); + const head = minotar + ign; - if (!ign) { - await interaction.editReply("Please provide a player's IGN."); - return; + if (!ign) { + await interaction.editReply("Please provide a player's IGN."); + return; + } + + try { + await fetch(mojang + ign); + } catch (error) { + interaction.editReply({ + embeds: [ + { description: "That player doesn't exist.", color: embedColor } + ] + }); + return; + } + + const userCheck = await fetch(mojang + ign); + const uuid = userCheck.data.id; + + const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid + const stats = await fetch(player); + + if (!stats.data.player) { + interaction.editReply({ + embeds: [{ + description: "That player hasn't played Hypixel before.", + color: embedColor + }] + }); + return; + } + + const rank2 = stats.data.player.newPackageRank; + const monthlyRank = stats.data.player.monthlyPackageRank; + + if (rank2 === 'VIP') { + var rank = "[VIP] " + } else if (rank2 === 'VIP_PLUS') { + var rank = "[VIP+] " + } else if (rank2 === 'MVP') { + var rank = "[MVP] " + } else if (rank2 === 'MVP_PLUS' && monthlyRank === 'NONE') { + var rank = "[MVP+] " + } else if (rank2 === 'MVP_PLUS' && monthlyRank === 'SUPERSTAR') { + var rank = "[MVP++] " } - try { - await fetch(mojang + ign); - } catch (error) { - interaction.editReply({ - embeds: [{ description: "That player doesn't exist.", color: embedColor }], - }); - return; - } + const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid + const guildCheck = await fetch(guild); - const userCheck = await fetch(mojang + ign); - const uuid = userCheck.data.id; + if (!guildCheck.data.guild) { + var guildName = "None"; + } else { + var guildName = guildCheck.data.guild.name; + } - const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid; - const stats = await fetch(player); + if (!guildCheck.data.guild) { + var guildTag = "" + } else if (!guildCheck.data.guild.tag) { + var guildTag = "" + } else { + var guildTag = " [" + guildCheck.data.guild.tag + "]" + } - if (!stats.data.player) { - interaction.editReply({ - embeds: [ - { - description: "That player hasn't played Hypixel before.", - color: embedColor, - }, - ], - }); - return; - } + //bedwars level + const hsbwexp = stats.data.player.stats.Bedwars.Experience; + const hsbwstars = getLevelForExp(hsbwexp); + // bedwars fkdr + const hsbwfk = stats.data.player.stats.Bedwars.final_kills_bedwars; + const hsbwfd = stats.data.player.stats.Bedwars.final_deaths_bedwars; + const hsbwfkdr = hsbwfk / hsbwfd; + // bedwars wins + const hsbwwins = stats.data.player.stats.Bedwars.wins_bedwars; + // skywars level + const hsswexp = stats.data.player.stats.SkyWars.skywars_experience; + const hsswstars = skywarsLevel(hsswexp); + // skywars kdr + const hsswkills = stats.data.player.stats.SkyWars.kills; + const hsswdeaths = stats.data.player.stats.SkyWars.deaths; + const hsswkd = hsswkills / hsswdeaths; + //skywars wins + const hsswwins = stats.data.player.stats.SkyWars.wins; + // dueks kdr + const hsduelskills = stats.data.player.stats.Duels.kills + const hsduelsdeaths = stats.data.player.stats.Duels.deaths + const hsduelskd = hsduelskills / hsduelsdeaths + // duels wins + const hsduelswins = stats.data.player.stats.Duels.wins; + // duels wlr + const hsduelslosses = stats.data.player.stats.Duels.losses; + const hsduelswlr = hsduelswins / hsduelslosses; + // network level + const hypixelExp = stats.data.player.networkExp; + const level = getExactLevel(hypixelExp); + + if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) { + var bwtitle = + " This player does not meet the BedWars requirements."; + } else { + var bwtitle = + " This player meets the BedWars requirements."; + } - const rank2 = stats.data.player.newPackageRank; - const monthlyRank = stats.data.player.monthlyPackageRank; + if (hsswstars < swstars) { + var swtitle = + " This player does not meet the SkyWars requirements."; + } else { + var swtitle = + " This player meets the SkyWars requirements."; + } - if (rank2 === "VIP") { - var rank = "[VIP] "; - } else if (rank2 === "VIP_PLUS") { - var rank = "[VIP+] "; - } else if (rank2 === "MVP") { - var rank = "[MVP] "; - } else if (rank2 === "MVP_PLUS" && monthlyRank === "NONE") { - var rank = "[MVP+] "; - } else if (rank2 === "MVP_PLUS" && monthlyRank === "SUPERSTAR") { - var rank = "[MVP++] "; - } + if (hsduelswins < duelswins || hsduelswlr < duelswlr) { + var duelstitle = + " This player does not meet the Duels requirements."; + } else { + var duelstitle = + " This player meets the Duels requirements."; + } - const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid; - const guildCheck = await fetch(guild); - - if (!guildCheck.data.guild) { - var guildName = "None"; - } else { - var guildName = guildCheck.data.guild.name; - } - - if (!guildCheck.data.guild) { - var guildTag = ""; - } else if (!guildCheck.data.guild.tag) { - var guildTag = ""; - } else { - var guildTag = " [" + guildCheck.data.guild.tag + "]"; - } - - //bedwars level - const hsbwexp = stats.data.player.stats.Bedwars.Experience; - const hsbwstars = getLevelForExp(hsbwexp); - // bedwars fkdr - const hsbwfk = stats.data.player.stats.Bedwars.final_kills_bedwars; - const hsbwfd = stats.data.player.stats.Bedwars.final_deaths_bedwars; - const hsbwfkdr = hsbwfk / hsbwfd; - // bedwars wins - const hsbwwins = stats.data.player.stats.Bedwars.wins_bedwars; - // skywars level - const hsswexp = stats.data.player.stats.SkyWars.skywars_experience; - const hsswstars = skywarsLevel(hsswexp); - // skywars kdr - const hsswkills = stats.data.player.stats.SkyWars.kills; - const hsswdeaths = stats.data.player.stats.SkyWars.deaths; - const hsswkd = hsswkills / hsswdeaths; - //skywars wins - const hsswwins = stats.data.player.stats.SkyWars.wins; - // dueks kdr - const hsduelskills = stats.data.player.stats.Duels.kills; - const hsduelsdeaths = stats.data.player.stats.Duels.deaths; - const hsduelskd = hsduelskills / hsduelsdeaths; - // duels wins - const hsduelswins = stats.data.player.stats.Duels.wins; - // duels wlr - const hsduelslosses = stats.data.player.stats.Duels.losses; - const hsduelswlr = hsduelswins / hsduelslosses; - // network level - const hypixelExp = stats.data.player.networkExp; - const level = getExactLevel(hypixelExp); - - if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) { - var bwtitle = " This player does not meet the BedWars requirements."; - } else { - var bwtitle = " This player meets the BedWars requirements."; - } - - if (hsswstars < swstars) { - var swtitle = " This player does not meet the SkyWars requirements."; - } else { - var swtitle = " This player meets the SkyWars requirements."; - } - - if (hsduelswins < duelswins || hsduelswlr < duelswlr) { - var duelstitle = " This player does not meet the Duels requirements."; - } else { - var duelstitle = " This player meets the Duels requirements."; - } - - await interaction.editReply({ - embeds: [ - { - title: rank + stats.data.player.displayname + guildTag, - description: - "**Network Level:** `" + - level.toFixed(2).toString() + - "`\n" + - "**Current Guild:** `" + - guildName + - "`", - color: embedColor, - thumbnail: { url: head }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL(), - }, - fields: [ - { - name: bwtitle, - value: - "**➺ Stars:** `" + - hsbwstars.toFixed(2).toString() + - " / " + - bwstars.toString() + - "`\n" + - "**➺ FKDR:** `" + - hsbwfkdr.toFixed(2).toString() + - " / " + - bwfkdr.toString() + - "`\n" + - "**➺ Wins:** `" + - hsbwwins.toString() + - " / " + - bwwins.toString() + - "`", - }, - { - name: swtitle, - value: - "**➺ Stars:** `" + - hsswstars.toFixed(2).toString() + - " / " + - swstars.toString() + - "`\n" + - "**➺ KDR:** `" + - hsswkd.toFixed(2).toString() + - "`\n" + - "**➺ Wins:** `" + - hsswwins.toString() + - "`", - }, - { - name: duelstitle, - value: - "**➺ Wins:** `" + - hsduelswins.toString() + - " / " + - duelswins.toString() + - "`\n" + - "**➺ WLR:** `" + - hsduelswlr.toFixed(2).toString() + - " / " + - duelswlr.toString() + - "`\n" + - "**➺ KDR:** `" + - hsduelskd.toFixed(2).toString() + - "`", - }, - ], - }, - ], - }); - }, + await interaction.editReply({ + embeds: [{ + title: rank + stats.data.player.displayname + guildTag, + description: "**Network Level:** `" + + level.toFixed(2).toString() + "`\n" + + "**Current Guild:** `" + guildName + "`", + color: embedColor, + thumbnail: { url: head }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL() + }, + fields: [ + { + name: bwtitle, + value: "**➺ Stars:** `" + + hsbwstars.toFixed(2).toString() + " / " + + bwstars.toString() + "`\n" + + "**➺ FKDR:** `" + + hsbwfkdr.toFixed(2).toString() + + " / " + bwfkdr.toString() + "`\n" + + "**➺ Wins:** `" + + hsbwwins.toString() + " / " + + bwwins.toString() + "`" + }, + { + name: swtitle, + value: + "**➺ Stars:** `" + + hsswstars.toFixed(2).toString() + + " / " + swstars.toString() + "`\n" + + "**➺ KDR:** `" + + hsswkd.toFixed(2).toString() + + "`\n" + + "**➺ Wins:** `" + + hsswwins.toString() + "`" + }, + { + name: duelstitle, + value: "**➺ Wins:** `" + + hsduelswins.toString() + + " / " + duelswins.toString() + "`\n" + + "**➺ WLR:** `" + + hsduelswlr.toFixed(2).toString() + + " / " + duelswlr.toString() + "`\n" + + "**➺ KDR:** `" + + hsduelskd.toFixed(2).toString() + "`" + } + ] + }] + }); + } }; diff --git a/commands/config.js b/commands/config.js index 946c6d6..d486b54 100644 --- a/commands/config.js +++ b/commands/config.js @@ -1,239 +1,219 @@ -const { - SlashCommandBuilder, - PermissionFlagsBits, - ButtonBuilder, - ActionRowBuilder, - ButtonStyle, -} = require("discord.js"); +const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, } = require("discord.js"); const { color } = require("../config/options.json"); module.exports = { - name: "config", - description: "Configure the bot.", - type: "slash", + name: "config", + description: "Configure the bot.", + type: "slash", - data: new SlashCommandBuilder() - .setName("config") - .setDescription("Configure the bot.") - .addSubcommand((subcommand) => + data: new SlashCommandBuilder() + .setName("config") + .setDescription("Configure the bot.") + .addSubcommand((subcommand) => + subcommand + .setName("sendguildapplication") + .setDescription("Send the application message to a channel.") + .addChannelOption((option) => + option + .setName("channel") + .setDescription("The channel to send the application to.") + .setRequired(true)) + ) + .addSubcommand((subcommand) => + subcommand + .setName("sendstaffapplication") + .setDescription("Send the application message to a channel.") + .addChannelOption((option) => + option + .setName("channel") + .setDescription("The channel to send the application to.") + .setRequired(true))) + .addSubcommand((subcommand) => subcommand - .setName("sendguildapplication") - .setDescription("Send the application message to a channel.") - .addChannelOption((option) => + .setName("sendverfiymessage") + .setDescription("Send the verfiy message to a channel.") + .addChannelOption((option) => option - .setName("channel") - .setDescription("The channel to send the application to.") - .setRequired(true), - ), - ) - .addSubcommand((subcommand) => + .setName("channel") + .setDescription("The channel to send the verfiy message to.") + .setRequired(true))) + .addSubcommand((subcommand) => subcommand - .setName("sendstaffapplication") - .setDescription("Send the application message to a channel.") - .addChannelOption((option) => + .setName("sendwaitinglistmessage") + .setDescription("Send the waiting list message to a channel.") + .addChannelOption((option) => option - .setName("channel") - .setDescription("The channel to send the application to.") - .setRequired(true), - ), - ) - .addSubcommand((subcommand) => - subcommand - .setName("sendverfiymessage") - .setDescription("Send the verfiy message to a channel.") - .addChannelOption((option) => - option - .setName("channel") - .setDescription("The channel to send the verfiy message to.") - .setRequired(true), - ), - ) - .addSubcommand((subcommand) => - subcommand - .setName("sendwaitinglistmessage") - .setDescription("Send the waiting list message to a channel.") - .addChannelOption((option) => - option - .setName("channel") - .setDescription("The channel to send the waiting list message to.") - .setRequired(true), - ), - ) - .addSubcommand((subcommand) => - subcommand - .setName("sendinactivityapplication") - .setDescription("Send the application message to a channel.") - .addChannelOption((option) => - option - .setName("channel") - .setDescription("The channel to send the application to.") - .setRequired(true), - ), - ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setName("channel") + .setDescription("The channel to send the waiting list message to.") + .setRequired(true))) + .addSubcommand((subcommand) => + subcommand + .setName("sendinactivityapplication") + .setDescription("Send the application message to a channel.") + .addChannelOption((option) => + option + .setName("channel") + .setDescription("The channel to send the application to.") + .setRequired(true))) + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), - async execute(interaction) { - const user = interaction.user; - const guild = interaction.guild; - const subcommand = interaction.options.getSubcommand(); - const embedColor = Number(color.replace("#", "0x")); + async execute(interaction) { + const user = interaction.user; + const guild = interaction.guild; + const subcommand = interaction.options.getSubcommand(); + const embedColor = Number(color.replace("#", "0x")); - if (subcommand === "sendguildapplication") { - const channel = interaction.options.getChannel("channel"); - await channel.send({ - embeds: [ - { - title: "Guild Application", - description: "You can apply for the guild by clicking the button below.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - iconURL: interaction.guild.iconURL({ dynamic: true }), - }, - thumbnail: { - url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("guildapply") - .setLabel("Apply") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "✅" }), - ), - ], - }); - await interaction.reply({ content: "Message sent", ephemeral: true }); - } + if (subcommand === "sendguildapplication") { + const channel = interaction.options.getChannel("channel"); - if (subcommand === "sendstaffapplication") { - const channel = interaction.options.getChannel("channel"); + await channel.send({ + embeds: [ + { + title: "Guild Application", + description: "You can apply for the guild by clicking the button below.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + iconURL: interaction.guild.iconURL({ dynamic: true }) + }, + thumbnail: { + url: interaction.guild.iconURL({ dynamic: true }) + } + } + ], + components: [ + new ActionRowBuilder() + .addComponents(new ButtonBuilder() + .setCustomId("guildapply") + .setLabel("Apply") + .setStyle(ButtonStyle.Primary) + .setEmoji({ name: "✅" })) + ] + }); + await interaction.reply({ content: "Message sent", ephemeral: true }); + } - await channel.send({ - embeds: [ - { - title: "Staff Application", - description: "You can apply for the staff team by clicking the button below.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - iconURL: interaction.guild.iconURL({ dynamic: true }), - }, - thumbnail: { - url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("staffapply") - .setLabel("Apply") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "✅" }), - ), - ], - }); + if (subcommand === "sendstaffapplication") { + const channel = interaction.options.getChannel("channel"); - await interaction.reply({ content: "Message sent", ephemeral: true }); - } + await channel.send({ + embeds: [ + { + title: "Staff Application", + description: "You can apply for the staff team by clicking the button below.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + iconURL: interaction.guild.iconURL({ dynamic: true }) + }, + thumbnail: { + url: interaction.guild.iconURL({ dynamic: true }) + } + } + ], + components: [ + new ActionRowBuilder() + .addComponents(new ButtonBuilder() + .setCustomId("staffapply") + .setLabel("Apply") + .setStyle(ButtonStyle.Primary) + .setEmoji({ name: "✅" })) + ] + }); - if (subcommand === "sendinactivityapplication") { - const channel = interaction.options.getChannel("channel"); + await interaction.reply({ content: "Message sent", ephemeral: true }); + } - await channel.send({ - embeds: [ - { - title: "Inactivity Log", - description: "You can send an inactivity log by clicking the button below.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - iconURL: interaction.guild.iconURL({ dynamic: true }), - }, - thumbnail: { - url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("guildinactivitylog") - .setLabel("Submit") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "✅" }), - ), - ], - }); + if (subcommand === "sendinactivityapplication") { + const channel = interaction.options.getChannel("channel"); - await interaction.reply({ content: "Message sent", ephemeral: true }); - } + await channel.send({ + embeds: [ + { + title: "Inactivity Log", + description: "You can send an inactivity log by clicking the button below.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + iconURL: interaction.guild.iconURL({ dynamic: true }) + }, + thumbnail: { + url: interaction.guild.iconURL({ dynamic: true }) + } + } + ], + components: [ + new ActionRowBuilder() + .addComponents(new ButtonBuilder() + .setCustomId("guildinactivitylog") + .setLabel("Submit") + .setStyle(ButtonStyle.Primary) + .setEmoji({ name: "✅" })) + ] + }); + + await interaction.reply({ content: "Message sent", ephemeral: true }); + } if (subcommand === "sendverfiymessage") { const channel = interaction.options.getChannel("channel"); - await channel.send({ - embeds: [ - { - title: "Verification", - description: "You can verify by clicking the button below.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - iconURL: interaction.guild.iconURL({ dynamic: true }), - }, - thumbnail: { - url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("verifybutton") - .setLabel("Verify") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "✅" }), - ), - ], - }); - await interaction.reply({ content: "Message sent", ephemeral: true }); + await channel.send({ + embeds: [{ + title: "Verification", + description: "You can verify by clicking the button below.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + iconURL: interaction.guild.iconURL({ dynamic: true }) + }, + thumbnail: { + url: interaction.guild.iconURL({ dynamic: true }) + } + }], + components: [ + new ActionRowBuilder() + .addComponents(new ButtonBuilder() + .setCustomId("verifybutton") + .setLabel("Verify") + .setStyle(ButtonStyle.Primary) + .setEmoji({ name: "✅" })) + ] + }); + await interaction.reply({ content: "Message sent", ephemeral: true }); + } - if (subcommand === "sendwaitinglistmessage") { - const channel = interaction.options.getChannel("channel"); + if (subcommand === "sendwaitinglistmessage") { + const channel = interaction.options.getChannel("channel"); - await channel.send({ - embeds: [ - { - title: "Waiting List", - description: "The people below were accepted into the guild\n" + "Try to invite them in order.", - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - iconURL: interaction.guild.iconURL({ dynamic: true }), - }, - thumbnail: { - url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("waitinglistupdate") - .setLabel("Update") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "🔄" }), - ), - ], - }); - await interaction.reply({ content: "Message sent", ephemeral: true }); - } - }, -}; + await channel.send({ + embeds: [{ + title: "Waiting List", + description: "The people below were accepted into the guild\n" + + "Try to invite them in order.", + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + iconURL: interaction.guild.iconURL({ dynamic: true }) + }, + thumbnail: { + url: interaction.guild.iconURL({ dynamic: true }) + } + }], + components: [ + new ActionRowBuilder() + .addComponents(new ButtonBuilder() + .setCustomId("waitinglistupdate") + .setLabel("Update") + .setStyle(ButtonStyle.Primary) + .setEmoji({ name: "🔄" })) + ] + }); + await interaction.reply({ content: "Message sent", ephemeral: true }); + } + + } +}; \ No newline at end of file diff --git a/commands/devel.js b/commands/devel.js index cc59b2a..bfd2659 100644 --- a/commands/devel.js +++ b/commands/devel.js @@ -1,60 +1,70 @@ -const { SlashCommandBuilder, PermissionFlagsBits, userMention, EmbedBuilder, ChannelType } = require("discord.js"); -const { hypixelGuildID, color } = require("../config/options.json"); -const { muted } = require("../config/roles.json"); -const verify = require("../schemas/verifySchema.js"); -const env = require("dotenv").config(); +const { SlashCommandBuilder, PermissionFlagsBits, userMention, EmbedBuilder, ChannelType } = require('discord.js'); +const { hypixelGuildID, color } = require('../config/options.json'); +const { muted } = require('../config/roles.json'); +const verify = require('../schemas/verifySchema.js'); +const env = require('dotenv').config(); const dev = process.env.DEV; -const fetch = require("axios"); +const fetch = require('axios'); module.exports = { - name: "admin", - description: "Admin command.", - type: "slash", + name: 'admin', + description: 'Admin command.', + type: 'slash', data: new SlashCommandBuilder() - .setName("devel") - .setDescription("Admin command.") - .addSubcommand((subcommand) => subcommand.setName("reload").setDescription("Reload the bot.")) - .addSubcommand((subcommand) => subcommand.setName("listallverified").setDescription("List all verified users.")) - .addSubcommand((subcommand) => + .setName('devel') + .setDescription('Admin command.') + .addSubcommand(subcommand => subcommand - .setName("purgereactions") - .setDescription("Purge all reactions from a messages.") - .addIntegerOption((option) => - option.setName("count").setDescription("Count of messages to purge reactions from."), - ), - ) + .setName('reload') + .setDescription('Reload the bot.')) + .addSubcommand(subcommand => + subcommand + .setName('listallverified') + .setDescription('List all verified users.')) + .addSubcommand(subcommand => + subcommand + .setName('purgereactions') + .setDescription('Purge all reactions from a messages.') + .addIntegerOption(option => + option + .setName('count') + .setDescription('Count of messages to purge reactions from.'))) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), async execute(interaction) { + const subcommand = interaction.options.getSubcommand(); const user = interaction.user; const userMentioned = userMention(user.id); const guild = interaction.guild; const embedColor = Number(color.replace("#", "0x")); - if (subcommand === "reload") { - const { exec } = require("child_process"); - await interaction.reply({ content: "Reloading...", ephemeral: true }); + if (subcommand === 'reload') { - exec("pm2 restart 0", async (err, stdout, stderr) => { + const { exec } = require('child_process'); + await interaction.reply({ content: 'Reloading...', ephemeral: true }) + + exec('pm2 restart 0', async (err, stdout, stderr) => { if (err) { - await interaction.reply({ content: "Error while reloading: " + err, ephemeral: true }); + await interaction.reply({ content: 'Error while reloading: ' + err, ephemeral: true }) } - }); + }) } - if (subcommand === "listallverified") { - const verifiedUsers = await verify.find(); - const mojang = "https://api.mojang.com/user/profile/"; + if (subcommand === 'listallverified') { + + const verifiedUsers = await verify.find() + const mojang = "https://api.mojang.com/user/profile/" let embed = new EmbedBuilder() .setTitle(guild.name) .setColor(embedColor) - .setDescription("List of all verified users"); + .setDescription('List of all verified users') for (let i = 0; i < verifiedUsers.length; i++) { + const user = verifiedUsers[i]; const userCheck = await fetch(mojang + user.uuid); @@ -64,34 +74,34 @@ module.exports = { embed.addFields({ name: "**IGN:** " + ign, - value: "**Discord:** " + mentionedUser, - }); + value: "**Discord:** " + mentionedUser + }) + } await interaction.reply({ - embeds: [embed], - }); + embeds: [embed] + }) } - if (subcommand === "purgereactions") { - const count = interaction.options.getInteger("count"); - await interaction.deferReply({}); + if (subcommand === 'purgereactions') { + + const count = interaction.options.getInteger('count'); + await interaction.deferReply({}) if (user.id !== dev) { - interaction.editReply({ - content: "Due to you not screwing something up this command is restricted to only " + userMentioned, - ephemeral: true, - }); - return; + interaction.editReply({ content: 'Due to you not screwing something up this command is restricted to only ' + userMentioned, ephemeral: true }) + return } const messages = await interaction.channel.messages.fetch({ limit: count }); messages.forEach(async (message) => { await message.reactions.removeAll(); - }); + }) + + await interaction.editReply(`Purged reactions from ${count} message(s).`) - await interaction.editReply(`Purged reactions from ${count} message(s).`); } - }, -}; + } +}; \ No newline at end of file diff --git a/commands/forceunverify.js b/commands/forceunverify.js index 40394d0..a5b3e99 100644 --- a/commands/forceunverify.js +++ b/commands/forceunverify.js @@ -1,67 +1,55 @@ -const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js"); +const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js'); const { color } = require("../config/options.json"); const verify = require("../schemas/verifySchema.js"); const mongoose = require("mongoose"); -const { - gm, - manager, - moderator, - beast, - member, - trialmember, - guildRole, - guildStaff, - defaultMember, -} = require("../config/roles.json"); -const removeThese = [gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember]; +const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json"); +const removeThese = [ gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember ] module.exports = { name: "forceunverify", description: "Force unverify a user", - type: "slash", + type: 'slash', data: new SlashCommandBuilder() - .setName("forceunverify") - .setDescription("Force unverify a user") - .addUserOption((option) => - option.setName("user").setDescription("The user to force unverify").setRequired(true), - ) + .setName('forceunverify') + .setDescription('Force unverify a user') + .addUserOption(option => + option + .setName('user') + .setDescription('The user to force unverify') + .setRequired(true)) .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction) { - const member1 = interaction.options.getUser("user"); - const member = interaction.guild.members.cache.get(member1.id); - const embedColor = Number(color.replace("#", "0x")); - const verifiedUser = await verify.findOne({ userID: member1.id }); - const user = interaction.user; + const member1 = interaction.options.getUser('user'); + const member = interaction.guild.members.cache.get(member1.id) + const embedColor = Number(color.replace('#', '0x')) + const verifiedUser = await verify.findOne({ userID: member1.id }) + const user = interaction.user if (!verifiedUser) { return interaction.reply({ - embeds: [ - { - description: "This user is not verified", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "This user is not verified", + color: embedColor, + }] + }) } - await verify.findOneAndDelete({ userID: member1.id }); - - await member.roles.remove(removeThese); + await verify.findOneAndDelete({ userID: member1.id }) + + await member.roles.remove(removeThese) await interaction.reply({ - embeds: [ - { - description: "Successfully unverified" + userMention(member1.id), - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by taken.lua", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - }, -}; + embeds: [{ + description: "Successfully unverified" + userMention(member1.id), + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by taken.lua", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + } +} diff --git a/commands/forceupdate.js b/commands/forceupdate.js index 22851ba..a072c2e 100644 --- a/commands/forceupdate.js +++ b/commands/forceupdate.js @@ -1,41 +1,35 @@ -const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js"); -const env = require("dotenv").config(); +const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js'); +const env = require('dotenv').config(); const hypixelAPIKey = process.env.HYPIXELAPIKEY; -const { hypixelGuildID, color } = require("../config/options.json"); -const { - gm, - manager, - moderator, - beast, - elite, - member, - trialmember, - guildRole, - guildStaff, - defaultMember, -} = require("../config/roles.json"); -const verify = require("../schemas/verifySchema.js"); -const fetch = require("axios"); -const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff]; +const { hypixelGuildID, color } = require('../config/options.json'); +const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json'); +const verify = require('../schemas/verifySchema.js') +const fetch = require('axios'); +const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff] module.exports = { - name: "forceupdate", - description: "Force update the user", - type: "slash", + name: 'forceupdate', + description: 'Force update the user', + type: 'slash', data: new SlashCommandBuilder() - .setName("forceupdate") - .setDescription("Force update the user") - .addUserOption((option) => option.setName("user").setDescription("The user to force update").setRequired(true)) + .setName('forceupdate') + .setDescription('Force update the user') + .addUserOption(option => + option + .setName('user') + .setDescription('The user to force update') + .setRequired(true)) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), async execute(interaction) { + await interaction.deferReply(); - const user = interaction.options.getUser("user"); + const user = interaction.options.getUser('user'); const usermentioned = userMention(user.id); - const verifyData = await verify.findOne({ userID: user.id }); + const verifyData = await verify.findOne({ userID: user.id }) const embedColor = Number(color.replace("#", "0x")); const user1 = interaction.guild.members.cache.get(user.id); @@ -43,253 +37,252 @@ module.exports = { if (!verifyData) { await interaction.editReply({ - embeds: [ - { - description: "You are not verified. Please run `/verify` to verify yourself", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, + embeds: [{ + description: "You are not verified. Please run `/verify` to verify yourself", + color: embedColor, + thumbnail: { + url: head }, - ], - }); - return; + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return } - const mojangAPI = "https://api.mojang.com/user/profile/"; - const guildlAPI = "https://api.hypixel.net/guild"; + const mojangAPI = "https://api.mojang.com/user/profile/" + const guildlAPI = "https://api.hypixel.net/guild" const minotar = "https://minotar.net/helm/"; - const guild = guildlAPI + "?key=" + hypixelAPIKey + "&player=" + verifyData.uuid; + const guild = guildlAPI + "?key=" + hypixelAPIKey + "&player=" + verifyData.uuid; const userCheck = await fetch(mojangAPI + verifyData.uuid); const guildCheck = await fetch(guild); const head = minotar + userCheck.data.name; - if (!guildCheck.data.guild) { - var responseGuildID = null; - } else { - var responseGuildID = guildCheck.data.guild._id; - } - + if (!guildCheck.data.guild) { + var responseGuildID = null + } else { + var responseGuildID = guildCheck.data.guild._id + } + if (responseGuildID !== hypixelGuildID) { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)"); - } - await interaction.editReply({ - embeds: [ - { - description: usermentioned + " was given the the Default Member role.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - await roleManage.add(defaultMember); - return; - } + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") + } - if (responseGuildID === hypixelGuildID) { - const GuildMembers = guildCheck.data.guild.members; - const guildRank = GuildMembers.find((member) => member.uuid === verifyData.uuid).rank; + await interaction.editReply({ + embeds: [{ + description: usermentioned + " was given the the Default Member role.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + await roleManage.add(defaultMember) + return + } - if (guildRank === "Guild Master") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)"); - } + if (responseGuildID === hypixelGuildID) { - await roleManage.add(guildRole, "User was force updated."); - await roleManage.add(guildStaff, "User was force updated."); - await roleManage.add(gm, "User was force updated."); - await roleManage.add(defaultMember, "User was force updated."); + const GuildMembers = guildCheck.data.guild.members; + const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; - await interaction.editReply({ - embeds: [ - { - description: usermentioned + "'s rank has been updated to `Guild Master`", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - } + if (guildRank === 'Guild Master') { - if (guildRank === "Manager") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)"); - } + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") + } - await roleManage.add(guildRole, "User was force updated."); - await roleManage.add(guildStaff, "User was force updated."); - await roleManage.add(manager, "User was force updated."); - await roleManage.add(defaultMember, "User was force updated."); + await roleManage.add(guildRole, "User was force updated.") + await roleManage.add(guildStaff, "User was force updated.") + await roleManage.add(gm, "User was force updated.") + await roleManage.add(defaultMember, "User was force updated.") - await interaction.editReply({ - embeds: [ - { - description: usermentioned + "'s rank has been updated to `Manager`", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - } - if (guildRank === "Moderator") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)"); - } + await interaction.editReply({ + embeds: [{ + description: usermentioned + "'s rank has been updated to `Guild Master`", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + } - await roleManage.add(guildRole, "User was force updated."); - await roleManage.add(guildStaff, "User was force updated."); - await roleManage.add(moderator, "User was force updated."); - await roleManage.add(defaultMember, "User was force updated."); + if (guildRank === 'Manager') { - await interaction.editReply({ - embeds: [ - { - description: usermentioned + "'s rank has been updated to `Moderator`", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - } + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") + } - if (guildRank === "Beast") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)"); - } + await roleManage.add(guildRole, "User was force updated.") + await roleManage.add(guildStaff, "User was force updated.") + await roleManage.add(manager, "User was force updated.") + await roleManage.add(defaultMember, "User was force updated.") - await roleManage.add(guildRole, "User was force updated."); - await roleManage.add(beast, "User was force updated."); - await roleManage.add(defaultMember, "User was force updated."); - await interaction.editReply({ - embeds: [ - { - description: usermentioned + "'s rank has been updated to `Beast`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } + await interaction.editReply({ + embeds: [{ + description: usermentioned + "'s rank has been updated to `Manager`", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + } - if (guildRank === "Elite") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)"); - } + if (guildRank === 'Moderator') { - await roleManage.add(guildRole, "User was force updated."); - await roleManage.add(elite, "User was force updated."); - await roleManage.add(defaultMember, "User was force updated."); + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") + } - await interaction.editReply({ - embeds: [ - { - description: usermentioned + "'s rank has been updated to `Elite`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } + await roleManage.add(guildRole, "User was force updated.") + await roleManage.add(guildStaff, "User was force updated.") + await roleManage.add(moderator, "User was force updated.") + await roleManage.add(defaultMember, "User was force updated.") - if (guildRank === "Member") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)"); - } - await roleManage.add(guildRole, "User was force updated."); - await roleManage.add(member, "User was force updated."); - await roleManage.add(defaultMember, "User was force updated."); + await interaction.editReply({ + embeds: [{ + description: usermentioned + "'s rank has been updated to `Moderator`", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) - await interaction.editReply({ - embeds: [ - { - description: usermentioned + "'s rank has been updated to `Member`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } + } - if (guildRank === "Trial Member") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)"); - } + if (guildRank === 'Beast') { - await roleManage.add(guildRole, "User was force updated."); - await roleManage.add(trialmember, "User was force updated."); - await roleManage.add(defaultMember, "User was force updated."); + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") + } - await interaction.editReply({ - embeds: [ - { - description: usermentioned + "'s rank has been updated to `Trial Member`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } - } - }, -}; + await roleManage.add(guildRole, "User was force updated.") + await roleManage.add(beast, "User was force updated.") + await roleManage.add(defaultMember, "User was force updated.") + + + await interaction.editReply({ + embeds: [{ + description: usermentioned + "'s rank has been updated to `Beast`.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + + if (guildRank === 'Elite') { + + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") + } + + await roleManage.add(guildRole, "User was force updated.") + await roleManage.add(elite, "User was force updated.") + await roleManage.add(defaultMember, "User was force updated.") + + + await interaction.editReply({ + embeds: [{ + description: usermentioned + "'s rank has been updated to `Elite`.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + + if (guildRank === 'Member') { + + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") + } + + await roleManage.add(guildRole, "User was force updated.") + await roleManage.add(member, "User was force updated.") + await roleManage.add(defaultMember, "User was force updated.") + + + await interaction.editReply({ + embeds: [{ + description: usermentioned + "'s rank has been updated to `Member`.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + + if (guildRank === 'Trial Member') { + + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") + } + + await roleManage.add(guildRole, "User was force updated.") + await roleManage.add(trialmember, "User was force updated.") + await roleManage.add(defaultMember, "User was force updated.") + + + await interaction.editReply({ + embeds: [{ + description: usermentioned + "'s rank has been updated to `Trial Member`.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + } + } +} \ No newline at end of file diff --git a/commands/forceverify.js b/commands/forceverify.js index 433e0db..6ec021d 100644 --- a/commands/forceverify.js +++ b/commands/forceverify.js @@ -1,194 +1,180 @@ -const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js"); -const env = require("dotenv").config(); +const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); +const env = require('dotenv').config(); const hypixelApiKey = process.env.HYPIXELAPIKEY; -const fetch = require("axios"); -const { color, hypixelGuildID } = require("../config/options.json"); -const verify = require("../schemas/verifySchema.js"); -const { mongoose } = require("mongoose"); -const { - gm, - manager, - moderator, - beast, - elite, - member, - trialmember, - guildRole, - guildStaff, - defaultMember, -} = require("../config/roles.json"); +const fetch = require('axios'); +const { color, hypixelGuildID } = require('../config/options.json'); +const verify = require('../schemas/verifySchema.js') +const {mongoose} = require('mongoose'); +const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json'); + module.exports = { - name: "forceverify", - description: "Force verify a user.", - type: "slash", + name: 'forceverify', + description: 'Force verify a user.', + type: 'slash', data: new SlashCommandBuilder() - .setName("forceverify") - .setDescription("Force verify a user.") - .addUserOption((option) => option.setName("user").setDescription("The user to force verify.")) - .addStringOption((option) => option.setName("ign").setDescription("The user's in-game name.")) + .setName('forceverify') + .setDescription('Force verify a user.') + .addUserOption(option => + option + .setName('user') + .setDescription('The user to force verify.')) + .addStringOption(option => + option + .setName('ign') + .setDescription('The user\'s in-game name.')) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), - + async execute(interaction) { + await interaction.deferReply(); - const user1 = interaction.options.getUser("user"); + const user1 = interaction.options.getUser('user'); const user = interaction.guild.members.cache.get(user1.id); - const ign = interaction.options.getString("ign"); - const mod = interaction.user; - + const ign = interaction.options.getString('ign'); + const mod = interaction.user + // const slothPixel = "https://api.slothpixel.me/api/players/"; // const guildAPI = "https://api.slothpixel.me/api/guilds/" - const mojang = "https://api.mojang.com/users/profiles/minecraft/"; - const hypixelApi = "https://api.hypixel.net/player"; - const guildApi = "https://api.hypixel.net/guild"; + const mojang = "https://api.mojang.com/users/profiles/minecraft/" + const hypixelApi = "https://api.hypixel.net/player" + const guildApi = "https://api.hypixel.net/guild" const minotar = "https://minotar.net/helm/"; const embedColor = Number(color.replace("#", "0x")); if (!user) { - interaction.editReply( - "Please provide a user to force verify.\nThis can also mean the user is not in the server.", - ); - return; + interaction.editReply('Please provide a user to force verify.\nThis can also mean the user is not in the server.') + return } - const verifyData = await verify.findOne({ userID: user.id }); + const verifyData = await verify.findOne({ userID: user.id }) if (verifyData) { - interaction.editReply("That user is already verified."); - return; + interaction.editReply('That user is already verified.') + return } if (!ign) { - interaction.editReply("Please provide a player's IGN."); - return; + interaction.editReply('Please provide a player\'s IGN.') + return } if (user1.discriminator == "0") { - var username = user1.username; + var username = user1.username } else { - var username = user1.username + "#" + user1.discriminator; + var username = user1.username + "#" + user1.discriminator } if (mod.discriminator == "0") { - var modName = mod.username; + var modName = mod.username } else { - var modName = mod.username + "#" + mod.discriminator; + var modName = mod.username + "#" + mod.discriminator } try { await fetch(mojang + ign); } catch (err) { - interaction.editReply("That player doesn't exist. [Mojang]"); - return; + interaction.editReply('That player doesn\'t exist. [Mojang]') + return } const userCheck = await fetch(mojang + ign); const userUUID = userCheck.data.id; - const player = hypixelApi + "?key=" + hypixelApiKey + "&uuid=" + userUUID; - const guild = guildApi + "?key=" + hypixelApiKey + "&player=" + userUUID; + const player = hypixelApi + "?key=" + hypixelApiKey + "&uuid=" + userUUID + const guild = guildApi + "?key=" + hypixelApiKey + "&player=" + userUUID const head = minotar + ign; const hypixelCheck = await fetch(player); - if (!hypixelCheck.data.player) { + if (!hypixelCheck.data.player) { interaction.editReply({ - embeds: [ - { - description: - " That player hasn't played Hypixel before.", - color: embedColor, - }, - ], + embeds: [{ + description: " That player hasn't played Hypixel before.", + color: embedColor + }] }); return; - } + } - const guildCheck = await fetch(guild); + const guildCheck = await fetch(guild) if (!guildCheck.data.guild) { - var responseGuildID = null; + var responseGuildID = null } else { - var responseGuildID = guildCheck.data.guild._id; + var responseGuildID = guildCheck.data.guild._id } if (responseGuildID === hypixelGuildID) { - const GuildMembers = guildCheck.data.guild.members; - const guildRank = GuildMembers.find((member) => member.uuid === hypixelCheck.data.player.uuid).rank; + const GuildMembers = guildCheck.data.guild.members; + const guildRank = GuildMembers.find(member => member.uuid === hypixelCheck.data.player.uuid).rank; - if (guildRank === "Guild Master") { - await user.roles.add(gm, "User was force verified by " + modName); - await user.roles.add(guildRole, "User was force verified by " + modName); - await user.roles.add(guildStaff, "User was force verified by " + modName); - } + if (guildRank === "Guild Master") { + await user.roles.add(gm, "User was force verified by " + modName); + await user.roles.add(guildRole, "User was force verified by " + modName) + await user.roles.add(guildStaff, "User was force verified by " + modName) + } - if (guildRank === "Manager") { - await user.roles.add(manager, "User was force verified by " + modName); - await user.roles.add(guildRole, "User was force verified by " + modName); - await user.roles.add(guildStaff, "User was force verified by " + modName); - } + if (guildRank === "Manager") { + await user.roles.add(manager, "User was force verified by " + modName); + await user.roles.add(guildRole, "User was force verified by " + modName) + await user.roles.add(guildStaff, "User was force verified by " + modName) + } - if (guildRank === "Moderator") { - await user.roles.add(moderator, "User was force verified by " + modName); - await user.roles.add(guildRole, "User was force verified by " + modName); - await user.roles.add(guildStaff, "User was force verified by " + modName); - } + if (guildRank === "Moderator") { + await user.roles.add(moderator, "User was force verified by " + modName); + await user.roles.add(guildRole, "User was force verified by " + modName) + await user.roles.add(guildStaff, "User was force verified by " + modName) + } - if (guildRank === "Beast") { - await user.roles.add(beast, "User was force verified by " + modName); - await user.roles.add(guildRole, "User was force verified by " + modName); - } + if (guildRank === "Beast") { + await user.roles.add(beast, "User was force verified by " + modName); + await user.roles.add(guildRole, "User was force verified by " + modName) + } - if (guildRank === "Elite") { - await user.roles.add(elite, "User was force verified by " + modName); - await user.roles.add(guildRole, "User was force verified by " + modName); - } + if (guildRank === "Elite") { + await user.roles.add(elite, "User was force verified by " + modName); + await user.roles.add(guildRole, "User was force verified by " + modName) + } - if (guildRank === "Member") { - await user.roles.add(member, "User was force verified by " + modName); - await user.roles.add(guildRole, "User was force verified by " + modName); - } + if (guildRank === "Member") { + await user.roles.add(member, "User was force verified by " + modName); + await user.roles.add(guildRole, "User was force verified by " + modName) + } - if (guildRank === "Trial Member") { - await user.roles.add(trialmember, "User was force verified by " + modName); - await user.roles.add(guildRole, "User was force verified by " + modName); - } - } + if (guildRank === "Trial Member") { + await user.roles.add(trialmember, "User was force verified by " + modName); + await user.roles.add(guildRole, "User was force verified by " + modName) + } + } await user.roles.add(defaultMember, "User was force verified by " + modName); - + const newVerify = new verify({ _id: new mongoose.Types.ObjectId(), userID: user.id, - uuid: userUUID, - }); + uuid: userUUID + }) await newVerify.save(); await interaction.editReply({ - embeds: [ - { - title: interaction.guild.name, - description: - "You have successfully force verified `" + - username + - "` with the account `" + - hypixelCheck.data.player.displayname + - "`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - icon_url: interaction.guild.iconURL(), - text: interaction.guild.name + " | Developed by Taken#0002", - }, + embeds: [{ + title: interaction.guild.name, + description: "You have successfully force verified `" + username + "` with the account `" + hypixelCheck.data.player.displayname + "`.", + color: embedColor, + thumbnail: { + url: head }, - ], + footer: { + icon_url: interaction.guild.iconURL(), + text: interaction.guild.name + " | Developed by Taken#0002" + } + }] }); - }, -}; + + } +}; \ No newline at end of file diff --git a/commands/help.js b/commands/help.js index fbb0ab4..09dcdf6 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,51 +1,54 @@ -const { SlashCommandBuilder, ChannelType } = require("discord.js"); -const { color } = require("../config/options.json"); +const { SlashCommandBuilder, ChannelType } = require('discord.js'); +const { color } = require('../config/options.json'); module.exports = { - name: "help", - description: "Help command", - type: "slash", - - data: new SlashCommandBuilder().setName("help").setDescription("Help command").setDMPermission(true), + name: 'help', + description: 'Help command', + type: 'slash', + + data: new SlashCommandBuilder() + .setName('help') + .setDescription('Help command') + .setDMPermission(true), async execute(interaction) { + await interaction.deferReply({ ephemeral: true }); - const embedColor = Number(color.replace("#", "0x")); + const embedColor = Number(color.replace('#', '0x')); await interaction.editReply({ - 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", - }, - ], - color: embedColor, - thumbnail: { - url: interaction.guild.iconURL({ dynamic: true }), + embeds: [{ + title: 'Commands', + description: "List of commands", + fields: [ + { + name: '/check', + value: 'Check the stats of a player' }, - footer: { - icon_url: interaction.guild.iconURL({ dynamic: true }), - text: interaction.guild.name + " | Developed by: @Taken#0001", + { + name: '/reqs', + value: 'Check the requirements of the guild' }, + { + name: '/update', + value: 'Update\'s your roles' + }, + { + name: '/help', + value: 'Shows this message' + } + ], + color: embedColor, + thumbnail: { + url: interaction.guild.iconURL({ dynamic: true }) }, - ], + footer: { + icon_url: interaction.guild.iconURL({ dynamic: true }), + text: interaction.guild.name + ' | Developed by: @Taken#0001' + } + }] }); - }, -}; + + } +}; \ No newline at end of file diff --git a/commands/reqs.js b/commands/reqs.js index a0c09b1..679e052 100644 --- a/commands/reqs.js +++ b/commands/reqs.js @@ -1,54 +1,51 @@ -const { SlashCommandBuilder } = require("discord.js"); -const { color } = require("../config/options.json"); -const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../config/reqs.json"); +const { SlashCommandBuilder } = require('discord.js'); +const { color } = require('../config/options.json'); +const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require('../config/reqs.json'); module.exports = { - name: "reqs", - description: "Displays the requirements for the guild.", - type: "slash", - data: new SlashCommandBuilder().setName("reqs").setDescription("Displays the requirements for the guild."), + name: 'reqs', + description: 'Displays the requirements for the guild.', + type: 'slash', + data: new SlashCommandBuilder() + .setName('reqs') + .setDescription('Displays the requirements for the guild.'), async execute(interaction) { + await interaction.deferReply({ ephemeral: true }); const embedColor = Number(color.replace("#", "0x")); await interaction.editReply({ - embeds: [ - { - title: "Requirements", - description: "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**", - color: embedColor, - thumbnail: { - url: interaction.guild.iconURL(), - }, - fields: [ - { - name: "**Bedwars**", - value: - "**Stars:** `" + - bwstars.toString() + - "`\n**Wins:** `" + - bwwins.toString() + - "`\n**FKDR:** `" + - bwfkdr.toString() + - "`", - }, - { - name: "**Skywars**", - value: "**Stars:** `" + swstars.toString() + "`", - }, - { - name: "**Duels**", - value: "**Wins:** `" + duelswins.toString() + "`\n**WLR:** `" + duelswlr.toString() + "`", - }, - ], - footer: { - text: interaction.guild.name + " | Developed by: @Taken#0002", - icon_url: interaction.guild.iconURL(), - }, + embeds: [{ + title: 'Requirements', + description: '**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**', + color: embedColor, + thumbnail: { + url: interaction.guild.iconURL() }, - ], - }); - }, -}; + fields: [ + { + name: '**Bedwars**', + value: '**Stars:** `' + bwstars.toString() + + '`\n**Wins:** `' + bwwins.toString() + + '`\n**FKDR:** `' + bwfkdr.toString() + '`' + }, + { + name: '**Skywars**', + value: '**Stars:** `' + swstars.toString() + '`' + }, + { + name: '**Duels**', + value: '**Wins:** `' + duelswins.toString() + + '`\n**WLR:** `' + duelswlr.toString() + '`' + } + ], + footer: { + text: interaction.guild.name + ' | Developed by: @Taken#0002', + icon_url: interaction.guild.iconURL() + } + }] + }) + } +} diff --git a/commands/send.js b/commands/send.js index b274f3c..3a44581 100644 --- a/commands/send.js +++ b/commands/send.js @@ -1,34 +1,41 @@ -const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js"); -const { color } = require("../config/options.json"); +const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); +const { color } = require('../config/options.json'); module.exports = { - name: "send", - description: "Send a message to a channel.", - type: "slash", + name: 'send', + description: 'Send a message to a channel.', + type: 'slash', data: new SlashCommandBuilder() - .setName("send") - .setDescription("Send a message to a channel.") - .addStringOption((option) => option.setName("message").setDescription("The message to send.")) - .addChannelOption((option) => option.setName("channel").setDescription("The channel to send the message to.")) + .setName('send') + .setDescription('Send a message to a channel.') + .addStringOption(option => + option + .setName('message') + .setDescription('The message to send.')) + .addChannelOption(option => + option + .setName('channel') + .setDescription('The channel to send the message to.')) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), - + async execute(interaction) { + await interaction.deferReply({ ephemeral: true }); - const message = interaction.options.getString("message"); - const channel = interaction.options.getChannel("channel"); + const message = interaction.options.getString('message'); + const channel = interaction.options.getChannel('channel'); const embedColor = Number(color.replace("#", "0x")); if (!message) { - interaction.editReply({ content: "Please provide a message to send.", ephemeral: true }); - return; + interaction.editReply({ content: 'Please provide a message to send.', ephemeral: true }) + return } if (!channel) { - interaction.editReply({ content: "Please provide a channel to send the message to.", ephemeral: true }); - return; + interaction.editReply({ content: 'Please provide a channel to send the message to.', ephemeral: true }) + return } channel.send({ @@ -38,13 +45,13 @@ module.exports = { description: message, color: embedColor, thumbnail: { - url: interaction.guild.iconURL({ dynamic: true }), + url: interaction.guild.iconURL({ dynamic: true }) }, footer: { - text: "Developed by @Taken#0002", - }, - }, - ], + text: "Developed by @Taken#0002" + } + } + ] }); - }, -}; + } +}; \ No newline at end of file diff --git a/commands/setnick.js b/commands/setnick.js index a69479e..4a8a74f 100644 --- a/commands/setnick.js +++ b/commands/setnick.js @@ -1,34 +1,39 @@ -const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js"); +const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js') module.exports = { - name: "setnick", - description: "Set your nickname", - type: "slash", + name: 'setnick', + description: 'Set your nickname', + type: 'slash', data: new SlashCommandBuilder() - .setName("setnick") - .setDescription("Set your nickname") - .addUserOption((option) => - option.setName("user").setDescription("The user to set the nickname for").setRequired(true), - ) - .addStringOption((option) => option.setName("nickname").setDescription("The nickname to set").setRequired(true)) + .setName('setnick') + .setDescription('Set your nickname') + .addUserOption(option => + option + .setName('user') + .setDescription('The user to set the nickname for') + .setRequired(true)) + .addStringOption(option => + option + .setName('nickname') + .setDescription('The nickname to set') + .setRequired(true)) .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames) .setDMPermission(false), async execute(interaction) { - const user = interaction.options.getUser("user"); - const nickname = interaction.options.getString("nickname"); + + const user = interaction.options.getUser('user'); + const nickname = interaction.options.getString('nickname'); const member = await interaction.guild.members.fetch(user.id); if (!member.manageable) { - return interaction.reply({ content: "I cannot set the nickname for this user!", ephemeral: true }); + return interaction.reply({ content: 'I cannot set the nickname for this user!', ephemeral: true }); } await member.setNickname(nickname, `Set by ${interaction.user.tag}`); - await interaction.reply({ - content: "Set the nickname of " + userMention(member.id) + " to " + nickname, - ephemeral: true, - }); - }, -}; + await interaction.reply({ content: "Set the nickname of " + userMention(member.id) + " to " + nickname, ephemeral: true }); + + } +} \ No newline at end of file diff --git a/commands/slowmode.js b/commands/slowmode.js index 3ec92d2..0a8e5cd 100644 --- a/commands/slowmode.js +++ b/commands/slowmode.js @@ -1,57 +1,59 @@ -const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js"); -const { color } = require("../config/options.json"); +const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); +const { color } = require('../config/options.json'); module.exports = { - name: "slowmode", - description: "Set the slowmode of a channel.", - type: "slash", + name: 'slowmode', + description: 'Set the slowmode of a channel.', + type: 'slash', data: new SlashCommandBuilder() - .setName("slowmode") - .setDescription("Set the slowmode of a channel.") - .addIntegerOption((option) => - option.setName("seconds").setDescription("The amount of seconds to set the slowmode to."), - ) - .addChannelOption((option) => option.setName("channel").setDescription("The channel to set the slowmode of.")) + .setName('slowmode') + .setDescription('Set the slowmode of a channel.') + .addIntegerOption(option => + option + .setName('seconds') + .setDescription('The amount of seconds to set the slowmode to.')) + .addChannelOption(option => + option + .setName('channel') + .setDescription('The channel to set the slowmode of.')) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), async execute(interaction) { + await interaction.deferReply({ ephermeral: true }); - const seconds = interaction.options.getInteger("seconds") ?? 5; - const channel = interaction.options.getChannel("channel") ?? interaction.channel; + const seconds = interaction.options.getInteger('seconds') ?? 5 + const channel = interaction.options.getChannel('channel') ?? interaction.channel const embedColor = Number(color.replace("#", "0x")); if (seconds > 21600) { - await channel.setRateLimitPerUser(21600); + await channel.setRateLimitPerUser(21600) await interaction.editReply({ - embeds: [ - { - description: `Set the slowmode of ${channel} to 21600 seconds.`, - color: embedColor, - footer: { - text: interaction.guild.name + " | Developed by: @Taken#0001", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } - - await interaction.editReply({ - embeds: [ - { - description: `Set the slowmode of ${channel} to ${seconds} seconds.`, + embeds: [{ + description: `Set the slowmode of ${channel} to 21600 seconds.`, color: embedColor, footer: { text: interaction.guild.name + " | Developed by: @Taken#0001", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - await channel.setRateLimitPerUser(seconds); - }, -}; + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + + await interaction.editReply({ + embeds: [{ + description: `Set the slowmode of ${channel} to ${seconds} seconds.`, + color: embedColor, + footer: { + text: interaction.guild.name + " | Developed by: @Taken#0001", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + await channel.setRateLimitPerUser(seconds) + + } +} \ No newline at end of file diff --git a/commands/update.js b/commands/update.js index bf81b76..3012cf1 100644 --- a/commands/update.js +++ b/commands/update.js @@ -1,289 +1,281 @@ -const { SlashCommandBuilder } = require("discord.js"); -const env = require("dotenv").config(); +const { SlashCommandBuilder } = require('discord.js'); +const env = require('dotenv').config(); const hypixelApiKey = process.env.HYPIXELAPIKEY; -const fetch = require("axios"); -const verify = require("../schemas/verifySchema.js"); -const { color, hypixelGuildID } = require("../config/options.json"); -const { - gm, - manager, - moderator, - beast, - elite, - member, - trialmember, - guildRole, - guildStaff, - defaultMember, -} = require("../config/roles.json"); +const fetch = require('axios'); +const verify = require('../schemas/verifySchema.js') +const { color, hypixelGuildID } = require('../config/options.json'); +const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json'); const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff]; module.exports = { - name: "update", - description: "Update your guild rank.", - type: "slash", + name: 'update', + description: 'Update your guild rank.', + type: 'slash', - data: new SlashCommandBuilder().setName("update").setDescription("Update your guild rank.").setDMPermission(false), + data: new SlashCommandBuilder() + .setName('update') + .setDescription('Update your guild rank.') + .setDMPermission(false), async execute(interaction) { + await interaction.deferReply(); const user1 = interaction.user; const user = interaction.guild.members.cache.get(user1.id); - const verifyData = await verify.findOne({ userID: user.id }); + const verifyData = await verify.findOne({ userID: user.id }) const roleManage = user.roles; const embedColor = Number(color.replace("#", "0x")); if (!verifyData) { await interaction.editReply({ - embeds: [ - { - description: "You are not verified. Please run `/verify` to verify yourself", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, + embeds: [{ + description: "You are not verified. Please run `/verify` to verify yourself", + color: embedColor, + thumbnail: { + url: head }, - ], - }); - return; + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return } - const mojangAPI = "https://api.mojang.com/user/profile/"; - const guildAPI = "https://api.hypixel.net/guild"; + const mojangAPI = "https://api.mojang.com/user/profile/" + const guildAPI = "https://api.hypixel.net/guild" const minotar = "https://minotar.net/helm/"; const userCheck = await fetch(mojangAPI + verifyData.uuid); const head = minotar + userCheck.data.name; - const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + verifyData.uuid; + const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + verifyData.uuid const guildCheck = await fetch(guild); if (!guildCheck.data.guild) { - var guildID = null; + var guildID = null } else { - var guildID = guildCheck.data.guild._id; + var guildID = guildCheck.data.guild._id } if (guildID !== hypixelGuildID) { + for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Update)"); + await roleManage.remove(removeThese[i], "Auto role removal. (Update)") } - await roleManage.add(defaultMember, "User used the update command"); + await roleManage.add(defaultMember, "User used the update command") await interaction.editReply({ - embeds: [ - { - description: "Updated your roles to `Default Member`", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, + embeds: [{ + description: "Updated your roles to `Default Member`", + color: embedColor, + thumbnail: { + url: head }, - ], - }); - return; + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return } - if (guildID === hypixelGuildID) { - const GuildMembers = guildCheck.data.guild.members; - const guildRank = GuildMembers.find((member) => member.uuid === verifyData.uuid).rank; + if (guildID === hypixelGuildID) { - if (guildRank === "Guild Master") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Update)"); - } + const GuildMembers = guildCheck.data.guild.members; + const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; - await roleManage.add(guildRole, "User used the update command"); - await roleManage.add(guildStaff, "User used the update command"); - await roleManage.add(gm, "User used the update command"); - await roleManage.add(defaultMember, "User used the update command"); + if (guildRank === 'Guild Master') { - await interaction.editReply({ - embeds: [ - { - description: "Your rank has been updated to `Guild Master`", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - } + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Update)") + } - if (guildRank === "Manager") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Update)"); - } + await roleManage.add(guildRole, "User used the update command") + await roleManage.add(guildStaff, "User used the update command") + await roleManage.add(gm, "User used the update command") + await roleManage.add(defaultMember, "User used the update command") - await roleManage.add(guildRole, "User used the update command"); - await roleManage.add(guildStaff, "User used the update command"); - await roleManage.add(manager, "User used the update command"); - await roleManage.add(defaultMember, "User used the update command"); - await interaction.editReply({ - embeds: [ - { - description: "Your rank has been updated to `Manager`", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - } + await interaction.editReply({ + embeds: [{ + description: "Your rank has been updated to `Guild Master`", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + } - if (guildRank === "Moderator") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Update)"); - } + if (guildRank === 'Manager') { - await roleManage.add(guildRole, "User used the update command"); - await roleManage.add(guildStaff, "User used the update command"); - await roleManage.add(moderator, "User used the update command"); - await roleManage.add(defaultMember, "User used the update command"); + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Update)") + } - await interaction.editReply({ - embeds: [ - { - description: "Your rank has been updated to `Moderator`", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - } + await roleManage.add(guildRole, "User used the update command") + await roleManage.add(guildStaff, "User used the update command") + await roleManage.add(manager, "User used the update command") + await roleManage.add(defaultMember, "User used the update command") - if (guildRank === "Beast") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Update)"); - } - await roleManage.add(guildRole, "User used the update command"); - await roleManage.add(beast, "User used the update command"); - await roleManage.add(defaultMember, "User used the update command"); + await interaction.editReply({ + embeds: [{ + description: "Your rank has been updated to `Manager`", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + } - await interaction.editReply({ - embeds: [ - { - description: "Your rank has been updated to `Beast`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } + if (guildRank === 'Moderator') { - if (guildRank === "Elite") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Update)"); - } + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Update)") + } - await roleManage.add(guildRole, "User used the update command"); - await roleManage.add(elite, "User used the update command"); - await roleManage.add(defaultMember, "User used the update command"); + await roleManage.add(guildRole, "User used the update command") + await roleManage.add(guildStaff, "User used the update command") + await roleManage.add(moderator, "User used the update command") + await roleManage.add(defaultMember, "User used the update command") - await interaction.editReply({ - embeds: [ - { - description: "Your rank has been updated to `Elite`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } - if (guildRank === "Member") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Update)"); - } + await interaction.editReply({ + embeds: [{ + description: "Your rank has been updated to `Moderator`", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) - await roleManage.add(guildRole, "User used the update command"); - await roleManage.add(member, "User used the update command"); - await roleManage.add(defaultMember, "User used the update command"); + } - await interaction.editReply({ - embeds: [ - { - description: "Your rank has been updated to `Member`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } + if (guildRank === 'Beast') { - if (guildRank === "Trial Member") { - for (let i = 0; i < removeThese.length; i++) { - await roleManage.remove(removeThese[i], "Auto role removal. (Update)"); - } + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Update)") + } - await roleManage.add(guildRole, "User used the update command"); - await roleManage.add(trialmember, "User used the update command"); - await roleManage.add(defaultMember, "User used the update command"); + await roleManage.add(guildRole, "User used the update command") + await roleManage.add(beast, "User used the update command") + await roleManage.add(defaultMember, "User used the update command") - await interaction.editReply({ - embeds: [ - { - description: "Your rank has been updated to `Trial Member`.", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, - }, - ], - }); - return; - } - } - }, -}; + + await interaction.editReply({ + embeds: [{ + description: "Your rank has been updated to `Beast`.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + + if (guildRank === 'Elite') { + + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Update)") + } + + await roleManage.add(guildRole, "User used the update command") + await roleManage.add(elite, "User used the update command") + await roleManage.add(defaultMember, "User used the update command") + + + await interaction.editReply({ + embeds: [{ + description: "Your rank has been updated to `Elite`.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + + if (guildRank === 'Member') { + + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Update)") + } + + await roleManage.add(guildRole, "User used the update command") + await roleManage.add(member, "User used the update command") + await roleManage.add(defaultMember, "User used the update command") + + + await interaction.editReply({ + embeds: [{ + description: "Your rank has been updated to `Member`.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + + if (guildRank === 'Trial Member') { + + for (let i = 0; i < removeThese.length; i++) { + await roleManage.remove(removeThese[i], "Auto role removal. (Update)") + } + + await roleManage.add(guildRole, "User used the update command") + await roleManage.add(trialmember, "User used the update command") + await roleManage.add(defaultMember, "User used the update command") + + + await interaction.editReply({ + embeds: [{ + description: "Your rank has been updated to `Trial Member`.", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + return + } + } + } +}; \ No newline at end of file diff --git a/commands/verify.js b/commands/verify.js index fe7b4be..0abb345 100644 --- a/commands/verify.js +++ b/commands/verify.js @@ -5,18 +5,7 @@ const fetch = require("axios"); const { color, hypixelGuildID } = require("../config/options.json"); const verify = require("../schemas/verifySchema.js"); const mongoose = require("mongoose"); -const { - gm, - manager, - moderator, - beast, - elite, - member, - trialmember, - guildRole, - guildStaff, - defaultMember, -} = require("../config/roles.json"); +const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json"); module.exports = { name: "verify", @@ -26,18 +15,21 @@ module.exports = { data: new SlashCommandBuilder() .setName("verify") .setDescription("Verify yourself as a member of the server.") - .addStringOption((option) => option.setName("ign").setDescription("Your in-game name.")) + .addStringOption((option) => + option + .setName("ign") + .setDescription("Your in-game name.")) .setDMPermission(false), async execute(interaction) { await interaction.deferReply(); - const user1 = interaction.user; + const user1 = interaction.user const user = interaction.guild.members.cache.get(user1.id); const ign = interaction.options.getString("ign"); const mojang = "https://api.mojang.com/users/profiles/minecraft/"; - const hypixel = "https://api.hypixel.net/player"; - const guildAPI = "https://api.hypixel.net/guild"; + const hypixel = "https://api.hypixel.net/player" + const guildAPI = "https://api.hypixel.net/guild" const minotar = "https://minotar.net/helm/"; const embedColor = Number(color.replace("#", "0x")); const head = minotar + ign; @@ -45,19 +37,17 @@ module.exports = { const verifyData = await verify.findOne({ userID: user.id }); if (verifyData) { - interaction.editReply("You are already verified.\n" + "Try running /update to update your roles."); + interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.") return; } if (!ign) { interaction.editReply({ - embeds: [ - { - description: " Please provide your in-game name.", - color: embedColor, - }, - ], - }); + embeds: [{ + description: " Please provide your in-game name.", + color: embedColor + }] + }) return; } @@ -65,12 +55,10 @@ module.exports = { await fetch(mojang + ign); } catch (err) { interaction.editReply({ - embeds: [ - { - description: " That player does not exist.", - color: embedColor, - }, - ], + embeds: [{ + description: " That player does not exist.", + color: embedColor + }] }); return; } @@ -78,126 +66,111 @@ module.exports = { const userCheck = await fetch(mojang + ign); const userUUID = userCheck.data.id; - const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + userUUID; + const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + userUUID const stats = await fetch(player); if (!stats.data.player) { interaction.editReply({ - embeds: [ - { - description: - " That player hasn't played Hypixel before.", - color: embedColor, - }, - ], + embeds: [{ + description: " That player hasn't played Hypixel before.", + color: embedColor + }] }); return; } if (user1.discriminator === "0") { - var username = user1.username; + var username = user1.username } else { - var username = user1.username + "#" + user1.discriminator; + var username = user1.username + "#" + user1.discriminator } if (!stats.data.player.socialMedia.links.DISCORD) { interaction.editReply({ embeds: [ { - description: - " There is no Discord account linked to `" + - stats.data.player.displayname + - "`.\n\n" + - "**Please set your Discord tag on hypixel to `" + - username + - "` and try again.**", - color: embedColor, - }, - ], + description: " There is no Discord account linked to `" + stats.data.player.displayname + "`.\n\n" + + "**Please set your Discord tag on hypixel to `" + username + "` and try again.**", + color: embedColor + } + ] }); return; } - const linkedDiscord = stats.data.player.socialMedia.links.DISCORD; + const linkedDiscord = stats.data.player.socialMedia.links.DISCORD if (linkedDiscord !== username) { interaction.editReply({ embeds: [ { - description: - " The Discord account linked to `" + - stats.data.player.displayname + - "` is currently `" + - linkedDiscord + - "`\n\n" + - "**Please set your Discord tag on hypixel to `" + - username + - "` and try again.**", - color: embedColor, - }, - ], + description: " The Discord account linked to `" + stats.data.player.displayname + "` is currently `" + linkedDiscord + "`\n\n" + + "**Please set your Discord tag on hypixel to `" + username + "` and try again.**", + color: embedColor + } + ] }); return; } - const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + userUUID; + const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + userUUID const guildCheck = await fetch(guild); if (!guildCheck.data.guild) { - var guildID = null; + var guildID = null } else { - var guildID = guildCheck.data.guild._id; + var guildID = guildCheck.data.guild._id } - if (guildID === hypixelGuildID) { - const GuildMembers = guildCheck.data.guild.members; - const guildRank = GuildMembers.find((member) => member.uuid === stats.data.player.uuid).rank; + if (guildID === hypixelGuildID) { + const GuildMembers = guildCheck.data.guild.members + const guildRank = GuildMembers.find((member) => member.uuid === stats.data.player.uuid).rank; - if (guildRank === "Guild Master" && guildID === hypixelGuildID) { - await user.roles.add(gm, "Verification"); - await user.roles.add(guildRole, "Verification"); - await user.roles.add(guildStaff, "Verification"); - } + if (guildRank === "Guild Master" && guildID === hypixelGuildID) { + await user.roles.add(gm, "Verification"); + await user.roles.add(guildRole, "Verification"); + await user.roles.add(guildStaff, "Verification"); + } - if (guildRank === "Manager" && guildID === hypixelGuildID) { - await user.roles.add(manager, "Verification"); - await user.roles.add(guildRole, "Verification"); - await user.roles.add(guildStaff, "Verification"); - } + if (guildRank === "Manager" && guildID === hypixelGuildID) { + await user.roles.add(manager, "Verification"); + await user.roles.add(guildRole, "Verification"); + await user.roles.add(guildStaff, "Verification"); + } - if (guildRank === "Moderator" && guildID === hypixelGuildID) { - await user.roles.add(moderator, "Verification"); - await user.roles.add(guildRole, "Verification"); - await user.roles.add(guildStaff, "Verification"); - } + if (guildRank === "Moderator" && guildID === hypixelGuildID) { + await user.roles.add(moderator, "Verification"); + await user.roles.add(guildRole, "Verification"); + await user.roles.add(guildStaff, "Verification"); + } - if (guildRank === "Beast" && guildID === hypixelGuildID) { - await user.roles.add(beast, "Verification"); - await user.roles.add(guildRole, "Verification"); - } + if (guildRank === "Beast" && guildID === hypixelGuildID) { + await user.roles.add(beast, "Verification"); + await user.roles.add(guildRole, "Verification"); + } - if (guildRank === "Elite" && guildID === hypixelGuildID) { - await user.roles.add(elite, "Verification"); - await user.roles.add(guildRole, "Verification"); - } + if (guildRank === "Elite" && guildID === hypixelGuildID) { + await user.roles.add(elite, "Verification"); + await user.roles.add(guildRole, "Verification"); + } - if (guildRank === "Member" && guildID === hypixelGuildID) { - await user.roles.add(member, "Verification"); - await user.roles.add(guildRole, "Verification"); - } + if (guildRank === "Member" && guildID === hypixelGuildID) { + await user.roles.add(member, "Verification"); + await user.roles.add(guildRole, "Verification"); + } - if (guildRank === "Trial Member" && guildID === hypixelGuildID) { - await user.roles.add(trialmember, "Verification"); - await user.roles.add(guildRole, "Verification"); - } - } + if (guildRank === "Trial Member" && guildID === hypixelGuildID) { + await user.roles.add(trialmember, "Verification"); + await user.roles.add(guildRole, "Verification"); + } + } await user.roles.add(defaultMember, "Verification"); const newVerify = new verify({ _id: new mongoose.Types.ObjectId(), userID: user.id, - uuid: userUUID, + uuid: userUUID }); await newVerify.save(); @@ -206,22 +179,17 @@ module.exports = { embeds: [ { title: interaction.guild.name, - description: - "You have successfully verified `" + - username + - "` with the account `" + - stats.data.player.displayname + - "`.", + description: "You have successfully verified `" + username + "` with the account `" + stats.data.player.displayname + "`.", color: embedColor, thumbnail: { - url: head, + url: head }, footer: { icon_url: interaction.guild.iconURL(), - text: interaction.guild.name + " | Developed by Taken#0002", - }, - }, - ], + text: interaction.guild.name + " | Developed by Taken#0002" + } + } + ] }); - }, -}; + } +}; \ No newline at end of file diff --git a/commands/whois.js b/commands/whois.js index c41d6fc..e730a61 100644 --- a/commands/whois.js +++ b/commands/whois.js @@ -1,35 +1,38 @@ -const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js"); -const { color } = require("../config/options.json"); -const verify = require("../schemas/verifySchema.js"); -const fetch = require("axios"); +const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js'); +const { color } = require('../config/options.json'); +const verify = require('../schemas/verifySchema.js'); +const fetch = require('axios'); module.exports = { - name: "whois", - description: "Get's the ign of a user.", - type: "slash", + name: 'whois', + description: 'Get\'s the ign of a user.', + type: 'slash', data: new SlashCommandBuilder() - .setName("whois") - .setDescription("Get's the ign of a user.") - .addUserOption((option) => - option.setName("user").setDescription("The user to get the ign of.").setRequired(true), - ) + .setName('whois') + .setDescription('Get\'s the ign of a user.') + .addUserOption(option => + option + .setName('user') + .setDescription('The user to get the ign of.') + .setRequired(true)) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), async execute(interaction) { + await interaction.deferReply(); - const user = interaction.options.getUser("user"); + const user = interaction.options.getUser('user'); const embedColor = Number(color.replace("#", "0x")); - const mojang = "https://api.mojang.com/user/profile/"; + const mojang = "https://api.mojang.com/user/profile/" const minotar = "https://minotar.net/helm/"; const verifiedUser = await verify.findOne({ userID: user.id }); if (!verifiedUser) { - interaction.editReply({ content: "This user has not verified their account." }); - return; + interaction.editReply({ content: 'This user has not verified their account.' }); + return } const userCheck = await fetch(mojang + verifiedUser.uuid); @@ -37,20 +40,19 @@ module.exports = { const head = minotar + ign; await interaction.editReply({ - embeds: [ - { - title: interaction.guild.name, - description: "**User:** " + userMention(user.id) + "\n**IGN:** " + ign, - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | Developed by: @Taken#0002", - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, + embeds: [{ + title: interaction.guild.name, + description: "**User:** " + userMention(user.id) + "\n**IGN:** " + ign, + color: embedColor, + thumbnail: { + url: head }, - ], - }); - }, -}; + footer: { + text: interaction.guild.name + " | Developed by: @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) + + } +}; \ No newline at end of file diff --git a/config/limitmessages.json b/config/limitmessages.json index fd2ef0f..67a62be 100644 --- a/config/limitmessages.json +++ b/config/limitmessages.json @@ -1,5 +1,5 @@ { "largeM": "(256 characters max)", "smallM": "(128 characters max)", - "ignM": "(16 characters max)" -} + "ignM": "(16 characters max)" +} \ No newline at end of file diff --git a/config/options.json b/config/options.json index 6b6acec..bc225ec 100644 --- a/config/options.json +++ b/config/options.json @@ -2,7 +2,7 @@ "color": "#eeaadb", "applicationsChannel": "776705352456470550", "staffApplicationsChannel": "1039258641393520700", - "inactivityLogChannel": "829742524796239882", + "inactivityLogChannel": "829742524796239882", "staffOtherChannel": "1082036748558803104", "hypixelGuildID": "5a353a170cf2e529044f2935", "botLogChannel": "1101144489306886226" diff --git a/config/questions.json b/config/questions.json index b9fd3bc..f21e901 100644 --- a/config/questions.json +++ b/config/questions.json @@ -27,10 +27,10 @@ "rsq4": "Are you an active guild member?", "rsq5": "Do you have any experience as a staff member (guild moderator) at all?", "rsq6": "Why should we choose you as a Guild Moderator?", - "ia1": "What is your IGN?", - "ia2": "Duration of the absence?", - "ia3": "Reason of the absence?", - "ria1": "What is your IGN?", - "ria2": "Duration of the absence?", - "ria3": "Reason of the absence?" -} + "ia1": "What is your IGN?", + "ia2": "Duration of the absence?", + "ia3": "Reason of the absence?", + "ria1": "What is your IGN?", + "ria2": "Duration of the absence?", + "ria3": "Reason of the absence?" +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index c164335..371891e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,14 @@ -version: "1.0" +version: '1.0' services: - illegitimate: - image: "illegitimate-bot:latest" - environment: - - TOKEN=${TOKEN} - - MONGOURI=${MONGOURI} - - DEV=${DEV} - - CLIENTID=${CLIENTID} - - GUILDID=${GUILDID} - - HYPIXELKEY=${HYPIXELKEY} - - GUILDINFO=${GUILDINFO} - - REQUIREMENTS=${REQUIREMENTS} - - RULESINFO=${RULESINFO} + illegitimate: + image: "illegitimate-bot:latest" + environment: + - TOKEN=${TOKEN} + - MONGOURI=${MONGOURI} + - DEV=${DEV} + - CLIENTID=${CLIENTID} + - GUILDID=${GUILDID} + - HYPIXELKEY=${HYPIXELKEY} + - GUILDINFO=${GUILDINFO} + - REQUIREMENTS=${REQUIREMENTS} + - RULESINFO=${RULESINFO} \ No newline at end of file diff --git a/events/buttons/checkstats.js b/events/buttons/checkstats.js index 6b2afc6..5263c1a 100644 --- a/events/buttons/checkstats.js +++ b/events/buttons/checkstats.js @@ -1,29 +1,30 @@ -const { color } = require("../../config/options.json"); -const fetch = require("axios"); -const guildapp = require("../../schemas/guildAppSchema.js"); -const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../config/reqs.json"); +const { color } = require('../../config/options.json'); +const fetch = require('axios'); +const guildapp = require('../../schemas/guildAppSchema.js'); +const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require('../../config/reqs.json'); const env = require("dotenv").config(); const hypixelApiKey = process.env.HYPIXELAPIKEY; const { getExactLevel, skywarsLevel, getLevelForExp } = require("../../utils/functions.js"); module.exports = { - name: "checkstats", - description: "Check your stats.", - type: "button", + name: 'checkstats', + description: 'Check your stats.', + type: 'button', async execute(interaction) { + await interaction.deferReply(); const message = interaction.message; const embed = message.embeds[0]; - const applicantId = embed.footer.text.split(" ")[1]; + const applicantId = embed.footer.text.split(" ")[1] - const guildappdata = await guildapp.findOne({ userID: applicantId }); + const guildappdata = await guildapp.findOne({ userID: applicantId }) const uuid = guildappdata.uuid; - const mojang = "https://api.mojang.com/user/profile/"; - const hypixel = "https://api.hypixel.net/player"; - const guildAPI = "https://api.hypixel.net/guild"; + const mojang = "https://api.mojang.com/user/profile/" + const hypixel = "https://api.hypixel.net/player" + const guildAPI = "https://api.hypixel.net/guild" const minotar = "https://minotar.net/helm/"; const embedColor = Number(color.replace("#", "0x")); @@ -31,17 +32,15 @@ module.exports = { const ign = userCheck.data.name; const head = minotar + ign; - const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid; + const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid const stats = await fetch(player); if (!stats.data.player) { interaction.editReply({ - embeds: [ - { - description: "That player hasn't played Hypixel before.", - color: embedColor, - }, - ], + embeds: [{ + description: "That player hasn't played Hypixel before.", + color: embedColor + }] }); return; } @@ -49,19 +48,19 @@ module.exports = { const rank2 = stats.data.player.newPackageRank; const monthlyRank = stats.data.player.monthlyPackageRank; - if (rank2 === "VIP") { - var rank = "[VIP] "; - } else if (rank2 === "VIP_PLUS") { - var rank = "[VIP+] "; - } else if (rank2 === "MVP") { - var rank = "[MVP] "; - } else if (rank2 === "MVP_PLUS" && monthlyRank === "NONE") { - var rank = "[MVP+] "; - } else if (rank2 === "MVP_PLUS" && monthlyRank === "SUPERSTAR") { - var rank = "[MVP++] "; + if (rank2 === 'VIP') { + var rank = "[VIP] " + } else if (rank2 === 'VIP_PLUS') { + var rank = "[VIP+] " + } else if (rank2 === 'MVP') { + var rank = "[MVP] " + } else if (rank2 === 'MVP_PLUS' && monthlyRank === 'NONE') { + var rank = "[MVP+] " + } else if (rank2 === 'MVP_PLUS' && monthlyRank === 'SUPERSTAR') { + var rank = "[MVP++] " } - const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid; + const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid const guildCheck = await fetch(guild); if (!guildCheck.data.guild) { @@ -71,11 +70,11 @@ module.exports = { } if (!guildCheck.data.guild) { - var guildTag = ""; + var guildTag = "" } else if (!guildCheck.data.guild.tag) { - var guildTag = ""; + var guildTag = "" } else { - var guildTag = " [" + guildCheck.data.guild.tag + "]"; + var guildTag = " [" + guildCheck.data.guild.tag + "]" } //bedwars level @@ -97,9 +96,9 @@ module.exports = { //skywars wins const hsswwins = stats.data.player.stats.SkyWars.wins; // dueks kdr - const hsduelskills = stats.data.player.stats.Duels.kills; - const hsduelsdeaths = stats.data.player.stats.Duels.deaths; - const hsduelskd = hsduelskills / hsduelsdeaths; + const hsduelskills = stats.data.player.stats.Duels.kills + const hsduelsdeaths = stats.data.player.stats.Duels.deaths + const hsduelskd = hsduelskills / hsduelsdeaths // duels wins const hsduelswins = stats.data.player.stats.Duels.wins; // duels wlr @@ -110,95 +109,72 @@ module.exports = { const level = getExactLevel(hypixelExp); if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) { - var bwtitle = " This player does not meet the BedWars requirements."; + var bwtitle = " This player does not meet the BedWars requirements." } else { - var bwtitle = " This player meets the BedWars requirements."; + var bwtitle = " This player meets the BedWars requirements." } if (hsswstars < swstars) { - var swtitle = " This player does not meet the SkyWars requirements."; + var swtitle = " This player does not meet the SkyWars requirements." } else { - var swtitle = " This player meets the SkyWars requirements."; + var swtitle = " This player meets the SkyWars requirements." } if (hsduelswins < duelswins || hsduelswlr < duelswlr) { - var duelstitle = " This player does not meet the Duels requirements."; + var duelstitle = " This player does not meet the Duels requirements." } else { - var duelstitle = " This player meets the Duels requirements."; + var duelstitle = " This player meets the Duels requirements." } await interaction.editReply({ - embeds: [ - { - title: rank + stats.data.player.displayname + guildTag, - description: - "**Network Level:** `" + - level.toFixed(2).toString() + - "`\n" + - "**Current Guild:** `" + - guildName + - "`", - color: embedColor, - thumbnail: { url: head }, - footer: { - text: interaction.guild.name + " | Developed by @Taken#0002", - icon_url: interaction.guild.iconURL(), - }, - fields: [ - { - name: bwtitle, - value: - "**➺ Stars:** `" + - hsbwstars.toFixed(2).toString() + - " / " + - bwstars.toString() + - "`\n" + - "**➺ FKDR:** `" + - hsbwfkdr.toFixed(2).toString() + - " / " + - bwfkdr.toString() + - "`\n" + - "**➺ Wins:** `" + - hsbwwins.toString() + - " / " + - bwwins.toString() + - "`", - }, - { - name: swtitle, - value: - "**➺ Stars:** `" + - hsswstars.toFixed(2).toString() + - " / " + - swstars.toString() + - "`\n" + - "**➺ KDR:** `" + - hsswkd.toFixed(2).toString() + - "`\n" + - "**➺ Wins:** `" + - hsswwins.toString() + - "`", - }, - { - name: duelstitle, - value: - "**➺ Wins:** `" + - hsduelswins.toString() + - " / " + - duelswins.toString() + - "`\n" + - "**➺ WLR:** `" + - hsduelswlr.toFixed(2).toString() + - " / " + - duelswlr.toString() + - "`\n" + - "**➺ KDR:** `" + - hsduelskd.toFixed(2).toString() + - "`", - }, - ], + embeds: [{ + title: rank + stats.data.player.displayname + guildTag, + description: "**Network Level:** `" + + level.toFixed(2).toString() + "`\n" + + "**Current Guild:** `" + guildName + "`", + color: embedColor, + thumbnail: { url: head }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL() }, - ], + fields: [ + { + name: bwtitle, + value: "**➺ Stars:** `" + + hsbwstars.toFixed(2).toString() + " / " + + bwstars.toString() + "`\n" + + "**➺ FKDR:** `" + + hsbwfkdr.toFixed(2).toString() + + " / " + bwfkdr.toString() + "`\n" + + "**➺ Wins:** `" + + hsbwwins.toString() + " / " + + bwwins.toString() + "`" + }, + { + name: swtitle, + value: + "**➺ Stars:** `" + + hsswstars.toFixed(2).toString() + + " / " + swstars.toString() + "`\n" + + "**➺ KDR:** `" + + hsswkd.toFixed(2).toString() + "`\n" + + "**➺ Wins:** `" + + hsswwins.toString() + "`" + }, + { + name: duelstitle, + value: "**➺ Wins:** `" + + hsduelswins.toString() + + " / " + duelswins.toString() + "`\n" + + "**➺ WLR:** `" + + hsduelswlr.toFixed(2).toString() + + " / " + duelswlr.toString() + "`\n" + + "**➺ KDR:** `" + + hsduelskd.toFixed(2).toString() + "`" + } + ] + }] }); - }, + } }; diff --git a/events/buttons/guilapply.js b/events/buttons/guilapply.js index 4938ed2..fb12e7f 100644 --- a/events/buttons/guilapply.js +++ b/events/buttons/guilapply.js @@ -1,572 +1,502 @@ -const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require("discord.js"); -const { color } = require("../../config/options.json"); -const { largeM, smallM, ignM } = require("../../config/limitmessages.json"); -const { applicationsChannel } = require("../../config/options.json"); -const { qu1, qu2, qu3, qu4, qu5, qu6, qu7, qu8 } = require("../../config/questions.json"); -const { rq1, rq2, rq3, rq4, rq5, rq6, rq7, rq8 } = require("../../config/questions.json"); -const { guildRole } = require("../../config/roles.json"); -const mongoose = require("mongoose"); -const guildapp = require("../../schemas/guildAppSchema.js"); -const fetch = require("axios"); +const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js'); +const { color } = require('../../config/options.json'); +const { largeM, smallM, ignM } = require('../../config/limitmessages.json') +const { applicationsChannel } = require('../../config/options.json'); +const { qu1, qu2, qu3, qu4, qu5, qu6, qu7, qu8 } = require('../../config/questions.json'); +const { rq1, rq2, rq3, rq4, rq5, rq6, rq7, rq8 } = require('../../config/questions.json'); +const { guildRole } = require('../../config/roles.json') +const mongoose = require('mongoose'); +const guildapp = require('../../schemas/guildAppSchema.js'); +const fetch = require('axios'); module.exports = { - name: "guildapply", - description: "Guild application button.", - type: "button", + name: 'guildapply', + description: 'Guild application button.', + type: 'button', async execute(interaction) { + const user = interaction.user; const guild = interaction.guild; const embedColor = Number(color.replace("#", "0x")); - const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"; + const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/" - const userRoles = guild.members.cache.get(user.id).roles.cache.map((role) => role.id); - - if (interaction.customId === "guildapply") { + const userRoles = guild.members.cache.get(user.id).roles.cache.map(role => role.id); + + if (interaction.customId === 'guildapply') { + await interaction.deferReply({ ephemeral: true }); if (userRoles.includes(guildRole)) { await interaction.editReply({ content: "You are already a member of the guild.", ephemeral: true }); - return; + return } const application = await guildapp.findOne({ userID: user.id }); if (application) { - await interaction.editReply({ - content: "You already have an application in progress.", - ephemeral: true, - }); - return; + await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true }); + return } - - const tooLong = new EmbedBuilder().setDescription("You took too long to respond.").setColor(embedColor); + + const tooLong = new EmbedBuilder() + .setDescription("You took too long to respond.") + .setColor(embedColor) const cancelled = new EmbedBuilder() .setDescription("You have cancelled your application.") - .setColor(embedColor); + .setColor(embedColor) const attachments = new EmbedBuilder() .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") - .setColor(embedColor); + .setColor(embedColor) try { await user.send({ - embeds: [ - { - title: "Guild Application", - description: - "Please answer the following questions to apply for the guild.\n" + - "If you wish to cancel your application, please press type `cancel` at any time.\n" + - "If you wish to proceed with your application, please type `yes`.\n\n" + - "**Do not upload images, videos, or GIFS.**\n" + - "You have a minute to respond to this message.", - color: embedColor, - }, - ], - }); + embeds: [{ + title: 'Guild Application', + description: "Please answer the following questions to apply for the guild.\n" + + "If you wish to cancel your application, please press type `cancel` at any time.\n" + + "If you wish to proceed with your application, please type `yes`.\n\n" + + "**Do not upload images, videos, or GIFS.**\n" + + "You have a minute to respond to this message.", + color: embedColor, + }] + }) } catch (error) { await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true }); - return; + return } - await interaction.editReply({ content: "Please check your DMs.", ephemeral: true }); + await interaction.editReply({ content: "Please check your DMs.", ephemeral: true}) + const input = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60, + time: 1000 * 60 }); if (input.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (input.size === 0) { await user.send({ embeds: [tooLong] }); - return; + return } - if (input.first().content.toLowerCase() !== "yes") { - await user.send({ embeds: [cancelled] }); - return; + if (input.first().content.toLowerCase() !== 'yes') { + await user.send({ embeds: [cancelled]} ); + return } // first question const question1 = await user.send({ - embeds: [ - { - title: "**Question 1**", - description: - qu1 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - ignM + - "`", - color: embedColor, - footer: { - text: "You have 5 minutes to respond to this message.", - }, - }, - ], - }); + embeds: [{ + title : "**Question 1**", + description: qu1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", + color: embedColor, + footer:{ + text: "You have 5 minutes to respond to this message." + } + }] + }) const answer1 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, time: 1000 * 60 * 5, }); if (answer1.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (answer1.first().content > 16) { await user.send({ - embeds: [ - { - description: "Max character limit is 16.", - color: embedColor, - }, - ], - }); - return; + embeds: [{ + description: "Max character limit is 16.", + color: embedColor + }] + }) + return } try { - await fetch(mojangAPI + answer1.first().content); + await fetch(mojangAPI + answer1.first().content) } catch (error) { await user.send({ - embeds: [ - { - description: "That is not a valid Minecraft username.\n" + "Application cancelled.", - color: embedColor, - }, - ], - }); - return; + embeds: [{ + description: "That is not a valid Minecraft username.\n" + + "Application cancelled.", + color: embedColor + }] + }) + return } if (answer1.size === 0) { - await user.send({ embeds: [tooLong] }); - return; + await user.send({ embeds: [tooLong] }) + return } - if (answer1.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; + if (answer1.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return } - const answer1_1 = answer1.first().content; + const answer1_1 = answer1.first().content // second question const question2 = await user.send({ - embeds: [ - { - title: "**Question 2**", - description: - qu2 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + - "`(8 characters max)`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); + embeds: [{ + title : "**Question 2**", + description: qu2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(8 characters max)`", + color: embedColor, + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) const answer2 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }); if (answer2.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (answer2.first().content.size > 8) { await user.send({ - embeds: [ - { - description: "Max character limit is 8.", - color: embedColor, - }, - ], - }); - return; + embeds: [{ + description: "Max character limit is 8.", + color: embedColor + }] + }) + return } if (answer2.size === 0) { - await user.send({ embeds: [tooLong] }); - return; + await user.send({ embeds: [tooLong] }) + return } - if (answer2.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; + if (answer2.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return } - const answer2_1 = answer2.first().content; + const answer2_1 = answer2.first().content // third question const question3 = await user.send({ - embeds: [ - { - title: "**Question 3**", - description: - qu3 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - smallM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); + embeds: [{ + title : "**Question 3**", + description: qu3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", + color: embedColor, + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) const answer3 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }); if (answer3.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (answer3.first().content > 128) { await user.send({ - embeds: [ - { - description: "Max character limit is 128.", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "Max character limit is 128.", + color: embedColor + }] + }) } if (answer3.size === 0) { - await user.send({ embeds: [tooLong] }); - return; + await user.send({ embeds: [tooLong] }) + return } - if (answer3.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; + if (answer3.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return } - const answer3_1 = answer3.first().content; + const answer3_1 = answer3.first().content // fourth question const question4 = await user.send({ - embeds: [ - { - title: "**Question 4**", - description: - qu4 + - "\n\nPlease type your answer below or type `cancel` to cancel your application." + - " `(We expect a longer answer.)`\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); + embeds: [{ + title : "**Question 4**", + description: qu4 + "\n\nPlease type your answer below or type `cancel` to cancel your application." + + " `(We expect a longer answer.)`\n`" + largeM + "`", + color: embedColor, + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) const answer4 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }); if (answer4.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (answer4.first().content > 256) { await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] + }) } if (answer4.size === 0) { - await user.send({ embeds: [tooLong] }); - return; + await user.send({ embeds: [tooLong] }) + return } - if (answer4.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; + if (answer4.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return } - const answer4_1 = answer4.first().content; + const answer4_1 = answer4.first().content // fifth question const question5 = await user.send({ - embeds: [ - { - title: "**Question 5**", - description: - qu5 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - smallM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); + embeds: [{ + title : "**Question 5**", + description: qu5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", + color: embedColor, + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) const answer5 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }); if (answer5.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (answer5.first().content > 128) { await user.send({ - embeds: [ - { - description: "Max character limit is 128.", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "Max character limit is 128.", + color: embedColor + }] + }) } if (answer5.size === 0) { - await user.send({ embeds: [tooLong] }); - return; + await user.send({ embeds: [tooLong] }) + return } - if (answer5.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; + if (answer5.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return } - const answer5_1 = answer5.first().content; - + const answer5_1 = answer5.first().content + // sixth question const question6 = await user.send({ - embeds: [ - { - title: "**Question 6**", - description: - qu6 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); + embeds: [{ + title : "**Question 6**", + description: qu6 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", + color: embedColor, + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) const answer6 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }); if (answer6.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (answer6.first().content > 256) { await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] + }) } if (answer6.size === 0) { - await user.send({ embeds: [tooLong] }); - return; + await user.send({ embeds: [tooLong] }) + return } - if (answer6.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; + if (answer6.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return } - const answer6_1 = answer6.first().content; + const answer6_1 = answer6.first().content // seventh question const question7 = await user.send({ - embeds: [ - { - title: "**Question 7**", - description: - qu7 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - smallM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); + embeds: [{ + title : "**Question 7**", + description: qu7 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", + color: embedColor, + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) const answer7 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }); if (answer7.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (answer7.first().content > 128) { await user.send({ - embeds: [ - { - description: "Max character limit is 128.", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "Max character limit is 128.", + color: embedColor + }] + }) } if (answer7.size === 0) { - await user.send({ embeds: [tooLong] }); - return; + await user.send({ embeds: [tooLong] }) + return } - if (answer7.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; + if (answer7.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return } - const answer7_1 = answer7.first().content; + const answer7_1 = answer7.first().content // eighth question const question8 = await user.send({ - embeds: [ - { - title: "**Question 8**", - description: - qu8 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + - "`(64 characters max)`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); + embeds: [{ + title : "**Question 8**", + description: qu8 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`", + color: embedColor, + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) const answer8 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }); if (answer8.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (answer8.first().content > 64) { await user.send({ - embeds: [ - { - description: "Max character limit is 64.", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "Max character limit is 64.", + color: embedColor + }] + }) } if (answer8.size === 0) { - await user.send({ embeds: [tooLong] }); - return; + await user.send({ embeds: [tooLong] }) + return } - if (answer8.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; + if (answer8.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return } - const answer8_1 = answer8.first().content; + const answer8_1 = answer8.first().content await user.send({ - embeds: [ - { - description: "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "If you want to submit your application, type `yes` if not, type `no`", + color: embedColor + }] + }) const final = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, + filter: m => m.author.id === user.id, max: 1, - time: 1000 * 60 * 5, + time: 1000 * 60 * 5 }); if (final.first().attachments.size > 0) { await user.send({ embeds: [attachments] }); - return; + return } if (final.size === 0) { await user.send({ embeds: [tooLong] }); - return; + return } - if (final.first().content.toLowerCase() !== "yes") { - await user.send({ embeds: [cancelled] }); - return; + if (final.first().content.toLowerCase() !== 'yes') { + await user.send({ embeds: [cancelled]} ); + return } await user.send({ - embeds: [ - { - description: "Your application has been submitted!", - color: embedColor, - }, - ], - }); + embeds: [{ + description: "Your application has been submitted!", + color: embedColor + }] + }) - const userCheck = await fetch(mojangAPI + answer1_1); - const uuid = userCheck.data.id; + const userCheck = await fetch(mojangAPI + answer1_1) + const uuid = userCheck.data.id const newGuildApp = new guildapp({ _id: new mongoose.Types.ObjectId(), userID: user.id, uuid: uuid, - }); + }) - await newGuildApp.save(); + await newGuildApp.save() const channel = guild.channels.cache.get(applicationsChannel); await channel.send({ - embeds: [ - { - title: user.username + "#" + user.discriminator + " - Guild Application", - color: embedColor, - thumbnail: { - url: user.avatarURL(), - }, - fields: [ - { - name: rq1, - value: "```" + answer1_1 + "```", - }, - { - name: rq2, - value: "```" + answer2_1 + "```", - }, - { - name: rq3, - value: "```" + answer3_1 + "```", - }, - { - name: rq4, - value: "```" + answer4_1 + "```", - }, - { - name: rq5, - value: "```" + answer5_1 + "```", - }, - { - name: rq6, - value: "```" + answer6_1 + "```", - }, - { - name: rq7, - value: "```" + answer7_1 + "```", - }, - { - name: rq8, - value: "```" + answer8_1 + "```", - }, - ], - footer: { - iconURL: guild.iconURL(), - text: "ID: " + user.id, - }, + embeds: [{ + title: user.username + "#" + user.discriminator + " - Guild Application", + color: embedColor, + thumbnail: { + url: user.avatarURL() }, - ], + fields: [ + { + name: rq1, + value: "```" + answer1_1 + "```" + }, + { + name: rq2, + value: "```" + answer2_1 + "```" + }, + { + name: rq3, + value: "```" + answer3_1 + "```" + }, + { + name: rq4, + value: "```" + answer4_1 + "```" + }, + { + name: rq5, + value: "```" + answer5_1 + "```" + }, + { + name: rq6, + value: "```" + answer6_1 + "```" + }, + { + name: rq7, + value: "```" + answer7_1 + "```" + }, + { + name: rq8, + value: "```" + answer8_1 + "```" + } + ], + footer: { + iconURL: guild.iconURL(), + text: "ID: " + user.id + } + }], components: [ new ActionRowBuilder().addComponents( new ButtonBuilder() @@ -580,10 +510,11 @@ module.exports = { new ButtonBuilder() .setCustomId("checkstats") .setLabel("Check Stats") - .setStyle(ButtonStyle.Secondary), - ), - ], + .setStyle(ButtonStyle.Secondary) + ) + ] }); + } - }, -}; + } +} \ No newline at end of file diff --git a/events/buttons/guildapplicationaccept.js b/events/buttons/guildapplicationaccept.js index 320d4b2..c1a7a93 100644 --- a/events/buttons/guildapplicationaccept.js +++ b/events/buttons/guildapplicationaccept.js @@ -1,16 +1,17 @@ -const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require("discord.js"); -const { color } = require("../../config/options.json"); +const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require('discord.js'); +const { color } = require('../../config/options.json'); const mongoose = require("mongoose"); -const guildapp = require("../../schemas/guildAppSchema.js"); -const waitingList = require("../../schemas/waitinglistSchema.js"); -const { waitingListRole } = require("../../config/roles.json"); +const guildapp = require('../../schemas/guildAppSchema.js'); +const waitingList = require('../../schemas/waitinglistSchema.js'); +const { waitingListRole } = require('../../config/roles.json'); module.exports = { - name: "guildapplicationaccept", - description: "Accept a guild application.", - type: "button", + name: 'guildapplicationaccept', + description: 'Accept a guild application.', + type: 'button', async execute(interaction) { + await interaction.deferReply(); const user = interaction.user; @@ -19,12 +20,12 @@ module.exports = { const message = interaction.message; const embed = message.embeds[0]; - const applicantId = embed.footer.text.split(" ")[1]; + const applicantId = embed.footer.text.split(" ")[1] const applicantIGN1 = embed.fields[0].value; const applicantIGN = applicantIGN1.replaceAll("`", ""); - const applicant = await guild.members.fetch(applicantId); + const applicant = await guild.members.fetch(applicantId) const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator; await message.edit({ @@ -44,21 +45,19 @@ module.exports = { .setCustomId("checkstats") .setLabel("Check Stats") .setStyle(ButtonStyle.Secondary) - .setDisabled(true), - ), - ], + .setDisabled(true) + ) + ] }); await applicant.send({ - embeds: [ - { - description: `Your application for the Illegitimate guild has been accepted.`, - color: embedColor, - }, - ], + embeds: [{ + description: `Your application for the Illegitimate guild has been accepted.`, + color: embedColor + }] }); - const applicantEntry = await guildapp.findOne({ userID: applicantId }); + const applicantEntry = await guildapp.findOne({ userID: applicantId }) const applicantUUID = applicantEntry.uuid; const time = Date.now(); @@ -67,7 +66,7 @@ module.exports = { userID: applicantId, uuid: applicantUUID, IGN: applicantIGN, - timestamp: time, + timestamp: time }); await waitingListAdd.save(); @@ -75,21 +74,20 @@ module.exports = { await applicant.roles.add(waitingListRole); await guildapp.findOneAndDelete({ userID: applicantId }); + await interaction.editReply({ - embeds: [ - { - title: applicantUsername + " - Guild Application", - description: "Application has been accepted by <@" + user.id + ">.", - color: embedColor, - thumbnail: { - url: applicant.avatarURL(), - }, - footer: { - iconURL: guild.iconURL(), - text: "ID: " + applicant.id, - }, + embeds: [{ + title: applicantUsername + " - Guild Application", + description: "Application has been accepted by <@" + user.id + ">.", + color: embedColor, + thumbnail: { + url: applicant.avatarURL() }, - ], + footer: { + iconURL: guild.iconURL(), + text: "ID: " + applicant.id + } + }] }); - }, -}; + } +}; \ No newline at end of file diff --git a/events/buttons/guildapplicationdeny.js b/events/buttons/guildapplicationdeny.js index d911314..d90c16d 100644 --- a/events/buttons/guildapplicationdeny.js +++ b/events/buttons/guildapplicationdeny.js @@ -1,12 +1,13 @@ -const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js"); -const { color } = require("../../config/options.json"); +const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); +const { color } = require('../../config/options.json'); module.exports = { - name: "guildapplicationdeny", - description: "Deny a guild application.", - type: "button", + name: 'guildapplicationdeny', + description: 'Deny a guild application.', + type: 'button', async execute(interaction) { + const channel = interaction.channel; const guild = interaction.guild; const embedColor = Number(color.replace("#", "0x")); @@ -14,18 +15,18 @@ module.exports = { const message = interaction.message; const modal = new ModalBuilder() - .setTitle("Deny Reason") - .setCustomId("denyreasonbox") + .setTitle('Deny Reason') + .setCustomId('denyreasonbox') .setComponents( new ActionRowBuilder().setComponents( new TextInputBuilder() - .setLabel("Deny Reason") - .setCustomId("denyreason") + .setLabel('Deny Reason') + .setCustomId('denyreason') .setStyle(TextInputStyle.Paragraph) - .setPlaceholder("Enter a reason for denying the application") - .setRequired(false), - ), - ); + .setPlaceholder('Enter a reason for denying the application') + .setRequired(false) + ) + ) await interaction.showModal(modal); - }, -}; + } +}; \ No newline at end of file diff --git a/events/buttons/guildinactivitylog.js b/events/buttons/guildinactivitylog.js index ae18f4a..ba29561 100644 --- a/events/buttons/guildinactivitylog.js +++ b/events/buttons/guildinactivitylog.js @@ -1,314 +1,283 @@ const { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder } = require("discord.js"); -const { - gm, - manager, - moderator, - beast, - member, - trialmember, - guildStaff, - guildRole, -} = require("../../config/roles.json"); +const { gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole } = require("../../config/roles.json"); const { ignM, smallM, largeM } = require("../../config/limitmessages.json"); const { ia1, ia2, ia3, ria1, ria2, ria3 } = require("../../config/questions.json"); const { color, inactivityLogChannel } = require("../../config/options.json"); const guildRoles = [gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole]; module.exports = { - name: "guildinactivitylog", - description: "Configure the bot.", - type: "button", + name: "guildinactivitylog", + description: "Configure the bot.", + type: "button", - async execute(interaction) { - const guild = interaction.guild; - const user = interaction.user; - const embedColor = Number(color.replace("#", "0x")); - const userRoles = guild.members.cache.get(user.id).roles.cache; - const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"; + async execute(interaction) { + const guild = interaction.guild; + const user = interaction.user; + const embedColor = Number(color.replace("#", "0x")); + const userRoles = guild.members.cache.get(user.id).roles.cache; + const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"; - if (!userRoles.some((role) => guildRoles.includes(role.id))) { - return await interaction.reply({ - content: "Only guild members can use this button.", - ephemeral: true, - }); - } + if (!userRoles.some((role) => guildRoles.includes(role.id))) { + return await interaction.reply({ + content: "Only guild members can use this button.", + ephemeral: true + }); + } - const tooLong = new EmbedBuilder().setDescription("You took too long to respond.").setColor(embedColor); - const cancelled = new EmbedBuilder() - .setDescription("You have cancelled your application.") - .setColor(embedColor); - const attachments = new EmbedBuilder() - .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") - .setColor(embedColor); + const tooLong = new EmbedBuilder() + .setDescription("You took too long to respond.") + .setColor(embedColor); + const cancelled = new EmbedBuilder() + .setDescription("You have cancelled your application.") + .setColor(embedColor); + const attachments = new EmbedBuilder() + .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") + .setColor(embedColor); - try { - await user.send({ - embeds: [ - { - title: "Guild Inactivity Log", - description: - "Please answer the following questions to submit an inactivity log for the guild.\n" + - "If you wish to cancel your form, please press type `cancel` at any time.\n" + - "If you wish to proceed with your form, please type `yes`.\n\n" + - "**Do not upload images, videos, or GIFS.**\n" + - "You have a minute to respond to this message.", - color: embedColor, - }, - ], - }); - } catch (error) { - return await interaction.reply({ content: "Please enable your DMs.", ephemeral: true }); - } + try { + await user.send({ + embeds: [ + { + title: "Guild Inactivity Log", + description: "Please answer the following questions to submit an inactivity log for the guild.\n" + + "If you wish to cancel your form, please press type `cancel` at any time.\n" + + "If you wish to proceed with your form, please type `yes`.\n\n" + "**Do not upload images, videos, or GIFS.**\n" + + "You have a minute to respond to this message.", + color: embedColor + } + ] + }); + } catch (error) { + return await interaction.reply({ content: "Please enable your DMs.", ephemeral: true }); + } - await interaction.reply({ content: "Please check your DMs.", ephemeral: true }); + await interaction.reply({ content: "Please check your DMs.", ephemeral: true }); - const input = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60, - }); - if (input.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (input.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (input.first().content.toLowerCase() !== "yes") { - await user.send({ embeds: [cancelled] }); - return; - } + const input = await user.dmChannel.awaitMessages({ + filter: (m) => m.author.id === user.id, + max: 1, + time: 1000 * 60 + }); + if (input.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return; + } + if (input.size === 0) { + await user.send({ embeds: [tooLong] }); + return; + } + if (input.first().content.toLowerCase() !== "yes") { + await user.send({ embeds: [cancelled] }); + return; + } - await user.send({ - embeds: [ - { - title: "**Question 1**", - description: - ia1 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - ignM + - "`", - color: embedColor, - footer: { - text: "You have 5 minutes to respond to this message.", - }, - }, - ], - }); + await user.send({ + embeds: [ + { + title: "**Question 1**", + description: ia1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", + color: embedColor, + footer: { + text: "You have 5 minutes to respond to this message." + } + } + ] + }); - const answer1 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 5, - }); - if (answer1.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer1.first().content > 16) { - await user.send({ - embeds: [ - { - description: "Max character limit is 16.", - color: embedColor, - }, - ], - }); - return; - } - try { - await fetch(mojangAPI + answer1.first().content); - } catch (error) { - await user.send({ - embeds: [ - { - description: "That is not a valid Minecraft username.\n" + "Application cancelled.", - color: embedColor, - }, - ], - }); - return; - } - if (answer1.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer1.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer1_1 = answer1.first().content; + const answer1 = await user.dmChannel.awaitMessages({ + filter: (m) => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 5 + }); + if (answer1.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return; + } + if (answer1.first().content > 16) { + await user.send({ + embeds: [ + { + description: "Max character limit is 16.", + color: embedColor + } + ] + }); + return; + } + try { + await fetch(mojangAPI + answer1.first().content); + } catch (error) { + await user.send({ + embeds: [ + { + description: "That is not a valid Minecraft username.\n" + "Application cancelled.", + color: embedColor + } + ] + }); + return; + } + if (answer1.size === 0) { + await user.send({ embeds: [tooLong] }); + return; + } + if (answer1.first().content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }); + return; + } + const answer1_1 = answer1.first().content; - await user.send({ - embeds: [ - { - title: "**Question 2**", - description: - ia2 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - smallM + - "`", - color: embedColor, - footer: { - text: "You have 5 minutes to respond to this message.", - }, - }, - ], - }); - const answer2 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 5, - }); - if (answer2.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer2.first().content > 128) { - await user.send({ - embeds: [ - { - description: "Max character limit is 128.", - color: embedColor, - }, - ], - }); - return; - } - if (answer1.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer1.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer2_1 = answer1.first().content; + await user.send({ + embeds: [{ + title: "**Question 2**", + description: ia2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", + color: embedColor, + footer: { + text: "You have 5 minutes to respond to this message." + } + }] + }); + const answer2 = await user.dmChannel.awaitMessages({ + filter: (m) => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 5 + }); + if (answer2.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return; + } + if (answer2.first().content > 128) { + await user.send({ + embeds: [ + { + description: "Max character limit is 128.", + color: embedColor + } + ] + }); + return; + } + if (answer1.size === 0) { + await user.send({ embeds: [tooLong] }); + return; + } + if (answer1.first().content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }); + return; + } + const answer2_1 = answer1.first().content; - await user.send({ - embeds: [ - { - title: "**Question 3**", - description: - ia3 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); - const answer3 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 15, - }); - if (answer3.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer3.first().content > 256) { - await user.send({ - embeds: [ - { - description: "Max character limit is 256", - color: embedColor, - }, - ], - }); - return; - } - if (answer1.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer1.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer3_1 = answer1.first().content; + await user.send({ + embeds: [{ + title: "**Question 3**", + description: ia3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." + } + }] + }); + const answer3 = await user.dmChannel.awaitMessages({ + filter: (m) => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 15 + }); + if (answer3.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return; + } + if (answer3.first().content > 256) { + await user.send({ + embeds: [ + { + description: "Max character limit is 256", + color: embedColor + } + ] + }); + return; + } + if (answer1.size === 0) { + await user.send({ embeds: [tooLong] }); + return; + } + if (answer1.first().content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }); + return; + } + const answer3_1 = answer1.first().content; - await user.send({ - embeds: [ - { - description: "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor, - }, - ], - }); - const final = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 5, - }); - if (final.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (final.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (final.first().content.toLowerCase() !== "yes") { - await user.send({ embeds: [cancelled] }); - return; - } + await user.send({ + embeds: [{ + description: "If you want to submit your application, type `yes` if not, type `no`", + color: embedColor + }] + }) + const final = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 5 + }); + if (final.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (final.size === 0) { + await user.send({ embeds: [tooLong] }); + return + } + if (final.first().content.toLowerCase() !== 'yes') { + await user.send({ embeds: [cancelled]} ); + return + } - await user.send({ - embeds: [ - { - description: "Your application has been submitted!", - color: embedColor, - }, - ], - }); + await user.send({ + embeds: [{ + description: "Your application has been submitted!", + color: embedColor + }] + }) - const appChannel = await guild.channels.cache.get(inactivityLogChannel); + const appChannel = await guild.channels.cache.get(inactivityLogChannel); - await appChannel.send({ - embeds: [ - { - title: user.username + "#" + user.discriminator + " - Inactivity Application", - color: embedColor, - thumbnail: { - url: user.displayAvatarURL({ dynamic: true }), - }, - fields: [ - { - name: ria1, - value: "`" + answer1_1 + "`", - }, - { - name: ria2, - value: "`" + answer2_1 + "`", - }, - { - name: ria3, - value: "`" + answer3_1 + "`", - }, - ], - footer: { - icon_url: user.displayAvatarURL({ dynamic: true }), - text: "ID: " + user.id, - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("inactiveapplicationaccept") - .setLabel("Accept") - .setStyle(ButtonStyle.Primary), - new ButtonBuilder() - .setCustomId("inactiveapplicationdeny") - .setLabel("Deny") - .setStyle(ButtonStyle.Danger), - ), - ], - }); - }, + await appChannel.send({ + embeds: [{ + title: user.username + "#" + user.discriminator + " - Inactivity Application", + color: embedColor, + thumbnail: { + url: user.displayAvatarURL({ dynamic: true }) + }, + fields: [ + { + name: ria1, + value: "`" + answer1_1 + "`" + }, + { + name: ria2, + value: "`" + answer2_1 + "`" + }, + { + name: ria3, + value: "`" + answer3_1 + "`" + } + ], + footer: { + icon_url: user.displayAvatarURL({ dynamic: true }), + text: "ID: " + user.id + } + }], + components: [ + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("inactiveapplicationaccept") + .setLabel("Accept") + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("inactiveapplicationdeny") + .setLabel("Deny") + .setStyle(ButtonStyle.Danger), + ) + ] + }); + } }; diff --git a/events/buttons/inactiveapplicationaccept.js b/events/buttons/inactiveapplicationaccept.js index 3871fae..ca63a60 100644 --- a/events/buttons/inactiveapplicationaccept.js +++ b/events/buttons/inactiveapplicationaccept.js @@ -1,9 +1,11 @@ module.exports = { - name: "inactiveapplicationaccept", - description: "Accept an inactivity application.", - type: "button", + name: "inactiveapplicationaccept", + description: "Accept an inactivity application.", + type: "button", + + async execute(interaction) { - async execute(interaction) { - await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); - }, -}; + await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); + + } +} \ No newline at end of file diff --git a/events/buttons/inactiveapplicationdeny.js b/events/buttons/inactiveapplicationdeny.js index e6343ca..4611057 100644 --- a/events/buttons/inactiveapplicationdeny.js +++ b/events/buttons/inactiveapplicationdeny.js @@ -1,9 +1,11 @@ module.exports = { - name: "inactiveapplicationdeny", - description: "Denies an inactivity application.", - type: "button", + name: "inactiveapplicationdeny", + description: "Denies an inactivity application.", + type: "button", + + async execute(interaction) { - async execute(interaction) { - await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); - }, -}; + await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); + + } +} \ No newline at end of file diff --git a/events/buttons/staffapplicationaccept.js b/events/buttons/staffapplicationaccept.js index 3ec6954..d8ae5e7 100644 --- a/events/buttons/staffapplicationaccept.js +++ b/events/buttons/staffapplicationaccept.js @@ -1,13 +1,14 @@ -const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js"); -const { color } = require("../../config/options.json"); -const staffapp = require("../../schemas/staffAppSchema.js"); +const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); +const { color } = require('../../config/options.json'); +const staffapp = require('../../schemas/staffAppSchema.js'); module.exports = { - name: "staffapplicationaccept", - description: "Accept a staff application.", - type: "button", + name: 'staffapplicationaccept', + description: 'Accept a staff application.', + type: 'button', async execute(interaction) { + const user = interaction.user; const channel = interaction.channel; const guild = interaction.guild; @@ -15,18 +16,16 @@ module.exports = { const message = interaction.message; const embed = message.embeds[0]; - const applicantId = embed.footer.text.split(" ")[1]; + const applicantId = embed.footer.text.split(" ")[1] - const applicant = await guild.members.fetch(applicantId); + const applicant = await guild.members.fetch(applicantId) const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator; await applicant.send({ - embeds: [ - { - description: `Your application for the Illegitimate staff team has been accepted.`, - color: embedColor, - }, - ], + embeds: [{ + description: `Your application for the Illegitimate staff team has been accepted.`, + color: embedColor + }] }); await message.edit({ @@ -41,28 +40,27 @@ module.exports = { .setCustomId("staffapplicationdeny") .setLabel("Deny") .setStyle(ButtonStyle.Danger) - .setDisabled(true), - ), - ], + .setDisabled(true) + ) + ] }); await staffapp.findOneAndDelete({ userId: applicantId }); await interaction.reply({ - embeds: [ - { - title: applicantUsername + " - Staff Application.", - description: "Application accepted by <@" + user.id + ">.", - color: embedColor, - thumbnail: { - url: applicant.avatarURL(), - }, - footer: { - iconurl: guild.iconURL(), - text: "ID: " + applicantId, - }, + embeds: [{ + title: applicantUsername + " - Staff Application.", + description: "Application accepted by <@" + user.id + ">.", + color: embedColor, + thumbnail: { + url: applicant.avatarURL() }, - ], + footer: { + iconurl: guild.iconURL(), + text: "ID: " + applicantId + } + }] }); - }, -}; + + } +} \ No newline at end of file diff --git a/events/buttons/staffapplicationdeny.js b/events/buttons/staffapplicationdeny.js index b4bf1b9..271d5ef 100644 --- a/events/buttons/staffapplicationdeny.js +++ b/events/buttons/staffapplicationdeny.js @@ -1,24 +1,25 @@ -const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js"); +const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); module.exports = { - name: "staffapplicationdeny", - description: "Deny a guild application.", - type: "button", + name: 'staffapplicationdeny', + description: 'Deny a guild application.', + type: 'button', async execute(interaction) { + const modal = new ModalBuilder() - .setTitle("Deny Reason") - .setCustomId("staffdenyreasonbox") + .setTitle('Deny Reason') + .setCustomId('staffdenyreasonbox') .setComponents( new ActionRowBuilder().setComponents( new TextInputBuilder() - .setLabel("Deny Reason") - .setCustomId("staffdenyreason") + .setLabel('Deny Reason') + .setCustomId('staffdenyreason') .setStyle(TextInputStyle.Paragraph) - .setPlaceholder("Enter a reason for denying the application") - .setRequired(false), - ), - ); + .setPlaceholder('Enter a reason for denying the application') + .setRequired(false) + ) + ) await interaction.showModal(modal); - }, -}; + } +}; \ No newline at end of file diff --git a/events/buttons/staffapply.js b/events/buttons/staffapply.js index 1b85ab5..5982156 100644 --- a/events/buttons/staffapply.js +++ b/events/buttons/staffapply.js @@ -1,494 +1,437 @@ -const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require("discord.js"); -const { color } = require("../../config/options.json"); -const { largeM, smallM, ignM } = require("../../config/limitmessages.json"); -const { staffApplicationsChannel } = require("../../config/options.json"); -const { sq1, sq2, sq3, sq4, sq5, sq6 } = require("../../config/questions.json"); -const { rsq1, rsq2, rsq3, rsq4, rsq5, rsq6 } = require("../../config/questions.json"); -const { guildRole, guildStaff } = require("../../config/roles.json"); -const mongoose = require("mongoose"); -const staffapp = require("../../schemas/staffAppSchema.js"); -const fetch = require("axios"); +const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js'); +const { color } = require('../../config/options.json'); +const { largeM, smallM, ignM } = require('../../config/limitmessages.json') +const { staffApplicationsChannel } = require('../../config/options.json'); +const { sq1, sq2, sq3, sq4, sq5, sq6 } = require('../../config/questions.json'); +const { rsq1, rsq2, rsq3, rsq4, rsq5, rsq6 } = require('../../config/questions.json'); +const { guildRole, guildStaff } = require('../../config/roles.json') +const mongoose = require('mongoose'); +const staffapp = require('../../schemas/staffAppSchema.js'); +const fetch = require('axios'); module.exports = { - name: "staffapply", - description: "Apply for the staff team.", - type: "button", + name: 'staffapply', + description: 'Apply for the staff team.', + type: 'button', async execute(interaction) { + const user = interaction.user; const guild = interaction.guild; const embedColor = Number(color.replace("#", "0x")); const userRoles = interaction.member.roles.cache; - const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"; + const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/" if (interaction.customId === "staffapply") { + await interaction.deferReply({ ephemeral: true }); if (!userRoles.has(guildRole)) { - await interaction.editReply({ - content: "You must be a member of the guild to apply for staff.", - ephemeral: true, - }); - return; + await interaction.editReply({content: "You must be a member of the guild to apply for staff.", ephemeral: true}); + return } if (userRoles.has(guildStaff)) { - await interaction.editReply({ content: "You are already a staff member.", ephemeral: true }); - return; + await interaction.editReply({content: "You are already a staff member.", ephemeral: true}); + return } const application = await staffapp.findOne({ userID: user.id }); - + if (application) { - await interaction.editReply({ - content: "You already have an application in progress.", - ephemeral: true, - }); - return; + await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true }); + return } - - const tooLong = new EmbedBuilder().setDescription("You took too long to respond.").setColor(embedColor); + + const tooLong = new EmbedBuilder() + .setDescription("You took too long to respond.") + .setColor(embedColor) const cancelled = new EmbedBuilder() .setDescription("You have cancelled your application.") - .setColor(embedColor); + .setColor(embedColor) const attachments = new EmbedBuilder() .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") - .setColor(embedColor); - - try { - await user.send({ - embeds: [ - { - title: "Staff Application", - description: - "Please answer the following questions to apply for staff.\n" + - "If you wish to cancel your application, please press type `cancel` at any time.\n" + - "If you wish to proceed with your application, please type `yes`.\n\n" + - "**Do not upload images, videos, or GIFS.**\n" + - "You have a minute to respond to this message.", + .setColor(embedColor) + + try { + await user.send({ + embeds: [{ + title: 'Staff Application', + description: "Please answer the following questions to apply for staff.\n" + + "If you wish to cancel your application, please press type `cancel` at any time.\n" + + "If you wish to proceed with your application, please type `yes`.\n\n" + + "**Do not upload images, videos, or GIFS.**\n" + + "You have a minute to respond to this message.", color: embedColor, - }, - ], + }] + }) + } catch (error) { + await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true }); + return + } + + await interaction.editReply({ content: "Please check your DMs.", ephemeral: true}) + + const input = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 }); - } catch (error) { - await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true }); - return; - } - - await interaction.editReply({ content: "Please check your DMs.", ephemeral: true }); - - const input = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60, - }); - if (input.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (input.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (input.first().content.toLowerCase() !== "yes") { - await user.send({ embeds: [cancelled] }); - return; - } - - // first question - const question1 = await user.send({ - embeds: [ - { - title: "**Question 1**", - description: - sq1 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - ignM + - "`", + if (input.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (input.size === 0) { + await user.send({ embeds: [tooLong] }); + return + } + if (input.first().content.toLowerCase() !== 'yes') { + await user.send({ embeds: [cancelled]} ); + return + } + + // first question + const question1 = await user.send({ + embeds: [{ + title : "**Question 1**", + description: sq1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", color: embedColor, - footer: { - text: "You have 5 minutes to respond to this message.", - }, - }, - ], - }); - const answer1 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 5, - }); - if (answer1.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer1.first().content > 16) { - await user.send({ - embeds: [ - { + footer:{ + text: "You have 5 minutes to respond to this message." + } + }] + }) + const answer1 = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 5, + }); + if (answer1.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (answer1.first().content > 16) { + await user.send({ + embeds: [{ description: "Max character limit is 16.", - color: embedColor, - }, - ], - }); - return; - } - try { - await fetch(mojangAPI + answer1.first().content); - } catch (error) { - await user.send({ - embeds: [ - { - description: "That is not a valid Minecraft username.\n" + "Application cancelled.", - color: embedColor, - }, - ], - }); - return; - } - if (answer1.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer1.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer1_1 = answer1.first().content; - - // second question - const question2 = await user.send({ - embeds: [ - { - title: "**Question 2**", - description: - sq2 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + - "`(64 characters max)`", + color: embedColor + }] + }) + return + } + try { + await fetch(mojangAPI + answer1.first().content) + } catch (error) { + await user.send({ + embeds: [{ + description: "That is not a valid Minecraft username.\n" + + "Application cancelled.", + color: embedColor + }] + }) + return + } + if (answer1.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer1.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return + } + const answer1_1 = answer1.first().content + + // second question + const question2 = await user.send({ + embeds: [{ + title : "**Question 2**", + description: sq2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`", color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); - const answer2 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 15, - }); - if (answer2.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer2.first().content > 64) { - await user.send({ - embeds: [ - { + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer2 = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 15 + }); + if (answer2.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (answer2.first().content > 64) { + await user.send({ + embeds: [{ description: "Max character limit is 64.", - color: embedColor, - }, - ], - }); - return; - } - if (answer2.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer2.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer2_1 = answer2.first().content; - - // third question - const question3 = await user.send({ - embeds: [ - { - title: "**Question 3**", - description: - sq3 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", + color: embedColor + }] + }) + return + } + if (answer2.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer2.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return + } + const answer2_1 = answer2.first().content + + // third question + const question3 = await user.send({ + embeds: [{ + title : "**Question 3**", + description: sq3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); - const answer3 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 15, - }); - if (answer3.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer3.first().content > 256) { - await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor, - }, - ], + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer3 = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 15 }); - } - if (answer3.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer3.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer3_1 = answer3.first().content; - - // fourth question - const question4 = await user.send({ - embeds: [ - { - title: "**Question 4**", - description: - sq4 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", + if (answer3.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (answer3.first().content > 256) { + await user.send({ + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] + }) + } + if (answer3.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer3.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return + } + const answer3_1 = answer3.first().content + + // fourth question + const question4 = await user.send({ + embeds: [{ + title : "**Question 4**", + description: sq4 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); - const answer4 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 15, - }); - if (answer4.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer4.first().content > 256) { - await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor, - }, - ], + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer4 = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 15 }); - } - if (answer4.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer4.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer4_1 = answer4.first().content; - - // fifth question - const question5 = await user.send({ - embeds: [ - { - title: "**Question 5**", - description: - sq5 + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", + if (answer4.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (answer4.first().content > 256) { + await user.send({ + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] + }) + } + if (answer4.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer4.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return + } + const answer4_1 = answer4.first().content + + // fifth question + const question5 = await user.send({ + embeds: [{ + title : "**Question 5**", + description: sq5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); - const answer5 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 15, - }); - if (answer5.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer5.first().content > 256) { - await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor, - }, - ], + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer5 = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 15 }); - } - if (answer5.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer5.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer5_1 = answer5.first().content; - - // sixth question - const question6 = await user.send({ - embeds: [ - { - title: "**Question 6**", - description: - sq6 + - "\n\nPlease type your answer below or type `cancel` to cancel your application." + - "`(We expect a longer answer here)`\n`" + - largeM + - "`", + if (answer5.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (answer5.first().content > 256) { + await user.send({ + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] + }) + } + if (answer5.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer5.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return + } + const answer5_1 = answer5.first().content + + // sixth question + const question6 = await user.send({ + embeds: [{ + title : "**Question 6**", + description: sq6 + "\n\nPlease type your answer below or type `cancel` to cancel your application." + + "`(We expect a longer answer here)`\n`" + largeM + "`", color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], - }); - const answer6 = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 15, - }); - if (answer6.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (answer6.first().content > 256) { - await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor, - }, - ], + footer:{ + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer6 = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 15 }); - } - if (answer6.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (answer6.first().content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }); - return; - } - const answer6_1 = answer6.first().content; + if (answer6.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (answer6.first().content > 256) { + await user.send({ + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] + }) + } + if (answer6.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer6.first().content.toLowerCase() === 'cancel') { + await user.send({ embeds: [cancelled] }) + return + } + const answer6_1 = answer6.first().content - await user.send({ - embeds: [ - { + await user.send({ + embeds: [{ description: "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor, - }, - ], - }); - - const final = await user.dmChannel.awaitMessages({ - filter: (m) => m.author.id === user.id, - max: 1, - time: 1000 * 60 * 5, - }); - if (final.first().attachments.size > 0) { - await user.send({ embeds: [attachments] }); - return; - } - if (final.size === 0) { - await user.send({ embeds: [tooLong] }); - return; - } - if (final.first().content.toLowerCase() !== "yes") { - await user.send({ embeds: [cancelled] }); - return; - } - - await user.send({ - embeds: [ - { + color: embedColor + }] + }) + + const final = await user.dmChannel.awaitMessages({ + filter: m => m.author.id === user.id, + max: 1, + time: 1000 * 60 * 5 + }); + if (final.first().attachments.size > 0) { + await user.send({ embeds: [attachments] }); + return + } + if (final.size === 0) { + await user.send({ embeds: [tooLong] }); + return + } + if (final.first().content.toLowerCase() !== 'yes') { + await user.send({ embeds: [cancelled]} ); + return + } + + await user.send({ + embeds: [{ description: "Your application has been submitted!", - color: embedColor, - }, - ], - }); + color: embedColor + }] + }) - const userCheck = await fetch(mojangAPI + answer1_1); - const uuid = userCheck.data.id; + const userCheck = await fetch(mojangAPI + answer1_1) + const uuid = userCheck.data.id - const newStaffApp = new staffapp({ - _id: new mongoose.Types.ObjectId(), - userID: user.id, - uuid: uuid, - }); + const newStaffApp = new staffapp({ + _id: new mongoose.Types.ObjectId(), + userID: user.id, + uuid: uuid, + }) - await newStaffApp.save(); - await user.deleteDM(); + await newStaffApp.save() + await user.deleteDM(); - const channel = guild.channels.cache.get(staffApplicationsChannel); + const channel = guild.channels.cache.get(staffApplicationsChannel); - await channel.send({ - embeds: [ - { + await channel.send({ + embeds: [{ title: user.username + "#" + user.discriminator + " - Staff Application", color: embedColor, thumbnail: { - url: user.avatarURL(), + url: user.avatarURL() }, fields: [ { name: rsq1, - value: "```" + answer1_1 + "```", + value: "```" + answer1_1 + "```" }, { name: rsq2, - value: "```" + answer2_1 + "```", + value: "```" + answer2_1 + "```" }, { name: rsq3, - value: "```" + answer3_1 + "```", + value: "```" + answer3_1 + "```" }, { name: rsq4, - value: "```" + answer4_1 + "```", + value: "```" + answer4_1 + "```" }, { name: rsq5, - value: "```" + answer5_1 + "```", + value: "```" + answer5_1 + "```" }, { name: rsq6, - value: "```" + answer6_1 + "```", - }, + value: "```" + answer6_1 + "```" + } + ], footer: { iconURL: guild.iconURL(), - text: "ID: " + user.id, - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("staffapplicationaccept") - .setLabel("Accept") - .setStyle(ButtonStyle.Primary), - new ButtonBuilder() - .setCustomId("staffapplicationdeny") - .setLabel("Deny") - .setStyle(ButtonStyle.Danger), - ), - ], - }); + text: "ID: " + user.id + } + }], + components: [ + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("staffapplicationaccept") + .setLabel("Accept") + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("staffapplicationdeny") + .setLabel("Deny") + .setStyle(ButtonStyle.Danger) + ) + ] + } + ); } - }, -}; + } +} \ No newline at end of file diff --git a/events/buttons/verify.js b/events/buttons/verify.js index 5b301f6..8a1d920 100644 --- a/events/buttons/verify.js +++ b/events/buttons/verify.js @@ -1,27 +1,28 @@ -const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js"); -const { color } = require("../../config/options.json"); +const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js') +const { color } = require('../../config/options.json') module.exports = { - name: "verify", - description: "Configure the bot.", - type: "button", + name: 'verify', + description: 'Configure the bot.', + type: 'button', - async execute(interaction) { - const modal = new ModalBuilder() - .setTitle("Verification") - .setCustomId("verifybox") - .setComponents( - new ActionRowBuilder().setComponents( - new TextInputBuilder() - .setLabel("IGN") - .setCustomId("verifyfield") - .setStyle(TextInputStyle.Short) - .setPlaceholder("Enter your ign.") - .setRequired(true) - .setMinLength(3) - .setMaxLength(16), - ), - ); - await interaction.showModal(modal); - }, -}; + async execute(interaction) { + + const modal = new ModalBuilder() + .setTitle("Verification") + .setCustomId("verifybox") + .setComponents( + new ActionRowBuilder().setComponents( + new TextInputBuilder() + .setLabel("IGN") + .setCustomId("verifyfield") + .setStyle(TextInputStyle.Short) + .setPlaceholder("Enter your ign.") + .setRequired(true) + .setMinLength(3) + .setMaxLength(16) + ) + ) + await interaction.showModal(modal) + } +} diff --git a/events/buttons/waitingListUpdate.js b/events/buttons/waitingListUpdate.js index ab0c68b..1a74dff 100644 --- a/events/buttons/waitingListUpdate.js +++ b/events/buttons/waitingListUpdate.js @@ -1,64 +1,66 @@ -const mongoose = require("mongoose"); -const waitinglist = require("../../schemas/waitinglistSchema.js"); -const env = require("dotenv").config(); +const mongoose = require('mongoose'); +const waitinglist = require('../../schemas/waitinglistSchema.js'); +const env = require('dotenv').config(); const key = process.env.HYPIXELAPIKEY; -const { hypixelGuildID } = require("../../config/options.json"); +const { hypixelGuildID } = require("../../config/options.json") const fetch = require("axios"); module.exports = { - name: "waitinglistupdate", - description: "Update the waiting list.", - type: "button", + name: 'waitinglistupdate', + description: 'Update the waiting list.', + type: 'button', - async execute(interaction) { - await interaction.deferReply({ ephemeral: true }); + async execute(interaction) { - const user = interaction.user; - const message = interaction.message; - const embed = message.embeds[0]; - const accepted = await waitinglist.find(); - const guildAPI = "https://api.hypixel.net/guild"; - const guild = guildAPI + "?key=" + key + "&player="; + await interaction.deferReply({ ephemeral: true }); + + const user = interaction.user; + const message = interaction.message; + const embed = message.embeds[0]; + const accepted = await waitinglist.find() + const guildAPI = "https://api.hypixel.net/guild" + const guild = guildAPI + "?key=" + key + "&player=" for (let i = 0; i < accepted.length; i++) { - const uuid = accepted[i].uuid; - const check = await fetch(guild + uuid); + + const uuid = accepted[i].uuid + const check = await fetch(guild + uuid) if (check.data.guild._id === hypixelGuildID) { - await waitinglist.findOneAndDelete({ uuid: uuid }); - continue; + await waitinglist.findOneAndDelete({ uuid: uuid }) + continue } + } - let fields = []; + let fields = []; - for (let i = 0; i < accepted.length; i++) { - const timestamp1 = accepted[i].timestamp / 1000; - const timestamp = Math.floor(timestamp1); + for (let i = 0; i < accepted.length; i++) { - fields.push({ - name: `${i + 1}. ${accepted[i].IGN}`, - value: `TS: `, - }); - } + const timestamp1 = accepted[i].timestamp / 1000 + const timestamp = Math.floor(timestamp1) - await message.edit({ - embeds: [ - { - title: embed.title, - description: embed.description, - color: embed.color, - footer: { - text: "Last updated by " + user.username, - icon_url: user.avatarURL(), - }, - thumbnail: embed.thumbnail, - fields: fields, - timestamp: new Date(), - }, - ], - }); + fields.push({ + name: `${i + 1}. ${accepted[i].IGN}`, + value: `TS: ` + }); + } - await interaction.editReply({ content: "Updated the waiting list", ephemeral: true }); - }, -}; + await message.edit({ + embeds: [{ + title: embed.title, + description: embed.description, + color: embed.color, + footer: { + text: "Last updated by " + user.username, + icon_url: user.avatarURL(), + }, + thumbnail: embed.thumbnail, + fields: fields, + timestamp: new Date(), + }], + }); + + await interaction.editReply({ content: 'Updated the waiting list', ephemeral: true }); + } +} \ No newline at end of file diff --git a/events/modals/denyreasonbox.js b/events/modals/denyreasonbox.js index 14f60fd..a42ae7c 100644 --- a/events/modals/denyreasonbox.js +++ b/events/modals/denyreasonbox.js @@ -1,21 +1,22 @@ -const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js"); -const { color } = require("../../config/options.json"); -const mongoose = require("mongoose"); -const guildapp = require("../../schemas/guildAppSchema.js"); -const fs = require("fs"); -const path = require("path"); +const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); +const { color } = require('../../config/options.json'); +const mongoose = require('mongoose'); +const guildapp = require('../../schemas/guildAppSchema.js'); +const fs = require('fs'); +const path = require('path'); module.exports = { - name: "denyreasonbox", - description: "Deny reason box.", - type: "modal", + name: 'denyreasonbox', + description: 'Deny reason box.', + type: 'modal', async execute(interaction) { + if (interaction.type !== InteractionType.ModalSubmit) return; if (interaction.customId !== "denyreasonbox") return; - + interaction.deferReply(); - + const guild = interaction.guild; const message = interaction.message; @@ -23,7 +24,7 @@ module.exports = { const applicantId = embed.footer.text.split(" ")[1]; const applicant = await guild.members.fetch(applicantId); - const reason = interaction.fields.fields.get("denyreason").value || "No reason provided"; + const reason = interaction.fields.fields.get('denyreason').value || "No reason provided"; const embedColor = Number(color.replace("#", "0x")); const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`); @@ -44,15 +45,14 @@ module.exports = { .setCustomId("checkstats") .setLabel("Check Stats") .setStyle(ButtonStyle.Secondary) - .setDisabled(true), - ), - ], + .setDisabled(true) + ) + ] }); const dmMessage = new EmbedBuilder() - .setDescription( - "Your application for the Illegitimate guild has been denied\n" + "**Reason:** `" + reason + "`", - ) + .setDescription("Your application for the Illegitimate guild has been denied\n" + + "**Reason:** `" + reason + "`") .setColor(embedColor); await applicant.send({ embeds: [dmMessage] }); @@ -60,26 +60,19 @@ module.exports = { await guildapp.findOneAndDelete({ userID: applicantId }); await interaction.editReply({ - embeds: [ - { - title: "Application Denied", - description: - "The application has been denied by <@" + - interaction.user.id + - ">.\n" + - "**Reason:** `" + - reason + - "`", - color: embedColor, - thumbnail: { - url: applicant.avatarURL(), - }, - footer: { - iconURL: guild.iconURL(), - text: "ID: " + applicant.id, - }, + embeds: [{ + title: "Application Denied", + description: "The application has been denied by <@" + interaction.user.id + ">.\n" + + "**Reason:** `" + reason + "`", + color: embedColor, + thumbnail: { + url: applicant.avatarURL() }, - ], + footer: { + iconURL: guild.iconURL(), + text: "ID: " + applicant.id + } + }], }); - }, -}; + } +} \ No newline at end of file diff --git a/events/modals/staffdenyreasonbox.js b/events/modals/staffdenyreasonbox.js index 35584e5..6c94df6 100644 --- a/events/modals/staffdenyreasonbox.js +++ b/events/modals/staffdenyreasonbox.js @@ -1,30 +1,31 @@ -const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js"); -const { color } = require("../../config/options.json"); -const mongoose = require("mongoose"); -const staffapp = require("../../schemas/staffAppSchema.js"); -const fs = require("fs"); -const path = require("path"); +const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); +const { color } = require('../../config/options.json'); +const mongoose = require('mongoose'); +const staffapp = require('../../schemas/staffAppSchema.js'); +const fs = require('fs'); +const path = require('path'); module.exports = { - name: "staffdenyreasonbox", - description: "Deny reason box.", - type: "modal", + name: 'staffdenyreasonbox', + description: 'Deny reason box.', + type: 'modal', async execute(interaction) { + if (interaction.type !== InteractionType.ModalSubmit) return; if (interaction.customId !== "staffdenyreasonbox") return; - + interaction.deferReply(); - + const channel = interaction.channel; const guild = interaction.guild; - const reason = interaction.fields.fields.get("staffdenyreason").value || "No reason provided"; + const reason = interaction.fields.fields.get('staffdenyreason').value || "No reason provided"; const embedColor = Number(color.replace("#", "0x")); const message = interaction.message; const embed = message.embeds[0]; - const applicantId = embed.footer.text.split(" ")[1]; - const applicant = await guild.members.fetch(applicantId); + const applicantId = embed.footer.text.split(" ")[1] + const applicant = await guild.members.fetch(applicantId) await message.edit({ components: [ @@ -39,14 +40,13 @@ module.exports = { .setLabel("Deny") .setStyle(ButtonStyle.Danger) .setDisabled(true), - ), - ], + ) + ] }); const dmMessage = new EmbedBuilder() - .setDescription( - "Your application for the Illegitimate guild staff has been denied\n" + "**Reason:** `" + reason + "`", - ) + .setDescription("Your application for the Illegitimate guild staff has been denied\n" + + "**Reason:** `" + reason + "`") .setColor(embedColor); await applicant.send({ embeds: [dmMessage] }); @@ -54,26 +54,19 @@ module.exports = { await staffapp.findOneAndDelete({ userID: applicantId }); await interaction.editReply({ - embeds: [ - { - title: "Application Denied", - description: - "The application has been denied by <@" + - interaction.user.id + - ">.\n" + - "**Reason:** `" + - reason + - "`", - color: embedColor, - thumbnail: { - url: applicant.avatarURL(), - }, - footer: { - iconURL: guild.iconURL(), - text: "ID: " + applicant.id, - }, + embeds: [{ + title: "Application Denied", + description: "The application has been denied by <@" + interaction.user.id + ">.\n" + + "**Reason:** `" + reason + "`", + color: embedColor, + thumbnail: { + url: applicant.avatarURL() }, - ], - }); - }, -}; + footer: { + iconURL: guild.iconURL(), + text: "ID: " + applicant.id + } + }], + });; + } +} \ No newline at end of file diff --git a/index.js b/index.js index 9c7659d..ce5d86e 100644 --- a/index.js +++ b/index.js @@ -1,21 +1,21 @@ -const { Client, GatewayIntentBits, Partials, ActivityType, Events, Collection } = require("discord.js"); -const { botLogChannel, color } = require("./config/options.json"); -const env = require("dotenv").config(); +const { Client, GatewayIntentBits, Partials, ActivityType, Events, Collection } = require('discord.js'); +const { botLogChannel, color } = require('./config/options.json'); +const env = require('dotenv').config(); const token = process.env.TOKEN; const mongoURI = process.env.MONGOURI; -const { connect } = require("mongoose"); -const path = require("path"); -const fs = require("fs"); +const { connect } = require('mongoose'); +const path = require('path'); +const fs = require('fs'); const client = new Client({ intents: [ - GatewayIntentBits.Guilds, - GatewayIntentBits.GuildMessages, - GatewayIntentBits.GuildMembers, - GatewayIntentBits.MessageContent, - GatewayIntentBits.DirectMessages, + GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, + GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, + GatewayIntentBits.DirectMessages ], - partials: [Partials.GuildMember, Partials.User, Partials.Message, Partials.Channel], + partials: [ + Partials.GuildMember, Partials.User, Partials.Message, Partials.Channel + ] }); client.commands = new Collection(); @@ -23,14 +23,15 @@ client.events = new Collection(); client.modals = new Collection(); //! commands -const cmdPath = path.join(__dirname, "commands"); -const cmdFiles = fs.readdirSync(cmdPath).filter((file) => file.endsWith(".js")); +const cmdPath = path.join(__dirname, 'commands'); +const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith('.js')); for (const file of cmdFiles) { + const filePath = path.join(cmdPath, file); const cmd = require(filePath); - if ("data" in cmd && "execute" in cmd && cmd.type === "slash") { + if ('data' in cmd && 'execute' in cmd && cmd.type === 'slash') { client.commands.set(cmd.data.name, cmd); } else { console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`); @@ -38,14 +39,16 @@ for (const file of cmdFiles) { } //! commands testing -const cmdTestPath = path.join(__dirname, "commands-testing"); -const cmdTestFiles = fs.readdirSync(cmdTestPath).filter((file) => file.endsWith(".js")); +const cmdTestPath = path.join(__dirname, 'commands-testing'); +const cmdTestFiles = + fs.readdirSync(cmdTestPath).filter(file => file.endsWith('.js')); for (const file of cmdTestFiles) { + const filePath = path.join(cmdTestPath, file); const cmd = require(filePath); - if ("data" in cmd && "execute" in cmd && cmd.type === "slash") { + if ('data' in cmd && 'execute' in cmd && cmd.type === 'slash') { client.commands.set(cmd.data.name, cmd); } else { console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`); @@ -53,8 +56,9 @@ for (const file of cmdTestFiles) { } //! command handler -client.on(Events.InteractionCreate, async (interaction) => { - if (!interaction.isChatInputCommand()) return; +client.on(Events.InteractionCreate, async interaction => { + if (!interaction.isChatInputCommand()) + return; const command = interaction.client.commands.get(interaction.commandName); @@ -68,21 +72,23 @@ client.on(Events.InteractionCreate, async (interaction) => { } catch (error) { console.error(error); await interaction.reply({ - content: "There was an error while executing this command!", - ephemeral: true, - }); + content: 'There was an error while executing this command!', + ephemeral: true + }) } }); //! commands -const contextMenuPath = path.join(__dirname, "commands-contextmenu"); -const contextMenuFiles = fs.readdirSync(contextMenuPath).filter((file) => file.endsWith(".js")); +const contextMenuPath = path.join(__dirname, 'commands-contextmenu'); +const contextMenuFiles = + fs.readdirSync(contextMenuPath).filter(file => file.endsWith('.js')); for (const file of contextMenuFiles) { + const filePath = path.join(contextMenuPath, file); const cmd = require(filePath); - if ("data" in cmd && "execute" in cmd && cmd.type === "contextmenu") { + if ('data' in cmd && 'execute' in cmd && cmd.type === 'contextmenu') { client.commands.set(cmd.data.name, cmd); } else { console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`); @@ -90,8 +96,9 @@ for (const file of contextMenuFiles) { } //! context menu command handler -client.on(Events.InteractionCreate, async (interaction) => { - if (!interaction.isContextMenuCommand()) return; +client.on(Events.InteractionCreate, async interaction => { + if (!interaction.isContextMenuCommand()) + return; const command = interaction.client.commands.get(interaction.commandName); @@ -105,21 +112,22 @@ client.on(Events.InteractionCreate, async (interaction) => { } catch (error) { console.error(error); await interaction.reply({ - content: "There was an error while executing this command!", - ephemeral: true, - }); + content: 'There was an error while executing this command!', + ephemeral: true + }) } }); //! button events -const btnPath = path.join(__dirname, "events", "buttons"); -const btnFiles = fs.readdirSync(btnPath).filter((file) => file.endsWith(".js")); +const btnPath = path.join(__dirname, 'events', 'buttons'); +const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith('.js')); for (const file of btnFiles) { + const filePath = path.join(btnPath, file); const btn = require(filePath); - if ("name" in btn && "execute" in btn && btn.type === "button") { + if ('name' in btn && 'execute' in btn && btn.type === 'button') { client.events.set(btn.name, btn); } else { console.log(`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`); @@ -127,8 +135,9 @@ for (const file of btnFiles) { } //! button event handler -client.on(Events.InteractionCreate, async (event) => { - if (!event.isButton()) return; +client.on(Events.InteractionCreate, async event => { + if (!event.isButton()) + return; const event2 = event.client.events.get(event.customId); @@ -142,53 +151,57 @@ client.on(Events.InteractionCreate, async (event) => { } catch (error) { console.error(error); await event.reply({ - content: "There was an error while executing this event!", - ephemeral: true, - }); + content: 'There was an error while executing this event!', + ephemeral: true + }) } -}); +}) //! modals -const modalPath = path.join(__dirname, "events", "modals"); -const modalFiles = fs.readdirSync(modalPath).filter((file) => file.endsWith(".js")); +const modalPath = path.join(__dirname, 'events', 'modals'); +const modalFiles = + fs.readdirSync(modalPath).filter(file => file.endsWith('.js')); for (const file of modalFiles) { + const filePath = path.join(modalPath, file); const modal = require(filePath); - if ("name" in modal && "execute" in modal && modal.type === "modal") { + if ('name' in modal && 'execute' in modal && modal.type === 'modal') { client.on(Events.InteractionCreate, modal.execute); } else { console.log(`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`); } } -client.on(Events.InteractionCreate, async (interaction) => { +client.on(Events.InteractionCreate, async interaction => { if (interaction.isCommand()) { - console.log( - interaction.user.username + "#" + interaction.user.discriminator + " ran " + interaction.commandName, - ); + console.log(interaction.user.username + "#" + + interaction.user.discriminator + " ran " + + interaction.commandName); } else if (interaction.isButton()) { - console.log( - interaction.user.username + "#" + interaction.user.discriminator + " clicked " + interaction.customId, - ); + console.log(interaction.user.username + "#" + + interaction.user.discriminator + " clicked " + + interaction.customId); } }); client.on(Events.ClientReady, () => { console.log("Logged in as " + client.user.tag + "!"); const channel = client.channels.cache.get(botLogChannel); - const embedColor = Number(color.replace("#", "0x")); + const embedColor = Number(color.replace('#', '0x')) if (!channel) { return; } - channel.send({ embeds: [{ description: `Bot is online!`, color: embedColor }] }); + channel.send( + { embeds: [{ description: `Bot is online!`, color: embedColor }] }); }); client.on(Events.ClientReady, () => { - client.user.setActivity({ name: "over the Illegitimate Server", type: ActivityType.Watching }); + client.user.setActivity( + { name: "over the Illegitimate Server", type: ActivityType.Watching }); const activities = [ { name: "for Martina's return", type: ActivityType.Watching }, @@ -197,17 +210,17 @@ client.on(Events.ClientReady, () => { { name: "with Perlcence the AI", type: ActivityType.Playing }, { name: "with ur mom in my bed", type: ActivityType.Playing }, { name: "with Jone the idiot", type: ActivityType.Playing }, - { name: "over the Illegitimate Server", type: ActivityType.Watching }, + { name: "over the Illegitimate Server", type: ActivityType.Watching } ]; let i = 0; - setInterval(() => client.user.setActivity(activities[i++ % activities.length]), 1000 * 60 * 30); -}); -client.on(Events.ClientReady, () => { - client.user.setStatus("dnd"); + setInterval(() => + client.user.setActivity(activities[i++ % activities.length]), + 1000 * 60 * 30) }); +client.on(Events.ClientReady, () => { client.user.setStatus('dnd'); }); client.login(token); connect(mongoURI, {}).then(() => { - console.log("Connected to MongoDB"); -}); + console.log('Connected to MongoDB'); +}) diff --git a/package-lock.json b/package-lock.json index 310d819..2835087 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,710 +1,710 @@ { - "name": "illegitimate-bot", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "illegitimate-bot", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "axios": "^1.3.4", - "discord.js": "^14.8.0", - "dotenv": "^16.0.3", - "mongoose": "^7.0.1" - } - }, - "node_modules/@discordjs/builders": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.5.0.tgz", - "integrity": "sha512-7XxT78mnNBPigHn2y6KAXkicxIBFtZREGWaRZ249EC1l6gBUEP8IyVY5JTciIjJArxkF+tg675aZvsTNTKBpmA==", - "dependencies": { - "@discordjs/formatters": "^0.2.0", - "@discordjs/util": "^0.2.0", - "@sapphire/shapeshift": "^3.8.1", - "discord-api-types": "^0.37.35", - "fast-deep-equal": "^3.1.3", - "ts-mixer": "^6.0.3", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/@discordjs/collection": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.4.0.tgz", - "integrity": "sha512-hiOJyk2CPFf1+FL3a4VKCuu1f448LlROVuu8nLz1+jCOAPokUcdFAV+l4pd3B3h6uJlJQSASoZzrdyNdjdtfzQ==", - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/@discordjs/formatters": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.2.0.tgz", - "integrity": "sha512-vn4oMSXuMZUm8ITqVOtvE7/fMMISj4cI5oLsR09PEQXHKeKDAMLltG/DWeeIs7Idfy6V8Fk3rn1e69h7NfzuNA==", - "dependencies": { - "discord-api-types": "^0.37.35" - }, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/@discordjs/rest": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.6.0.tgz", - "integrity": "sha512-HGvqNCZ5Z5j0tQHjmT1lFvE5ETO4hvomJ1r0cbnpC1zM23XhCpZ9wgTCiEmaxKz05cyf2CI9p39+9LL+6Yz1bA==", - "dependencies": { - "@discordjs/collection": "^1.4.0", - "@discordjs/util": "^0.2.0", - "@sapphire/async-queue": "^1.5.0", - "@sapphire/snowflake": "^3.4.0", - "discord-api-types": "^0.37.35", - "file-type": "^18.2.1", - "tslib": "^2.5.0", - "undici": "^5.20.0" - }, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/@discordjs/util": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-0.2.0.tgz", - "integrity": "sha512-/8qNbebFzLWKOOg+UV+RB8itp4SmU5jw0tBUD3ifElW6rYNOj1Ku5JaSW7lLl/WgjjxF01l/1uQPCzkwr110vg==", - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/@sapphire/async-queue": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz", - "integrity": "sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA==", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@sapphire/shapeshift": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.8.1.tgz", - "integrity": "sha512-xG1oXXBhCjPKbxrRTlox9ddaZTvVpOhYLmKmApD/vIWOV1xEYXnpoFs68zHIZBGbqztq6FrUPNPerIrO1Hqeaw==", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@sapphire/snowflake": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.4.0.tgz", - "integrity": "sha512-zZxymtVO6zeXVMPds+6d7gv/OfnCc25M1Z+7ZLB0oPmeMTPeRWVPQSS16oDJy5ZsyCOLj7M6mbZml5gWXcVRNw==", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@tokenizer/token": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", - "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" - }, - "node_modules/@types/node": { - "version": "18.15.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.0.tgz", - "integrity": "sha512-z6nr0TTEOBGkzLGmbypWOGnpSpSIBorEhC4L+4HeQ2iezKCi4f77kyslRwvHeNitymGQ+oFyIWGP96l/DPSV9w==" - }, - "node_modules/@types/webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog==" - }, - "node_modules/@types/whatwg-url": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", - "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", - "dependencies": { - "@types/node": "*", - "@types/webidl-conversions": "*" - } - }, - "node_modules/@types/ws": { - "version": "8.5.4", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz", - "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/axios": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz", - "integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/bson": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/bson/-/bson-5.0.1.tgz", - "integrity": "sha512-y09gBGusgHtinMon/GVbv1J6FrXhnr/+6hqLlSmEFzkz6PodqF6TxjyvfvY3AfO+oG1mgUtbC86xSbOlwvM62Q==", - "engines": { - "node": ">=14.20.1" - } - }, - "node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/discord-api-types": { - "version": "0.37.37", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.37.tgz", - "integrity": "sha512-LDMBKzl/zbvHO/yCzno5hevuA6lFIXJwdKSJZQrB+1ToDpFfN9thK+xxgZNR4aVkI7GHRDja0p4Sl2oYVPnHYg==" - }, - "node_modules/discord.js": { - "version": "14.8.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.8.0.tgz", - "integrity": "sha512-UOxYtc/YnV7jAJ2gISluJyYeBw4e+j8gWn+IoqG8unaHAVuvZ13DdYN0M1f9fbUgUvSarV798inIrYFtDNDjwQ==", - "dependencies": { - "@discordjs/builders": "^1.5.0", - "@discordjs/collection": "^1.4.0", - "@discordjs/formatters": "^0.2.0", - "@discordjs/rest": "^1.6.0", - "@discordjs/util": "^0.2.0", - "@sapphire/snowflake": "^3.4.0", - "@types/ws": "^8.5.4", - "discord-api-types": "^0.37.35", - "fast-deep-equal": "^3.1.3", - "lodash.snakecase": "^4.1.1", - "tslib": "^2.5.0", - "undici": "^5.20.0", - "ws": "^8.12.1" - }, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/dotenv": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", - "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", - "engines": { - "node": ">=12" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/file-type": { - "version": "18.2.1", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-18.2.1.tgz", - "integrity": "sha512-Yw5MtnMv7vgD2/6Bjmmuegc8bQEVA9GmAyaR18bMYWKqsWDG9wgYZ1j4I6gNMF5Y5JBDcUcjRQqNQx7Y8uotcg==", - "dependencies": { - "readable-web-to-node-stream": "^3.0.2", - "strtok3": "^7.0.0", - "token-types": "^5.0.1" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sindresorhus/file-type?sponsor=1" - } - }, - "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" - }, - "node_modules/kareem": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz", - "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lodash.snakecase": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", - "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" - }, - "node_modules/memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", - "optional": true - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mongodb": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.1.0.tgz", - "integrity": "sha512-qgKb7y+EI90y4weY3z5+lIgm8wmexbonz0GalHkSElQXVKtRuwqXuhXKccyvIjXCJVy9qPV82zsinY0W1FBnJw==", - "dependencies": { - "bson": "^5.0.1", - "mongodb-connection-string-url": "^2.6.0", - "socks": "^2.7.1" - }, - "engines": { - "node": ">=14.20.1" - }, - "optionalDependencies": { - "saslprep": "^1.0.3" - }, - "peerDependencies": { - "@aws-sdk/credential-providers": "^3.201.0", - "mongodb-client-encryption": "^2.3.0", - "snappy": "^7.2.2" - }, - "peerDependenciesMeta": { - "@aws-sdk/credential-providers": { - "optional": true - }, - "mongodb-client-encryption": { - "optional": true - }, - "snappy": { - "optional": true - } - } - }, - "node_modules/mongodb-connection-string-url": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz", - "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==", - "dependencies": { - "@types/whatwg-url": "^8.2.1", - "whatwg-url": "^11.0.0" - } - }, - "node_modules/mongoose": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.0.1.tgz", - "integrity": "sha512-fxm2bPRG457Hb8RLwN8cMCokK8HNem/7g+qp5SrHC7Pt4Z4jqn1+/3cuc8W7uqehKDWEtpirggI7uw08x2ZIjQ==", - "dependencies": { - "bson": "^5.0.1", - "kareem": "2.5.1", - "mongodb": "5.1.0", - "mpath": "0.9.0", - "mquery": "5.0.0", - "ms": "2.1.3", - "sift": "16.0.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mongoose" - } - }, - "node_modules/mpath": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", - "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", - "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", - "dependencies": { - "debug": "4.x" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/peek-readable": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", - "integrity": "sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A==", - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, - "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "engines": { - "node": ">=6" - } - }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/readable-web-to-node-stream": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", - "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", - "dependencies": { - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/saslprep": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", - "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", - "optional": true, - "dependencies": { - "sparse-bitfield": "^3.0.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sift": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz", - "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ==" - }, - "node_modules/smart-buffer": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", - "dependencies": { - "ip": "^2.0.0", - "smart-buffer": "^4.2.0" - }, - "engines": { - "node": ">= 10.13.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", - "optional": true, - "dependencies": { - "memory-pager": "^1.0.2" - } - }, - "node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/strtok3": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", - "integrity": "sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ==", - "dependencies": { - "@tokenizer/token": "^0.3.0", - "peek-readable": "^5.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/token-types": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", - "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", - "dependencies": { - "@tokenizer/token": "^0.3.0", - "ieee754": "^1.2.1" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", - "dependencies": { - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/ts-mixer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.3.tgz", - "integrity": "sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ==" - }, - "node_modules/tslib": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", - "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" - }, - "node_modules/undici": { - "version": "5.21.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.21.0.tgz", - "integrity": "sha512-HOjK8l6a57b2ZGXOcUsI5NLfoTrfmbOl90ixJDl0AEFG4wgHNDQxtZy15/ZQp7HhjkpaGlp/eneMgtsu1dIlUA==", - "dependencies": { - "busboy": "^1.6.0" - }, - "engines": { - "node": ">=12.18" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, - "node_modules/webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", - "engines": { - "node": ">=12" - } - }, - "node_modules/whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", - "dependencies": { - "tr46": "^3.0.0", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } + "name": "illegitimate-bot", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "illegitimate-bot", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "axios": "^1.3.4", + "discord.js": "^14.8.0", + "dotenv": "^16.0.3", + "mongoose": "^7.0.1" + } + }, + "node_modules/@discordjs/builders": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.5.0.tgz", + "integrity": "sha512-7XxT78mnNBPigHn2y6KAXkicxIBFtZREGWaRZ249EC1l6gBUEP8IyVY5JTciIjJArxkF+tg675aZvsTNTKBpmA==", + "dependencies": { + "@discordjs/formatters": "^0.2.0", + "@discordjs/util": "^0.2.0", + "@sapphire/shapeshift": "^3.8.1", + "discord-api-types": "^0.37.35", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.3", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@discordjs/collection": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.4.0.tgz", + "integrity": "sha512-hiOJyk2CPFf1+FL3a4VKCuu1f448LlROVuu8nLz1+jCOAPokUcdFAV+l4pd3B3h6uJlJQSASoZzrdyNdjdtfzQ==", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@discordjs/formatters": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.2.0.tgz", + "integrity": "sha512-vn4oMSXuMZUm8ITqVOtvE7/fMMISj4cI5oLsR09PEQXHKeKDAMLltG/DWeeIs7Idfy6V8Fk3rn1e69h7NfzuNA==", + "dependencies": { + "discord-api-types": "^0.37.35" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@discordjs/rest": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.6.0.tgz", + "integrity": "sha512-HGvqNCZ5Z5j0tQHjmT1lFvE5ETO4hvomJ1r0cbnpC1zM23XhCpZ9wgTCiEmaxKz05cyf2CI9p39+9LL+6Yz1bA==", + "dependencies": { + "@discordjs/collection": "^1.4.0", + "@discordjs/util": "^0.2.0", + "@sapphire/async-queue": "^1.5.0", + "@sapphire/snowflake": "^3.4.0", + "discord-api-types": "^0.37.35", + "file-type": "^18.2.1", + "tslib": "^2.5.0", + "undici": "^5.20.0" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@discordjs/util": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-0.2.0.tgz", + "integrity": "sha512-/8qNbebFzLWKOOg+UV+RB8itp4SmU5jw0tBUD3ifElW6rYNOj1Ku5JaSW7lLl/WgjjxF01l/1uQPCzkwr110vg==", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@sapphire/async-queue": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz", + "integrity": "sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA==", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@sapphire/shapeshift": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.8.1.tgz", + "integrity": "sha512-xG1oXXBhCjPKbxrRTlox9ddaZTvVpOhYLmKmApD/vIWOV1xEYXnpoFs68zHIZBGbqztq6FrUPNPerIrO1Hqeaw==", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@sapphire/snowflake": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.4.0.tgz", + "integrity": "sha512-zZxymtVO6zeXVMPds+6d7gv/OfnCc25M1Z+7ZLB0oPmeMTPeRWVPQSS16oDJy5ZsyCOLj7M6mbZml5gWXcVRNw==", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, + "node_modules/@types/node": { + "version": "18.15.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.0.tgz", + "integrity": "sha512-z6nr0TTEOBGkzLGmbypWOGnpSpSIBorEhC4L+4HeQ2iezKCi4f77kyslRwvHeNitymGQ+oFyIWGP96l/DPSV9w==" + }, + "node_modules/@types/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog==" + }, + "node_modules/@types/whatwg-url": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", + "dependencies": { + "@types/node": "*", + "@types/webidl-conversions": "*" + } + }, + "node_modules/@types/ws": { + "version": "8.5.4", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz", + "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz", + "integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/bson": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.0.1.tgz", + "integrity": "sha512-y09gBGusgHtinMon/GVbv1J6FrXhnr/+6hqLlSmEFzkz6PodqF6TxjyvfvY3AfO+oG1mgUtbC86xSbOlwvM62Q==", + "engines": { + "node": ">=14.20.1" + } + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } + } + }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/discord-api-types": { + "version": "0.37.37", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.37.tgz", + "integrity": "sha512-LDMBKzl/zbvHO/yCzno5hevuA6lFIXJwdKSJZQrB+1ToDpFfN9thK+xxgZNR4aVkI7GHRDja0p4Sl2oYVPnHYg==" + }, + "node_modules/discord.js": { + "version": "14.8.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.8.0.tgz", + "integrity": "sha512-UOxYtc/YnV7jAJ2gISluJyYeBw4e+j8gWn+IoqG8unaHAVuvZ13DdYN0M1f9fbUgUvSarV798inIrYFtDNDjwQ==", + "dependencies": { + "@discordjs/builders": "^1.5.0", + "@discordjs/collection": "^1.4.0", + "@discordjs/formatters": "^0.2.0", + "@discordjs/rest": "^1.6.0", + "@discordjs/util": "^0.2.0", + "@sapphire/snowflake": "^3.4.0", + "@types/ws": "^8.5.4", + "discord-api-types": "^0.37.35", + "fast-deep-equal": "^3.1.3", + "lodash.snakecase": "^4.1.1", + "tslib": "^2.5.0", + "undici": "^5.20.0", + "ws": "^8.12.1" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/file-type": { + "version": "18.2.1", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-18.2.1.tgz", + "integrity": "sha512-Yw5MtnMv7vgD2/6Bjmmuegc8bQEVA9GmAyaR18bMYWKqsWDG9wgYZ1j4I6gNMF5Y5JBDcUcjRQqNQx7Y8uotcg==", + "dependencies": { + "readable-web-to-node-stream": "^3.0.2", + "strtok3": "^7.0.0", + "token-types": "^5.0.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + }, + "node_modules/kareem": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz", + "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" + }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "optional": true + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mongodb": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.1.0.tgz", + "integrity": "sha512-qgKb7y+EI90y4weY3z5+lIgm8wmexbonz0GalHkSElQXVKtRuwqXuhXKccyvIjXCJVy9qPV82zsinY0W1FBnJw==", + "dependencies": { + "bson": "^5.0.1", + "mongodb-connection-string-url": "^2.6.0", + "socks": "^2.7.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "optionalDependencies": { + "saslprep": "^1.0.3" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.201.0", + "mongodb-client-encryption": "^2.3.0", + "snappy": "^7.2.2" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + } + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz", + "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==", + "dependencies": { + "@types/whatwg-url": "^8.2.1", + "whatwg-url": "^11.0.0" + } + }, + "node_modules/mongoose": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.0.1.tgz", + "integrity": "sha512-fxm2bPRG457Hb8RLwN8cMCokK8HNem/7g+qp5SrHC7Pt4Z4jqn1+/3cuc8W7uqehKDWEtpirggI7uw08x2ZIjQ==", + "dependencies": { + "bson": "^5.0.1", + "kareem": "2.5.1", + "mongodb": "5.1.0", + "mpath": "0.9.0", + "mquery": "5.0.0", + "ms": "2.1.3", + "sift": "16.0.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mongoose" + } + }, + "node_modules/mpath": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", + "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mquery": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", + "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", + "dependencies": { + "debug": "4.x" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/peek-readable": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", + "integrity": "sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A==", + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "dependencies": { + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/saslprep": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", + "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", + "optional": true, + "dependencies": { + "sparse-bitfield": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sift": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz", + "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ==" + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", + "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "optional": true, + "dependencies": { + "memory-pager": "^1.0.2" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strtok3": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", + "integrity": "sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^5.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/token-types": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", + "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ts-mixer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.3.tgz", + "integrity": "sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ==" + }, + "node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "node_modules/undici": { + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.21.0.tgz", + "integrity": "sha512-HOjK8l6a57b2ZGXOcUsI5NLfoTrfmbOl90ixJDl0AEFG4wgHNDQxtZy15/ZQp7HhjkpaGlp/eneMgtsu1dIlUA==", + "dependencies": { + "busboy": "^1.6.0" + }, + "engines": { + "node": ">=12.18" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } } + } } diff --git a/package.json b/package.json index cacd078..ec2c080 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { - "name": "illegitimate-bot", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "prod:build": "node scripts/deploy-commands.js --prod", - "dev:build": "node scripts/deploy-commands.js --dev" - }, - "author": "Taken", - "license": "ISC", - "dependencies": { - "axios": "^1.3.4", - "discord.js": "^14.8.0", - "dotenv": "^16.0.3", - "mongoose": "^7.0.1" - } + "name": "illegitimate-bot", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "prod:build": "node scripts/deploy-commands.js --prod", + "dev:build": "node scripts/deploy-commands.js --dev" + }, + "author": "Taken", + "license": "ISC", + "dependencies": { + "axios": "^1.3.4", + "discord.js": "^14.8.0", + "dotenv": "^16.0.3", + "mongoose": "^7.0.1" + } } diff --git a/schemas/guildAppSchema.js b/schemas/guildAppSchema.js index 3532fc3..7069cc4 100644 --- a/schemas/guildAppSchema.js +++ b/schemas/guildAppSchema.js @@ -1,4 +1,4 @@ -const { Schema, model } = require("mongoose"); +const { Schema, model } = require('mongoose'); const guildAppSchema = new Schema({ _id: Schema.Types.ObjectId, @@ -6,4 +6,4 @@ const guildAppSchema = new Schema({ uuid: { type: String, required: true }, }); -module.exports = model("guildapp", guildAppSchema, "guildapp"); +module.exports = model('guildapp', guildAppSchema, 'guildapp'); \ No newline at end of file diff --git a/schemas/staffAppSchema.js b/schemas/staffAppSchema.js index 7162505..94204a6 100644 --- a/schemas/staffAppSchema.js +++ b/schemas/staffAppSchema.js @@ -1,4 +1,4 @@ -const { Schema, model } = require("mongoose"); +const { Schema, model } = require('mongoose'); const staffAppSchema = new Schema({ _id: Schema.Types.ObjectId, @@ -6,4 +6,4 @@ const staffAppSchema = new Schema({ uuid: { type: String, required: true }, }); -module.exports = model("staffapp", staffAppSchema, "staffapp"); +module.exports = model('staffapp', staffAppSchema, 'staffapp'); \ No newline at end of file diff --git a/schemas/verifySchema.js b/schemas/verifySchema.js index 428b363..995c5eb 100644 --- a/schemas/verifySchema.js +++ b/schemas/verifySchema.js @@ -1,4 +1,4 @@ -const { Schema, model } = require("mongoose"); +const { Schema, model } = require('mongoose'); const verifySchema = new Schema({ _id: Schema.Types.ObjectId, @@ -6,4 +6,4 @@ const verifySchema = new Schema({ uuid: { type: String, required: true }, }); -module.exports = model("verify", verifySchema, "verify"); +module.exports = model('verify', verifySchema, 'verify'); \ No newline at end of file diff --git a/schemas/waitinglistSchema.js b/schemas/waitinglistSchema.js index 6feeb76..5d80662 100644 --- a/schemas/waitinglistSchema.js +++ b/schemas/waitinglistSchema.js @@ -1,11 +1,11 @@ -const { Schema, model } = require("mongoose"); +const { Schema, model } = require('mongoose'); const waitinglistSchema = new Schema({ _id: Schema.Types.ObjectId, userID: { type: String, required: true }, uuid: { type: String, required: true }, IGN: { type: String, required: true }, - timestamp: { type: String, required: true }, + timestamp: { type: String, required: true } }); -module.exports = model("waitinglist", waitinglistSchema, "waitinglist"); +module.exports = model('waitinglist', waitinglistSchema, 'waitinglist'); diff --git a/scripts/deploy-commands.js b/scripts/deploy-commands.js index d6aedb5..cbfbc30 100644 --- a/scripts/deploy-commands.js +++ b/scripts/deploy-commands.js @@ -1,76 +1,87 @@ -const { REST, Routes } = require("discord.js"); -const env = require("dotenv").config(); +const { REST, Routes } = require('discord.js'); +const env = require('dotenv').config(); const token = process.env.PRODTOKEN; const clientId = process.env.CLIENTID; const guildId = process.env.GUILDID; -const fs = require("node:fs"); +const fs = require('node:fs'); const args = process.argv.slice(2); const arg = args[0]; if (!arg) { - console.log("Please specify a command to run!"); -} else if (arg === "--prod") { - const commands = []; - // Grab all the command files from the commands directory you created earlier - const commandFiles = fs.readdirSync("./commands").filter((file) => file.endsWith(".js")); - const contentMenuCommands = fs.readdirSync("./commands-contextmenu").filter((file) => file.endsWith(".js")); - - // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment - for (const file of commandFiles) { - const command = require(`../commands/${file}`); - commands.push(command.data.toJSON()); - } - - for (const file of contentMenuCommands) { - const command = require(`../commands-contextmenu/${file}`); - commands.push(command.data.toJSON()); - } - - // Construct and prepare an instance of the REST module - const rest = new REST({ version: "10" }).setToken(token); - - // and deploy your commands! - (async () => { - try { - console.log(`Started refreshing ${commands.length} application (/) commands.`); - - // The put method is used to fully refresh all commands in the guild with the current set - const data = await rest.put(Routes.applicationCommands(clientId), { body: commands }); - - console.log(`Successfully reloaded ${data.length} application (/) commands.`); - } catch (error) { - // And of course, make sure you catch and log any errors! - console.error(error); - } - })(); -} else if (arg === "--dev") { - const commands = []; - // Grab all the command files from the commands directory you created earlier - const commandFiles = fs.readdirSync("./commands-testing").filter((file) => file.endsWith(".js")); - - // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment - for (const file of commandFiles) { - const command = require(`../commands-testing/${file}`); - commands.push(command.data.toJSON()); - } - - // Construct and prepare an instance of the REST module - const rest = new REST({ version: "10" }).setToken(token); - - // and deploy your commands! - (async () => { - try { - console.log(`Started refreshing ${commands.length} application (/) commands.`); - - // The put method is used to fully refresh all commands in the guild with the current set - const data = await rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands }); - - console.log(`Successfully reloaded ${data.length} application (/) commands.`); - } catch (error) { - // And of course, make sure you catch and log any errors! - console.error(error); - } - })(); -} else if (arg && arg !== "--prod" && arg !== "--dev") { - console.log("Invalid argument!"); + console.log('Please specify a command to run!'); +} +else if (arg === '--prod') { + const commands = []; + // Grab all the command files from the commands directory you created earlier + const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); + const contentMenuCommands = fs.readdirSync('./commands-contextmenu').filter(file => file.endsWith('.js')); + + // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment + for (const file of commandFiles) { + const command = require(`../commands/${file}`); + commands.push(command.data.toJSON()); + } + + for (const file of contentMenuCommands) { + const command = require(`../commands-contextmenu/${file}`); + commands.push(command.data.toJSON()); + } + + // Construct and prepare an instance of the REST module + const rest = new REST({ version: '10' }).setToken(token); + + + // and deploy your commands! + (async () => { + try { + console.log(`Started refreshing ${commands.length} application (/) commands.`); + + // The put method is used to fully refresh all commands in the guild with the current set + const data = await rest.put( + Routes.applicationCommands(clientId), + { body: commands }, + ); + + console.log(`Successfully reloaded ${data.length} application (/) commands.`); + } catch (error) { + // And of course, make sure you catch and log any errors! + console.error(error); + } + })(); +} +else if (arg === '--dev') { + const commands = []; + // Grab all the command files from the commands directory you created earlier + const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js')); + + // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment + for (const file of commandFiles) { + const command = require(`../commands-testing/${file}`); + commands.push(command.data.toJSON()); + } + + // Construct and prepare an instance of the REST module + const rest = new REST({ version: '10' }).setToken(token); + + + // and deploy your commands! + (async () => { + try { + console.log(`Started refreshing ${commands.length} application (/) commands.`); + + // The put method is used to fully refresh all commands in the guild with the current set + const data = await rest.put( + Routes.applicationGuildCommands(clientId, guildId), + { body: commands }, + ); + + console.log(`Successfully reloaded ${data.length} application (/) commands.`); + } catch (error) { + // And of course, make sure you catch and log any errors! + console.error(error); + } + })(); +} +else if (arg && arg !== '--prod' && arg !== '--dev') { + console.log('Invalid argument!'); } diff --git a/scripts/dev-deploy.js b/scripts/dev-deploy.js index 5676f18..1a19b27 100644 --- a/scripts/dev-deploy.js +++ b/scripts/dev-deploy.js @@ -1,5 +1,5 @@ -const { REST, Routes } = require("discord.js"); -const env = require("dotenv").config(); +const { REST, Routes } = require('discord.js'); +const env = require('dotenv').config(); const token = process.env.TOKEN; const clientId = process.env.DEVID; const guildId = process.env.GUILDID; @@ -8,28 +8,34 @@ const commands = []; // Grab all the command files from the commands directory you created earlier // const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js')); -const commandFiles = ["./commands/config.js"]; +const commandFiles = [ + './commands/config.js', +] // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment for (const file of commandFiles) { - const command = require(`${file}`); - commands.push(command.data.toJSON()); + const command = require(`${file}`); + commands.push(command.data.toJSON()); } // Construct and prepare an instance of the REST module -const rest = new REST({ version: "10" }).setToken(token); +const rest = new REST({ version: '10' }).setToken(token); + // and deploy your commands! -(async () => { - try { - console.log(`Started refreshing ${commands.length} application (/) commands.`); + (async () => { + try { + console.log(`Started refreshing ${commands.length} application (/) commands.`); - // The put method is used to fully refresh all commands in the guild with the current set - const data = await rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands }); + // The put method is used to fully refresh all commands in the guild with the current set + const data = await rest.put( + Routes.applicationGuildCommands(clientId, guildId), + { body: commands }, + ); - console.log(`Successfully reloaded ${data.length} application (/) commands.`); - } catch (error) { - // And of course, make sure you catch and log any errors! - console.error(error); - } -})(); + console.log(`Successfully reloaded ${data.length} application (/) commands.`); + } catch (error) { + // And of course, make sure you catch and log any errors! + console.error(error); + } + })(); \ No newline at end of file diff --git a/utils/functions.js b/utils/functions.js index a4bdca3..3bdf434 100644 --- a/utils/functions.js +++ b/utils/functions.js @@ -1,51 +1,52 @@ /* ---------- bedwars level ---------- */ -function getExpForLevel(level) { - if (level == 0) return 0; +function getExpForLevel(level){ + if(level == 0) return 0; - var respectedLevel = getLevelRespectingPrestige(level); - if (respectedLevel > EASY_LEVELS) { - return 5000; - } + var respectedLevel = getLevelRespectingPrestige(level); + if(respectedLevel > EASY_LEVELS){ + return 5000; + } - switch (respectedLevel) { - case 1: - return 500; - case 2: - return 1000; - case 3: - return 2000; - case 4: - return 3500; - } - return 5000; + switch(respectedLevel){ + case 1: + return 500; + case 2: + return 1000; + case 3: + return 2000; + case 4: + return 3500; + } + return 5000; } -function getLevelRespectingPrestige(level) { - if (level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE) { - return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE; - } else { - return level % LEVELS_PER_PRESTIGE; - } +function getLevelRespectingPrestige(level){ + if(level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE){ + return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE; + } + else { + return level % LEVELS_PER_PRESTIGE; + } } const EASY_LEVELS = 4; const EASY_LEVELS_XP = 7000; const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP; const LEVELS_PER_PRESTIGE = 100; const HIGHEST_PRESTIGE = 50; -function getLevelForExp(exp) { - var prestiges = Math.floor(exp / XP_PER_PRESTIGE); - var level = prestiges * LEVELS_PER_PRESTIGE; - var expWithoutPrestiges = exp - prestiges * XP_PER_PRESTIGE; +function getLevelForExp(exp){ + var prestiges = Math.floor(exp / XP_PER_PRESTIGE); + var level = prestiges * LEVELS_PER_PRESTIGE; + var expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE); - for (let i = 1; i <= EASY_LEVELS; ++i) { - var expForEasyLevel = getExpForLevel(i); - if (expWithoutPrestiges < expForEasyLevel) { - break; - } - level++; - expWithoutPrestiges -= expForEasyLevel; - } - return level + expWithoutPrestiges / 5000; + for(let i = 1; i <= EASY_LEVELS; ++i){ + var expForEasyLevel = getExpForLevel(i); + if(expWithoutPrestiges < expForEasyLevel){ + break; + } + level++; + expWithoutPrestiges -= expForEasyLevel; + } + return level + expWithoutPrestiges / 5000 } // hypixel const BASE = 10000; @@ -58,51 +59,51 @@ const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX; const GROWTH_DIVIDES_2 = 2 / GROWTH; function getLevel(exp) { - return exp <= 1 ? 1 : Math.floor(1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp)); + return exp <= 1 ? 1 : Math.floor(1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp)); } function getExactLevel(exp) { - return getLevel(exp) + getPercentageToNextLevel(exp); + return getLevel(exp) + getPercentageToNextLevel(exp); } function getExpFromLevelToNext(level) { - return level < 1 ? BASE : GROWTH * (level - 1) + BASE; + return level < 1 ? BASE : GROWTH * (level - 1) + BASE; } function getTotalExpToLevel(level) { - const lv = Math.floor(level); - const x0 = getTotalExpToFullLevel(lv); - if (level === lv) return x0; - return (getTotalExpToFullLevel(lv + 1) - x0) * (level % 1) + x0; + const lv = Math.floor(level); const + x0 = getTotalExpToFullLevel(lv); + if (level === lv) return x0; + return (getTotalExpToFullLevel(lv + 1) - x0) * (level % 1) + x0; } function getTotalExpToFullLevel(level) { - return (HALF_GROWTH * (level - 2) + BASE) * (level - 1); + return (HALF_GROWTH * (level - 2) + BASE) * (level - 1); } function getPercentageToNextLevel(exp) { - const lv = getLevel(exp); - const x0 = getTotalExpToLevel(lv); - return (exp - x0) / (getTotalExpToLevel(lv + 1) - x0); + const lv = getLevel(exp); + const x0 = getTotalExpToLevel(lv); + return (exp - x0) / (getTotalExpToLevel(lv + 1) - x0); } /* ---------- skywars level ---------- */ function skywarsLevel(xp) { - var xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000]; - let exactLevel = 0; - if (xp >= 15000) { - exactLevel = (xp - 15000) / 10000 + 12; - return exactLevel; - } else { - for (i = 0; i < xps.length; i++) { - if (xp < xps[i]) { - exactLevel = i + (xp - xps[i - 1]) / (xps[i] - xps[i - 1]); - return exactLevel; - } - } - } + var xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000]; + let exactLevel = 0 + if (xp >= 15000) { + exactLevel = (xp - 15000) / 10000 + 12; + return exactLevel; + } else { + for (i = 0; i < xps.length; i++) { + if (xp < xps[i]) { + exactLevel = i + (xp - xps[i-1]) / (xps[i] - xps[i-1]); + return exactLevel; + } + } + } } module.exports = { - getExactLevel, - skywarsLevel, - getLevelForExp, -}; + getExactLevel, + skywarsLevel, + getLevelForExp +} \ No newline at end of file