diff --git a/commands-contextmenu/congratsmessage.js b/commands-contextmenu/congratsmessage.js index 3091964..e585819 100644 --- a/commands-contextmenu/congratsmessage.js +++ b/commands-contextmenu/congratsmessage.js @@ -1,4 +1,4 @@ -const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention} = require('discord.js'); +const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention } = require('discord.js'); module.exports = { name: 'congratsmessage', @@ -22,7 +22,7 @@ module.exports = { const target = message.author; await message.reply({ - embeds:[{ + embeds: [{ title: 'Congratulations!', description: `GG to ${userMention(target.id)}!`, }] @@ -31,4 +31,4 @@ module.exports = { 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 9344417..fe30e05 100644 --- a/commands-contextmenu/resetnick.js +++ b/commands-contextmenu/resetnick.js @@ -31,4 +31,4 @@ module.exports = { return interaction.reply({ content: `Reset ${target.user.username}'s nickname.`, ephemeral: true }); } -}; \ No newline at end of file +}; diff --git a/commands/check.js b/commands/check.js index 090fe48..301f6aa 100644 --- a/commands/check.js +++ b/commands/check.js @@ -7,63 +7,63 @@ 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; - } + 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 userCheck = await fetch(mojang + ign); + const uuid = userCheck.data.id; - const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid - const stats = await fetch(player); + 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; - } + 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; + const rank2 = stats.data.player.newPackageRank; + const monthlyRank = stats.data.player.monthlyPackageRank; if (rank2 === 'VIP') { var rank = "[VIP] " @@ -77,128 +77,128 @@ module.exports = { var rank = "[MVP++] " } - const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid - const guildCheck = await fetch(guild); + 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 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 + "]" - } + 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."; - } + //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 (hsswstars < swstars) { - var swtitle = - " This player does not meet the SkyWars requirements."; - } else { - var swtitle = - " This player meets the SkyWars requirements."; - } + 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 (hsduelswins < duelswins || hsduelswlr < duelswlr) { - var duelstitle = - " This player does not meet the Duels requirements."; - } else { - var duelstitle = - " This player meets the Duels requirements."; - } + if (hsswstars < swstars) { + var swtitle = + " This player does not meet the SkyWars requirements."; + } else { + var swtitle = + " This player meets the SkyWars 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" + + 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() + + hsduelswlr.toFixed(2).toString() + " / " + duelswlr.toString() + "`\n" + "**➺ KDR:** `" + - hsduelskd.toFixed(2).toString() + "`" - } - ] - }] - }); - } + hsduelskd.toFixed(2).toString() + "`" + } + ] + }] + }); + } }; diff --git a/commands/config.js b/commands/config.js index d486b54..42e0911 100644 --- a/commands/config.js +++ b/commands/config.js @@ -2,218 +2,218 @@ const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilde 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) => - 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) => + data: new SlashCommandBuilder() + .setName("config") + .setDescription("Configure the bot.") + .addSubcommand((subcommand) => subcommand - .setName("sendverfiymessage") - .setDescription("Send the verfiy message to a channel.") - .addChannelOption((option) => + .setName("sendguildapplication") + .setDescription("Send the application message to a channel.") + .addChannelOption((option) => option - .setName("channel") - .setDescription("The channel to send the verfiy message to.") - .setRequired(true))) - .addSubcommand((subcommand) => + .setName("channel") + .setDescription("The channel to send the application to.") + .setRequired(true)) + ) + .addSubcommand((subcommand) => subcommand - .setName("sendwaitinglistmessage") - .setDescription("Send the waiting list message to a channel.") - .addChannelOption((option) => + .setName("sendstaffapplication") + .setDescription("Send the application 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 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), - 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"); + 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 }); - } + 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 === "sendstaffapplication") { - const channel = interaction.options.getChannel("channel"); + if (subcommand === "sendstaffapplication") { + const channel = interaction.options.getChannel("channel"); - 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: "✅" })) - ] - }); + 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: "✅" })) + ] + }); - await interaction.reply({ content: "Message sent", ephemeral: true }); - } + await interaction.reply({ content: "Message sent", ephemeral: true }); + } - if (subcommand === "sendinactivityapplication") { - const channel = interaction.options.getChannel("channel"); + if (subcommand === "sendinactivityapplication") { + const channel = interaction.options.getChannel("channel"); - 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 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 }); - } + 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 bfd2659..080ba30 100644 --- a/commands/devel.js +++ b/commands/devel.js @@ -104,4 +104,4 @@ module.exports = { } } -}; \ No newline at end of file +}; diff --git a/commands/forceunverify.js b/commands/forceunverify.js index a5b3e99..235fcb3 100644 --- a/commands/forceunverify.js +++ b/commands/forceunverify.js @@ -3,7 +3,7 @@ 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 removeThese = [gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember] module.exports = { name: "forceunverify", @@ -38,7 +38,7 @@ module.exports = { } await verify.findOneAndDelete({ userID: member1.id }) - + await member.roles.remove(removeThese) await interaction.reply({ diff --git a/commands/forceupdate.js b/commands/forceupdate.js index a072c2e..54eba86 100644 --- a/commands/forceupdate.js +++ b/commands/forceupdate.js @@ -15,7 +15,7 @@ module.exports = { data: new SlashCommandBuilder() .setName('forceupdate') .setDescription('Force update the user') - .addUserOption(option => + .addUserOption(option => option .setName('user') .setDescription('The user to force update') @@ -53,236 +53,236 @@ module.exports = { } const mojangAPI = "https://api.mojang.com/user/profile/" - const guildlAPI = "https://api.hypixel.net/guild" + 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)") - } + 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 - } + 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 (responseGuildID === hypixelGuildID) { + if (responseGuildID === hypixelGuildID) { - const GuildMembers = guildCheck.data.guild.members; - const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; + const GuildMembers = guildCheck.data.guild.members; + const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; - if (guildRank === 'Guild Master') { + if (guildRank === 'Guild Master') { - 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(gm, "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 `Guild Master`", - 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 `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 === 'Manager') { + 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(manager, "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 }) - } - }] - }) - } + 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') { + if (guildRank === 'Moderator') { - 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(moderator, "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(moderator, "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 `Moderator`", + color: embedColor, + thumbnail: { + url: head + }, + footer: { + text: interaction.guild.name + " | Developed by @Taken#0002", + icon_url: interaction.guild.iconURL({ dynamic: true }) + } + }] + }) - } + } - if (guildRank === 'Beast') { + if (guildRank === 'Beast') { - 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(beast, "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 `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') { + if (guildRank === 'Elite') { - 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(elite, "User was force updated.") - await roleManage.add(defaultMember, "User was force updated.") + 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 - } + 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') { + if (guildRank === 'Member') { - 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(member, "User was force updated.") - await roleManage.add(defaultMember, "User was force updated.") + 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 - } + 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') { + if (guildRank === 'Trial Member') { - 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(trialmember, "User was force updated.") - await roleManage.add(defaultMember, "User was force updated.") + 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 - } - } + 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 6ec021d..1d778b9 100644 --- a/commands/forceverify.js +++ b/commands/forceverify.js @@ -4,7 +4,7 @@ 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 { mongoose } = require('mongoose'); const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json'); @@ -16,7 +16,7 @@ module.exports = { data: new SlashCommandBuilder() .setName('forceverify') .setDescription('Force verify a user.') - .addUserOption(option => + .addUserOption(option => option .setName('user') .setDescription('The user to force verify.')) @@ -26,7 +26,7 @@ module.exports = { .setDescription('The user\'s in-game name.')) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), - + async execute(interaction) { await interaction.deferReply(); @@ -35,7 +35,7 @@ module.exports = { const user = interaction.guild.members.cache.get(user1.id); 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/" @@ -90,7 +90,7 @@ module.exports = { const hypixelCheck = await fetch(player); - if (!hypixelCheck.data.player) { + if (!hypixelCheck.data.player) { interaction.editReply({ embeds: [{ description: " That player hasn't played Hypixel before.", @@ -98,7 +98,7 @@ module.exports = { }] }); return; - } + } const guildCheck = await fetch(guild) @@ -109,50 +109,50 @@ module.exports = { } 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, @@ -177,4 +177,4 @@ module.exports = { }); } -}; \ No newline at end of file +}; diff --git a/commands/help.js b/commands/help.js index 09dcdf6..9c241ce 100644 --- a/commands/help.js +++ b/commands/help.js @@ -5,7 +5,7 @@ module.exports = { name: 'help', description: 'Help command', type: 'slash', - + data: new SlashCommandBuilder() .setName('help') .setDescription('Help command') @@ -47,8 +47,8 @@ module.exports = { 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 679e052..a37c6c7 100644 --- a/commands/reqs.js +++ b/commands/reqs.js @@ -27,9 +27,9 @@ module.exports = { fields: [ { name: '**Bedwars**', - value: '**Stars:** `' + bwstars.toString() + - '`\n**Wins:** `' + bwwins.toString() + - '`\n**FKDR:** `' + bwfkdr.toString() + '`' + value: '**Stars:** `' + bwstars.toString() + + '`\n**Wins:** `' + bwwins.toString() + + '`\n**FKDR:** `' + bwfkdr.toString() + '`' }, { name: '**Skywars**', @@ -38,7 +38,7 @@ module.exports = { { name: '**Duels**', value: '**Wins:** `' + duelswins.toString() + - '`\n**WLR:** `' + duelswlr.toString() + '`' + '`\n**WLR:** `' + duelswlr.toString() + '`' } ], footer: { diff --git a/commands/send.js b/commands/send.js index 3a44581..f94b76d 100644 --- a/commands/send.js +++ b/commands/send.js @@ -9,17 +9,17 @@ module.exports = { data: new SlashCommandBuilder() .setName('send') .setDescription('Send a message to a channel.') - .addStringOption(option => + .addStringOption(option => option .setName('message') .setDescription('The message to send.')) - .addChannelOption(option => + .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 }); @@ -54,4 +54,4 @@ module.exports = { ] }); } -}; \ No newline at end of file +}; diff --git a/commands/setnick.js b/commands/setnick.js index 4a8a74f..01177fc 100644 --- a/commands/setnick.js +++ b/commands/setnick.js @@ -8,7 +8,7 @@ module.exports = { data: new SlashCommandBuilder() .setName('setnick') .setDescription('Set your nickname') - .addUserOption(option => + .addUserOption(option => option .setName('user') .setDescription('The user to set the nickname for') @@ -36,4 +36,4 @@ module.exports = { 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 0a8e5cd..cfd3900 100644 --- a/commands/slowmode.js +++ b/commands/slowmode.js @@ -56,4 +56,4 @@ module.exports = { await channel.setRateLimitPerUser(seconds) } -} \ No newline at end of file +} diff --git a/commands/update.js b/commands/update.js index 3012cf1..45faac2 100644 --- a/commands/update.js +++ b/commands/update.js @@ -13,9 +13,9 @@ module.exports = { type: 'slash', data: new SlashCommandBuilder() - .setName('update') - .setDescription('Update your guild rank.') - .setDMPermission(false), + .setName('update') + .setDescription('Update your guild rank.') + .setDMPermission(false), async execute(interaction) { @@ -82,200 +82,200 @@ module.exports = { return } - if (guildID === hypixelGuildID) { + if (guildID === hypixelGuildID) { - const GuildMembers = guildCheck.data.guild.members; - const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; + const GuildMembers = guildCheck.data.guild.members; + const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; - if (guildRank === 'Guild Master') { + if (guildRank === 'Guild Master') { - 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(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(gm, "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 `Guild Master`", - 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 === 'Manager') { + if (guildRank === 'Manager') { - 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(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 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 `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') { + if (guildRank === 'Moderator') { - 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(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 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 `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: "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 }) + } + }] + }) - } + } - if (guildRank === 'Beast') { + if (guildRank === 'Beast') { - 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(beast, "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 `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: "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') { + 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(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 - } + 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') { + if (guildRank === '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(member, "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(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 - } + 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') { + 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(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 - } - } + 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 0abb345..3bdfbad 100644 --- a/commands/verify.js +++ b/commands/verify.js @@ -98,7 +98,7 @@ module.exports = { return; } - const linkedDiscord = stats.data.player.socialMedia.links.DISCORD + const linkedDiscord = stats.data.player.socialMedia.links.DISCORD if (linkedDiscord !== username) { interaction.editReply({ @@ -122,48 +122,48 @@ module.exports = { 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"); @@ -192,4 +192,4 @@ module.exports = { ] }); } -}; \ No newline at end of file +}; diff --git a/commands/whois.js b/commands/whois.js index e730a61..5c86f7b 100644 --- a/commands/whois.js +++ b/commands/whois.js @@ -55,4 +55,4 @@ module.exports = { }) } -}; \ No newline at end of file +}; diff --git a/events/buttons/checkstats.js b/events/buttons/checkstats.js index 5263c1a..e3fefdd 100644 --- a/events/buttons/checkstats.js +++ b/events/buttons/checkstats.js @@ -130,8 +130,8 @@ module.exports = { embeds: [{ title: rank + stats.data.player.displayname + guildTag, description: "**Network Level:** `" + - level.toFixed(2).toString() + "`\n" + - "**Current Guild:** `" + guildName + "`", + level.toFixed(2).toString() + "`\n" + + "**Current Guild:** `" + guildName + "`", color: embedColor, thumbnail: { url: head }, footer: { @@ -142,36 +142,36 @@ module.exports = { { name: bwtitle, value: "**➺ Stars:** `" + - hsbwstars.toFixed(2).toString() + " / " + - bwstars.toString() + "`\n" + - "**➺ FKDR:** `" + - hsbwfkdr.toFixed(2).toString() + - " / " + bwfkdr.toString() + "`\n" + - "**➺ Wins:** `" + - hsbwwins.toString() + " / " + - bwwins.toString() + "`" + 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() + "`" + "**➺ 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() + "`" + 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 fb12e7f..264d3e0 100644 --- a/events/buttons/guilapply.js +++ b/events/buttons/guilapply.js @@ -23,9 +23,9 @@ module.exports = { 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') { - + await interaction.deferReply({ ephemeral: true }); if (userRoles.includes(guildRole)) { @@ -39,7 +39,7 @@ module.exports = { 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) @@ -54,11 +54,11 @@ module.exports = { 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.", + 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, }] }) @@ -67,7 +67,7 @@ module.exports = { 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({ @@ -84,17 +84,17 @@ module.exports = { return } if (input.first().content.toLowerCase() !== 'yes') { - await user.send({ embeds: [cancelled]} ); + await user.send({ embeds: [cancelled] }); return } // first question const question1 = await user.send({ embeds: [{ - title : "**Question 1**", + title: "**Question 1**", description: qu1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", color: embedColor, - footer:{ + footer: { text: "You have 5 minutes to respond to this message." } }] @@ -123,7 +123,7 @@ module.exports = { await user.send({ embeds: [{ description: "That is not a valid Minecraft username.\n" + - "Application cancelled.", + "Application cancelled.", color: embedColor }] }) @@ -142,10 +142,10 @@ module.exports = { // second question const question2 = await user.send({ embeds: [{ - title : "**Question 2**", + 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:{ + footer: { text: "You have 15 minutes to respond to this message." } }] @@ -181,10 +181,10 @@ module.exports = { // third question const question3 = await user.send({ embeds: [{ - title : "**Question 3**", + title: "**Question 3**", description: qu3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", color: embedColor, - footer:{ + footer: { text: "You have 15 minutes to respond to this message." } }] @@ -219,11 +219,11 @@ module.exports = { // 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 + "`", + 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:{ + footer: { text: "You have 15 minutes to respond to this message." } }] @@ -258,10 +258,10 @@ module.exports = { // fifth question const question5 = await user.send({ embeds: [{ - title : "**Question 5**", + title: "**Question 5**", description: qu5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", color: embedColor, - footer:{ + footer: { text: "You have 15 minutes to respond to this message." } }] @@ -292,14 +292,14 @@ module.exports = { return } const answer5_1 = answer5.first().content - + // sixth question const question6 = await user.send({ embeds: [{ - title : "**Question 6**", + title: "**Question 6**", description: qu6 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", color: embedColor, - footer:{ + footer: { text: "You have 15 minutes to respond to this message." } }] @@ -334,10 +334,10 @@ module.exports = { // seventh question const question7 = await user.send({ embeds: [{ - title : "**Question 7**", + title: "**Question 7**", description: qu7 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", color: embedColor, - footer:{ + footer: { text: "You have 15 minutes to respond to this message." } }] @@ -372,10 +372,10 @@ module.exports = { // eighth question const question8 = await user.send({ embeds: [{ - title : "**Question 8**", + 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:{ + footer: { text: "You have 15 minutes to respond to this message." } }] @@ -428,7 +428,7 @@ module.exports = { return } if (final.first().content.toLowerCase() !== 'yes') { - await user.send({ embeds: [cancelled]} ); + await user.send({ embeds: [cancelled] }); return } @@ -452,7 +452,7 @@ module.exports = { const channel = guild.channels.cache.get(applicationsChannel); await channel.send({ - embeds: [{ + embeds: [{ title: user.username + "#" + user.discriminator + " - Guild Application", color: embedColor, thumbnail: { @@ -517,4 +517,4 @@ module.exports = { } } -} \ No newline at end of file +} diff --git a/events/buttons/guildapplicationaccept.js b/events/buttons/guildapplicationaccept.js index c1a7a93..dcc30af 100644 --- a/events/buttons/guildapplicationaccept.js +++ b/events/buttons/guildapplicationaccept.js @@ -52,7 +52,7 @@ module.exports = { await applicant.send({ embeds: [{ - description: `Your application for the Illegitimate guild has been accepted.`, + description: `Your application for the Illegitimate guild has been accepted.`, color: embedColor }] }); @@ -76,7 +76,7 @@ module.exports = { await interaction.editReply({ - embeds: [{ + embeds: [{ title: applicantUsername + " - Guild Application", description: "Application has been accepted by <@" + user.id + ">.", color: embedColor, @@ -90,4 +90,4 @@ module.exports = { }] }); } -}; \ No newline at end of file +}; diff --git a/events/buttons/guildapplicationdeny.js b/events/buttons/guildapplicationdeny.js index d90c16d..da9f174 100644 --- a/events/buttons/guildapplicationdeny.js +++ b/events/buttons/guildapplicationdeny.js @@ -29,4 +29,4 @@ module.exports = { ) await interaction.showModal(modal); } -}; \ No newline at end of file +}; diff --git a/events/buttons/guildinactivitylog.js b/events/buttons/guildinactivitylog.js index ba29561..87b1b00 100644 --- a/events/buttons/guildinactivitylog.js +++ b/events/buttons/guildinactivitylog.js @@ -6,278 +6,266 @@ 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 + 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 + }] + }) + + 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), + ) + ] + }); } - 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 - }] - }) - - 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), - ) - ] - }); - } }; diff --git a/events/buttons/inactiveapplicationaccept.js b/events/buttons/inactiveapplicationaccept.js index ca63a60..7f754ca 100644 --- a/events/buttons/inactiveapplicationaccept.js +++ b/events/buttons/inactiveapplicationaccept.js @@ -1,11 +1,11 @@ module.exports = { - name: "inactiveapplicationaccept", - description: "Accept an inactivity application.", - type: "button", - - async execute(interaction) { + name: "inactiveapplicationaccept", + description: "Accept an inactivity application.", + type: "button", - await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); + async execute(interaction) { - } -} \ No newline at end of file + await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); + + } +} diff --git a/events/buttons/inactiveapplicationdeny.js b/events/buttons/inactiveapplicationdeny.js index 4611057..811bbe9 100644 --- a/events/buttons/inactiveapplicationdeny.js +++ b/events/buttons/inactiveapplicationdeny.js @@ -1,11 +1,11 @@ module.exports = { - name: "inactiveapplicationdeny", - description: "Denies an inactivity application.", - type: "button", - - async execute(interaction) { + name: "inactiveapplicationdeny", + description: "Denies an inactivity application.", + type: "button", - await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); + async execute(interaction) { - } -} \ No newline at end of file + await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); + + } +} diff --git a/events/buttons/staffapplicationaccept.js b/events/buttons/staffapplicationaccept.js index d8ae5e7..05ce69e 100644 --- a/events/buttons/staffapplicationaccept.js +++ b/events/buttons/staffapplicationaccept.js @@ -10,7 +10,6 @@ module.exports = { async execute(interaction) { const user = interaction.user; - const channel = interaction.channel; const guild = interaction.guild; const embedColor = Number(color.replace("#", "0x")); @@ -63,4 +62,4 @@ module.exports = { }); } -} \ No newline at end of file +} diff --git a/events/buttons/staffapplicationdeny.js b/events/buttons/staffapplicationdeny.js index 271d5ef..3910465 100644 --- a/events/buttons/staffapplicationdeny.js +++ b/events/buttons/staffapplicationdeny.js @@ -22,4 +22,4 @@ module.exports = { ) await interaction.showModal(modal); } -}; \ No newline at end of file +}; diff --git a/events/buttons/staffapply.js b/events/buttons/staffapply.js index 5982156..4794e12 100644 --- a/events/buttons/staffapply.js +++ b/events/buttons/staffapply.js @@ -27,22 +27,22 @@ module.exports = { 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}); + 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}); + 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 } - + const tooLong = new EmbedBuilder() .setDescription("You took too long to respond.") .setColor(embedColor) @@ -52,386 +52,385 @@ module.exports = { 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" + + + 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 - }); - 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: [{ - 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" + + } 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 + "`", + 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 - - // 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." - } + color: embedColor }] }) - 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({ + 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: [{ - 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." - } + description: "Max character limit is 64.", + color: embedColor }] }) - 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 - }] - }) - } - 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({ + 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: [{ - 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." - } + description: "Max character limit is 256.", + color: embedColor }] }) - 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 - }] - }) - } - 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({ + } + 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: [{ - 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." - } + description: "Max character limit is 256.", + color: embedColor }] }) - 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 - }] - }) - } - 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({ + } + 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: [{ - title : "**Question 6**", - description: sq6 + "\n\nPlease type your answer below or type `cancel` to cancel your application." + + 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 - }] - }) - } - 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 - + 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: "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!", + 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 - const userCheck = await fetch(mojangAPI + answer1_1) - const uuid = userCheck.data.id + await user.send({ + embeds: [{ + description: "If you want to submit your application, type `yes` if not, type `no`", + color: embedColor + }] + }) - const newStaffApp = new staffapp({ - _id: new mongoose.Types.ObjectId(), - userID: user.id, - uuid: uuid, - }) + 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 newStaffApp.save() - await user.deleteDM(); + await user.send({ + embeds: [{ + description: "Your application has been submitted!", + color: embedColor + }] + }) - const channel = guild.channels.cache.get(staffApplicationsChannel); + const userCheck = await fetch(mojangAPI + answer1_1) + const uuid = userCheck.data.id - await channel.send({ - embeds: [{ - title: user.username + "#" + user.discriminator + " - Staff Application", - color: embedColor, - thumbnail: { - url: user.avatarURL() + const newStaffApp = new staffapp({ + _id: new mongoose.Types.ObjectId(), + userID: user.id, + uuid: uuid, + }) + + await newStaffApp.save() + await user.deleteDM(); + + const channel = guild.channels.cache.get(staffApplicationsChannel); + + await channel.send({ + embeds: [{ + title: user.username + "#" + user.discriminator + " - Staff Application", + color: embedColor, + thumbnail: { + url: user.avatarURL() + }, + fields: [ + { + name: rsq1, + value: "```" + answer1_1 + "```" }, - fields: [ - { - name: rsq1, - value: "```" + answer1_1 + "```" - }, - { - name: rsq2, - value: "```" + answer2_1 + "```" - }, - { - name: rsq3, - value: "```" + answer3_1 + "```" - }, - { - name: rsq4, - value: "```" + answer4_1 + "```" - }, - { - name: rsq5, - value: "```" + answer5_1 + "```" - }, - { - name: rsq6, - value: "```" + answer6_1 + "```" - } - - ], - footer: { - iconURL: guild.iconURL(), - text: "ID: " + user.id + { + name: rsq2, + value: "```" + answer2_1 + "```" + }, + { + name: rsq3, + value: "```" + answer3_1 + "```" + }, + { + name: rsq4, + value: "```" + answer4_1 + "```" + }, + { + name: rsq5, + value: "```" + answer5_1 + "```" + }, + { + name: rsq6, + value: "```" + answer6_1 + "```" } - }], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("staffapplicationaccept") - .setLabel("Accept") - .setStyle(ButtonStyle.Primary), - new ButtonBuilder() - .setCustomId("staffapplicationdeny") - .setLabel("Deny") - .setStyle(ButtonStyle.Danger) - ) - ] - } - ); + + ], + 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) + ) + ] + }); } } -} \ No newline at end of file +} diff --git a/events/buttons/verify.js b/events/buttons/verify.js index 8a1d920..7c203bc 100644 --- a/events/buttons/verify.js +++ b/events/buttons/verify.js @@ -2,27 +2,27 @@ const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = req 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) { + 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) + 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) - } + await interaction.showModal(modal) + } } diff --git a/events/buttons/waitingListUpdate.js b/events/buttons/waitingListUpdate.js index 1a74dff..f309d6a 100644 --- a/events/buttons/waitingListUpdate.js +++ b/events/buttons/waitingListUpdate.js @@ -6,18 +6,18 @@ 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) { + async execute(interaction) { - await interaction.deferReply({ ephemeral: true }); + await interaction.deferReply({ ephemeral: true }); - const user = interaction.user; - const message = interaction.message; - const embed = message.embeds[0]; - const accepted = await waitinglist.find() + 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=" @@ -33,34 +33,34 @@ module.exports = { } - let fields = []; + let fields = []; - for (let i = 0; i < accepted.length; i++) { + for (let i = 0; i < accepted.length; i++) { const timestamp1 = accepted[i].timestamp / 1000 const timestamp = Math.floor(timestamp1) - fields.push({ - name: `${i + 1}. ${accepted[i].IGN}`, - value: `TS: ` - }); - } + fields.push({ + name: `${i + 1}. ${accepted[i].IGN}`, + value: `TS: ` + }); + } - 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 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 + await interaction.editReply({ content: 'Updated the waiting list', ephemeral: true }); + } +} diff --git a/events/modals/denyreasonbox.js b/events/modals/denyreasonbox.js index a42ae7c..b406e86 100644 --- a/events/modals/denyreasonbox.js +++ b/events/modals/denyreasonbox.js @@ -11,12 +11,12 @@ module.exports = { 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; @@ -52,7 +52,7 @@ module.exports = { const dmMessage = new EmbedBuilder() .setDescription("Your application for the Illegitimate guild has been denied\n" + - "**Reason:** `" + reason + "`") + "**Reason:** `" + reason + "`") .setColor(embedColor); await applicant.send({ embeds: [dmMessage] }); @@ -62,8 +62,8 @@ module.exports = { await interaction.editReply({ embeds: [{ title: "Application Denied", - description: "The application has been denied by <@" + interaction.user.id + ">.\n" + - "**Reason:** `" + reason + "`", + description: "The application has been denied by <@" + interaction.user.id + ">.\n" + + "**Reason:** `" + reason + "`", color: embedColor, thumbnail: { url: applicant.avatarURL() @@ -75,4 +75,4 @@ module.exports = { }], }); } -} \ No newline at end of file +} diff --git a/events/modals/staffdenyreasonbox.js b/events/modals/staffdenyreasonbox.js index 6c94df6..882574b 100644 --- a/events/modals/staffdenyreasonbox.js +++ b/events/modals/staffdenyreasonbox.js @@ -11,12 +11,12 @@ module.exports = { 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"; @@ -46,7 +46,7 @@ module.exports = { const dmMessage = new EmbedBuilder() .setDescription("Your application for the Illegitimate guild staff has been denied\n" + - "**Reason:** `" + reason + "`") + "**Reason:** `" + reason + "`") .setColor(embedColor); await applicant.send({ embeds: [dmMessage] }); @@ -56,8 +56,8 @@ module.exports = { await interaction.editReply({ embeds: [{ title: "Application Denied", - description: "The application has been denied by <@" + interaction.user.id + ">.\n" + - "**Reason:** `" + reason + "`", + description: "The application has been denied by <@" + interaction.user.id + ">.\n" + + "**Reason:** `" + reason + "`", color: embedColor, thumbnail: { url: applicant.avatarURL() @@ -69,4 +69,4 @@ module.exports = { }], });; } -} \ No newline at end of file +} diff --git a/index.js b/index.js index 8ffa7ff..bac4e2a 100644 --- a/index.js +++ b/index.js @@ -203,13 +203,14 @@ client.on(Events.ClientReady, () => { embeds: [{ description: `Bot is online!`, color: embedColor - }] + }] }); }); client.on(Events.ClientReady, () => { client.user.setActivity( - { name: "over the Illegitimate Server", type: ActivityType.Watching }); + { name: "over the Illegitimate Server", type: ActivityType.Watching } + ); const activities = [ { name: "for Martina's return", type: ActivityType.Watching }, @@ -229,9 +230,11 @@ client.on(Events.ClientReady, () => { 1000 * 60 * 30 ) }); + client.on(Events.ClientReady, () => { client.user.setStatus('dnd'); }); + client.login(token); connect(mongoURI, {}).then(() => { diff --git a/schemas/guildAppSchema.js b/schemas/guildAppSchema.js index 7069cc4..42a3aef 100644 --- a/schemas/guildAppSchema.js +++ b/schemas/guildAppSchema.js @@ -6,4 +6,4 @@ const guildAppSchema = new Schema({ uuid: { type: String, required: true }, }); -module.exports = model('guildapp', guildAppSchema, 'guildapp'); \ No newline at end of file +module.exports = model('guildapp', guildAppSchema, 'guildapp'); diff --git a/schemas/staffAppSchema.js b/schemas/staffAppSchema.js index 94204a6..ef0acaa 100644 --- a/schemas/staffAppSchema.js +++ b/schemas/staffAppSchema.js @@ -6,4 +6,4 @@ const staffAppSchema = new Schema({ uuid: { type: String, required: true }, }); -module.exports = model('staffapp', staffAppSchema, 'staffapp'); \ No newline at end of file +module.exports = model('staffapp', staffAppSchema, 'staffapp'); diff --git a/schemas/verifySchema.js b/schemas/verifySchema.js index 995c5eb..4c82847 100644 --- a/schemas/verifySchema.js +++ b/schemas/verifySchema.js @@ -6,4 +6,4 @@ const verifySchema = new Schema({ uuid: { type: String, required: true }, }); -module.exports = model('verify', verifySchema, 'verify'); \ No newline at end of file +module.exports = model('verify', verifySchema, 'verify'); diff --git a/scripts/deploy-commands.js b/scripts/deploy-commands.js index cbfbc30..d904860 100644 --- a/scripts/deploy-commands.js +++ b/scripts/deploy-commands.js @@ -8,80 +8,80 @@ const args = process.argv.slice(2); const arg = args[0]; if (!arg) { - console.log('Please specify a command to run!'); + 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')); +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()); - } + // 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()); - } + 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); + // 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.`); + // 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 }, - ); + // 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); - } - })(); + 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')); + 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()); - } + // 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); + // 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.`); + // 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 }, - ); + // 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(`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 1a19b27..6ce04a3 100644 --- a/scripts/dev-deploy.js +++ b/scripts/dev-deploy.js @@ -9,13 +9,13 @@ const commands = []; // const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js')); const commandFiles = [ - './commands/config.js', + './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 @@ -23,19 +23,19 @@ 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); - } - })(); \ No newline at end of file + console.log(`Successfully reloaded ${data.length} application (/) commands.`); + } catch (error) { + // And of course, make sure you catch and log any errors! + console.error(error); + } +})(); diff --git a/utils/functions.js b/utils/functions.js index 3bdf434..6b7522a 100644 --- a/utils/functions.js +++ b/utils/functions.js @@ -1,109 +1,111 @@ /* ---------- 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; const GROWTH = 2500; - const HALF_GROWTH = 0.5 * GROWTH; - const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH; 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 -} \ No newline at end of file + getExactLevel, + skywarsLevel, + getLevelForExp +}