Merge branch 'dev' into 'main'

Formatted all files using clang

See merge request illegitimate/illegitimate-bot!20
This commit is contained in:
2023-09-01 04:56:22 +00:00
37 changed files with 1708 additions and 1717 deletions

View File

@@ -1,4 +1,4 @@
const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention} = require('discord.js'); const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention } = require('discord.js');
module.exports = { module.exports = {
name: 'congratsmessage', name: 'congratsmessage',
@@ -22,7 +22,7 @@ module.exports = {
const target = message.author; const target = message.author;
await message.reply({ await message.reply({
embeds:[{ embeds: [{
title: 'Congratulations!', title: 'Congratulations!',
description: `GG to ${userMention(target.id)}!`, description: `GG to ${userMention(target.id)}!`,
}] }]
@@ -31,4 +31,4 @@ module.exports = {
await interaction.reply({ content: `Sent a congrats message`, ephemeral: true }); await interaction.reply({ content: `Sent a congrats message`, ephemeral: true });
} }
}; };

View File

@@ -31,4 +31,4 @@ module.exports = {
return interaction.reply({ content: `Reset ${target.user.username}'s nickname.`, ephemeral: true }); return interaction.reply({ content: `Reset ${target.user.username}'s nickname.`, ephemeral: true });
} }
}; };

View File

@@ -7,63 +7,63 @@ const fetch = require("axios");
const { getExactLevel, skywarsLevel, getLevelForExp } = require("../utils/functions.js"); const { getExactLevel, skywarsLevel, getLevelForExp } = require("../utils/functions.js");
module.exports = { module.exports = {
name: "check", name: "check",
description: "Check a player's stats.", description: "Check a player's stats.",
type: "slash", type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName("check") .setName("check")
.setDescription("Check a player's stats.") .setDescription("Check a player's stats.")
.addStringOption((option) => option.setName("ign") .addStringOption((option) => option.setName("ign")
.setDescription("The player's IGN.") .setDescription("The player's IGN.")
.setRequired(true)) .setRequired(true))
.setDMPermission(false), .setDMPermission(false),
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({}); await interaction.deferReply({});
const ign = interaction.options.getString("ign"); const ign = interaction.options.getString("ign");
const mojang = "https://api.mojang.com/users/profiles/minecraft/"; const mojang = "https://api.mojang.com/users/profiles/minecraft/";
const hypixel = "https://api.hypixel.net/player" const hypixel = "https://api.hypixel.net/player"
const guildAPI = "https://api.hypixel.net/guild" const guildAPI = "https://api.hypixel.net/guild"
const minotar = "https://minotar.net/helm/"; const minotar = "https://minotar.net/helm/";
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"));
const head = minotar + ign; const head = minotar + ign;
if (!ign) { if (!ign) {
await interaction.editReply("Please provide a player's IGN."); await interaction.editReply("Please provide a player's IGN.");
return; return;
} }
try { try {
await fetch(mojang + ign); await fetch(mojang + ign);
} catch (error) { } catch (error) {
interaction.editReply({ interaction.editReply({
embeds: [ embeds: [
{ description: "That player doesn't exist.", color: embedColor } { description: "That player doesn't exist.", color: embedColor }
] ]
}); });
return; return;
} }
const userCheck = await fetch(mojang + ign); const userCheck = await fetch(mojang + ign);
const uuid = userCheck.data.id; const uuid = userCheck.data.id;
const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid
const stats = await fetch(player); const stats = await fetch(player);
if (!stats.data.player) { if (!stats.data.player) {
interaction.editReply({ interaction.editReply({
embeds: [{ embeds: [{
description: "That player hasn't played Hypixel before.", description: "That player hasn't played Hypixel before.",
color: embedColor color: embedColor
}] }]
}); });
return; return;
} }
const rank2 = stats.data.player.newPackageRank; const rank2 = stats.data.player.newPackageRank;
const monthlyRank = stats.data.player.monthlyPackageRank; const monthlyRank = stats.data.player.monthlyPackageRank;
if (rank2 === 'VIP') { if (rank2 === 'VIP') {
var rank = "[VIP] " var rank = "[VIP] "
@@ -77,128 +77,128 @@ module.exports = {
var rank = "[MVP++] " var rank = "[MVP++] "
} }
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid
const guildCheck = await fetch(guild); const guildCheck = await fetch(guild);
if (!guildCheck.data.guild) { if (!guildCheck.data.guild) {
var guildName = "None"; var guildName = "None";
} else { } else {
var guildName = guildCheck.data.guild.name; var guildName = guildCheck.data.guild.name;
} }
if (!guildCheck.data.guild) { if (!guildCheck.data.guild) {
var guildTag = "" var guildTag = ""
} else if (!guildCheck.data.guild.tag) { } else if (!guildCheck.data.guild.tag) {
var guildTag = "" var guildTag = ""
} else { } else {
var guildTag = " [" + guildCheck.data.guild.tag + "]" var guildTag = " [" + guildCheck.data.guild.tag + "]"
} }
//bedwars level //bedwars level
const hsbwexp = stats.data.player.stats.Bedwars.Experience; const hsbwexp = stats.data.player.stats.Bedwars.Experience;
const hsbwstars = getLevelForExp(hsbwexp); const hsbwstars = getLevelForExp(hsbwexp);
// bedwars fkdr // bedwars fkdr
const hsbwfk = stats.data.player.stats.Bedwars.final_kills_bedwars; const hsbwfk = stats.data.player.stats.Bedwars.final_kills_bedwars;
const hsbwfd = stats.data.player.stats.Bedwars.final_deaths_bedwars; const hsbwfd = stats.data.player.stats.Bedwars.final_deaths_bedwars;
const hsbwfkdr = hsbwfk / hsbwfd; const hsbwfkdr = hsbwfk / hsbwfd;
// bedwars wins // bedwars wins
const hsbwwins = stats.data.player.stats.Bedwars.wins_bedwars; const hsbwwins = stats.data.player.stats.Bedwars.wins_bedwars;
// skywars level // skywars level
const hsswexp = stats.data.player.stats.SkyWars.skywars_experience; const hsswexp = stats.data.player.stats.SkyWars.skywars_experience;
const hsswstars = skywarsLevel(hsswexp); const hsswstars = skywarsLevel(hsswexp);
// skywars kdr // skywars kdr
const hsswkills = stats.data.player.stats.SkyWars.kills; const hsswkills = stats.data.player.stats.SkyWars.kills;
const hsswdeaths = stats.data.player.stats.SkyWars.deaths; const hsswdeaths = stats.data.player.stats.SkyWars.deaths;
const hsswkd = hsswkills / hsswdeaths; const hsswkd = hsswkills / hsswdeaths;
//skywars wins //skywars wins
const hsswwins = stats.data.player.stats.SkyWars.wins; const hsswwins = stats.data.player.stats.SkyWars.wins;
// dueks kdr // dueks kdr
const hsduelskills = stats.data.player.stats.Duels.kills const hsduelskills = stats.data.player.stats.Duels.kills
const hsduelsdeaths = stats.data.player.stats.Duels.deaths const hsduelsdeaths = stats.data.player.stats.Duels.deaths
const hsduelskd = hsduelskills / hsduelsdeaths const hsduelskd = hsduelskills / hsduelsdeaths
// duels wins // duels wins
const hsduelswins = stats.data.player.stats.Duels.wins; const hsduelswins = stats.data.player.stats.Duels.wins;
// duels wlr // duels wlr
const hsduelslosses = stats.data.player.stats.Duels.losses; const hsduelslosses = stats.data.player.stats.Duels.losses;
const hsduelswlr = hsduelswins / hsduelslosses; const hsduelswlr = hsduelswins / hsduelslosses;
// network level // network level
const hypixelExp = stats.data.player.networkExp; const hypixelExp = stats.data.player.networkExp;
const level = getExactLevel(hypixelExp); const level = getExactLevel(hypixelExp);
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
var bwtitle =
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements.";
} else {
var bwtitle =
"<a:check_a:1087808632172847134> This player meets the BedWars requirements.";
}
if (hsswstars < swstars) { if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
var swtitle = var bwtitle =
"<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."; "<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements.";
} else { } else {
var swtitle = var bwtitle =
"<a:check_a:1087808632172847134> This player meets the SkyWars requirements."; "<a:check_a:1087808632172847134> This player meets the BedWars requirements.";
} }
if (hsduelswins < duelswins || hsduelswlr < duelswlr) { if (hsswstars < swstars) {
var duelstitle = var swtitle =
"<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."; "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements.";
} else { } else {
var duelstitle = var swtitle =
"<a:check_a:1087808632172847134> This player meets the Duels requirements."; "<a:check_a:1087808632172847134> This player meets the SkyWars requirements.";
} }
await interaction.editReply({ if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
embeds: [{ var duelstitle =
title: rank + stats.data.player.displayname + guildTag, "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements.";
description: "**Network Level:** `" + } else {
level.toFixed(2).toString() + "`\n" + var duelstitle =
"**Current Guild:** `" + guildName + "`", "<a:check_a:1087808632172847134> This player meets the Duels requirements.";
color: embedColor, }
thumbnail: { url: head },
footer: { await interaction.editReply({
text: interaction.guild.name + " | Developed by @Taken#0002", embeds: [{
icon_url: interaction.guild.iconURL() title: rank + stats.data.player.displayname + guildTag,
}, description: "**Network Level:** `" +
fields: [ level.toFixed(2).toString() + "`\n" +
{ "**Current Guild:** `" + guildName + "`",
name: bwtitle, color: embedColor,
value: "**➺ Stars:** `" + thumbnail: { url: head },
hsbwstars.toFixed(2).toString() + " / " + footer: {
bwstars.toString() + "`\n" + text: interaction.guild.name + " | Developed by @Taken#0002",
"**➺ FKDR:** `" + icon_url: interaction.guild.iconURL()
hsbwfkdr.toFixed(2).toString() + },
" / " + bwfkdr.toString() + "`\n" + fields: [
"**➺ Wins:** `" + {
hsbwwins.toString() + " / " + name: bwtitle,
bwwins.toString() + "`" value: "**➺ Stars:** `" +
}, hsbwstars.toFixed(2).toString() + " / " +
{ bwstars.toString() + "`\n" +
name: swtitle, "**➺ FKDR:** `" +
value: hsbwfkdr.toFixed(2).toString() +
"**➺ Stars:** `" + " / " + bwfkdr.toString() + "`\n" +
hsswstars.toFixed(2).toString() + "**➺ Wins:** `" +
" / " + swstars.toString() + "`\n" + hsbwwins.toString() + " / " +
"**➺ KDR:** `" + bwwins.toString() + "`"
hsswkd.toFixed(2).toString() + },
"`\n" + {
"**➺ Wins:** `" + name: swtitle,
hsswwins.toString() + "`" value:
}, "**➺ Stars:** `" +
{ hsswstars.toFixed(2).toString() +
name: duelstitle, " / " + swstars.toString() + "`\n" +
value: "**➺ Wins:** `" + "**➺ KDR:** `" +
hsduelswins.toString() + hsswkd.toFixed(2).toString() +
" / " + duelswins.toString() + "`\n" + "`\n" +
"**➺ Wins:** `" +
hsswwins.toString() + "`"
},
{
name: duelstitle,
value: "**➺ Wins:** `" +
hsduelswins.toString() +
" / " + duelswins.toString() + "`\n" +
"**➺ WLR:** `" + "**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() + hsduelswlr.toFixed(2).toString() +
" / " + duelswlr.toString() + "`\n" + " / " + duelswlr.toString() + "`\n" +
"**➺ KDR:** `" + "**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() + "`" hsduelskd.toFixed(2).toString() + "`"
} }
] ]
}] }]
}); });
} }
}; };

View File

@@ -2,218 +2,218 @@ const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilde
const { color } = require("../config/options.json"); const { color } = require("../config/options.json");
module.exports = { module.exports = {
name: "config", name: "config",
description: "Configure the bot.", description: "Configure the bot.",
type: "slash", type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName("config") .setName("config")
.setDescription("Configure the bot.") .setDescription("Configure the bot.")
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand
.setName("sendguildapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true))
)
.addSubcommand((subcommand) =>
subcommand
.setName("sendstaffapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true)))
.addSubcommand((subcommand) =>
subcommand subcommand
.setName("sendverfiymessage") .setName("sendguildapplication")
.setDescription("Send the verfiy message to a channel.") .setDescription("Send the application message to a channel.")
.addChannelOption((option) => .addChannelOption((option) =>
option option
.setName("channel") .setName("channel")
.setDescription("The channel to send the verfiy message to.") .setDescription("The channel to send the application to.")
.setRequired(true))) .setRequired(true))
.addSubcommand((subcommand) => )
.addSubcommand((subcommand) =>
subcommand subcommand
.setName("sendwaitinglistmessage") .setName("sendstaffapplication")
.setDescription("Send the waiting list message to a channel.") .setDescription("Send the application message to a channel.")
.addChannelOption((option) => .addChannelOption((option) =>
option option
.setName("channel") .setName("channel")
.setDescription("The channel to send the waiting list message to.") .setDescription("The channel to send the application to.")
.setRequired(true))) .setRequired(true)))
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName("sendinactivityapplication") .setName("sendverfiymessage")
.setDescription("Send the application message to a channel.") .setDescription("Send the verfiy message to a channel.")
.addChannelOption((option) => .addChannelOption((option) =>
option option
.setName("channel") .setName("channel")
.setDescription("The channel to send the application to.") .setDescription("The channel to send the verfiy message to.")
.setRequired(true))) .setRequired(true)))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .addSubcommand((subcommand) =>
.setDMPermission(false), 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) { async execute(interaction) {
const user = interaction.user; const user = interaction.user;
const guild = interaction.guild; const guild = interaction.guild;
const subcommand = interaction.options.getSubcommand(); const subcommand = interaction.options.getSubcommand();
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"));
if (subcommand === "sendguildapplication") { if (subcommand === "sendguildapplication") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel");
await channel.send({ await channel.send({
embeds: [ embeds: [
{ {
title: "Guild Application", title: "Guild Application",
description: "You can apply for the guild by clicking the button below.", description: "You can apply for the guild by clicking the button below.",
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }) iconURL: interaction.guild.iconURL({ dynamic: true })
}, },
thumbnail: { thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }) url: interaction.guild.iconURL({ dynamic: true })
} }
} }
], ],
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder()
.addComponents(new ButtonBuilder() .addComponents(new ButtonBuilder()
.setCustomId("guildapply") .setCustomId("guildapply")
.setLabel("Apply") .setLabel("Apply")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" })) .setEmoji({ name: "✅" }))
] ]
}); });
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true });
} }
if (subcommand === "sendstaffapplication") { if (subcommand === "sendstaffapplication") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel");
await channel.send({ await channel.send({
embeds: [ embeds: [
{ {
title: "Staff Application", title: "Staff Application",
description: "You can apply for the staff team by clicking the button below.", description: "You can apply for the staff team by clicking the button below.",
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }) iconURL: interaction.guild.iconURL({ dynamic: true })
}, },
thumbnail: { thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }) url: interaction.guild.iconURL({ dynamic: true })
} }
} }
], ],
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder()
.addComponents(new ButtonBuilder() .addComponents(new ButtonBuilder()
.setCustomId("staffapply") .setCustomId("staffapply")
.setLabel("Apply") .setLabel("Apply")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" })) .setEmoji({ name: "✅" }))
] ]
}); });
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true });
} }
if (subcommand === "sendinactivityapplication") { if (subcommand === "sendinactivityapplication") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel");
await channel.send({ await channel.send({
embeds: [ embeds: [
{ {
title: "Inactivity Log", title: "Inactivity Log",
description: "You can send an inactivity log by clicking the button below.", description: "You can send an inactivity log by clicking the button below.",
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }) iconURL: interaction.guild.iconURL({ dynamic: true })
}, },
thumbnail: { thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }) url: interaction.guild.iconURL({ dynamic: true })
} }
} }
], ],
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder()
.addComponents(new ButtonBuilder() .addComponents(new ButtonBuilder()
.setCustomId("guildinactivitylog") .setCustomId("guildinactivitylog")
.setLabel("Submit") .setLabel("Submit")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" })) .setEmoji({ name: "✅" }))
] ]
}); });
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true });
} }
if (subcommand === "sendverfiymessage") { if (subcommand === "sendverfiymessage") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel");
await channel.send({ await channel.send({
embeds: [{ embeds: [{
title: "Verification", title: "Verification",
description: "You can verify by clicking the button below.", description: "You can verify by clicking the button below.",
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }) iconURL: interaction.guild.iconURL({ dynamic: true })
}, },
thumbnail: { thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }) url: interaction.guild.iconURL({ dynamic: true })
} }
}], }],
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder()
.addComponents(new ButtonBuilder() .addComponents(new ButtonBuilder()
.setCustomId("verifybutton") .setCustomId("verifybutton")
.setLabel("Verify") .setLabel("Verify")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" })) .setEmoji({ name: "✅" }))
] ]
}); });
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true });
} }
if (subcommand === "sendwaitinglistmessage") { if (subcommand === "sendwaitinglistmessage") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel");
await channel.send({ await channel.send({
embeds: [{ embeds: [{
title: "Waiting List", title: "Waiting List",
description: "The people below were accepted into the guild\n" + description: "The people below were accepted into the guild\n" +
"Try to invite them in order.", "Try to invite them in order.",
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }) iconURL: interaction.guild.iconURL({ dynamic: true })
}, },
thumbnail: { thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }) url: interaction.guild.iconURL({ dynamic: true })
} }
}], }],
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder()
.addComponents(new ButtonBuilder() .addComponents(new ButtonBuilder()
.setCustomId("waitinglistupdate") .setCustomId("waitinglistupdate")
.setLabel("Update") .setLabel("Update")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "🔄" })) .setEmoji({ name: "🔄" }))
] ]
}); });
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true });
} }
} }
}; };

View File

@@ -104,4 +104,4 @@ module.exports = {
} }
} }
}; };

View File

@@ -3,7 +3,7 @@ const { color } = require("../config/options.json");
const verify = require("../schemas/verifySchema.js"); const verify = require("../schemas/verifySchema.js");
const mongoose = require("mongoose"); const mongoose = require("mongoose");
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json"); 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 = { module.exports = {
name: "forceunverify", name: "forceunverify",
@@ -38,7 +38,7 @@ module.exports = {
} }
await verify.findOneAndDelete({ userID: member1.id }) await verify.findOneAndDelete({ userID: member1.id })
await member.roles.remove(removeThese) await member.roles.remove(removeThese)
await interaction.reply({ await interaction.reply({

View File

@@ -15,7 +15,7 @@ module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('forceupdate') .setName('forceupdate')
.setDescription('Force update the user') .setDescription('Force update the user')
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName('user')
.setDescription('The user to force update') .setDescription('The user to force update')
@@ -53,236 +53,236 @@ module.exports = {
} }
const mojangAPI = "https://api.mojang.com/user/profile/" 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 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 userCheck = await fetch(mojangAPI + verifyData.uuid);
const guildCheck = await fetch(guild); const guildCheck = await fetch(guild);
const head = minotar + userCheck.data.name; const head = minotar + userCheck.data.name;
if (!guildCheck.data.guild) { if (!guildCheck.data.guild) {
var responseGuildID = null var responseGuildID = null
} else { } else {
var responseGuildID = guildCheck.data.guild._id var responseGuildID = guildCheck.data.guild._id
} }
if (responseGuildID !== hypixelGuildID) { if (responseGuildID !== hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
} }
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: usermentioned + " was given the the Default Member role.", description: usermentioned + " was given the the Default Member role.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
await roleManage.add(defaultMember) await roleManage.add(defaultMember)
return return
} }
if (responseGuildID === hypixelGuildID) { if (responseGuildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members; const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; 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++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
} }
await roleManage.add(guildRole, "User was force updated.") await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(guildStaff, "User was force updated.") await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(gm, "User was force updated.") await roleManage.add(gm, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.") await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: usermentioned + "'s rank has been updated to `Guild Master`", description: usermentioned + "'s rank has been updated to `Guild Master`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
} }
if (guildRank === 'Manager') { if (guildRank === 'Manager') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
} }
await roleManage.add(guildRole, "User was force updated.") await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(guildStaff, "User was force updated.") await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(manager, "User was force updated.") await roleManage.add(manager, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.") await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: usermentioned + "'s rank has been updated to `Manager`", description: usermentioned + "'s rank has been updated to `Manager`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
} }
if (guildRank === 'Moderator') { if (guildRank === 'Moderator') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
} }
await roleManage.add(guildRole, "User was force updated.") await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(guildStaff, "User was force updated.") await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(moderator, "User was force updated.") await roleManage.add(moderator, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.") await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: usermentioned + "'s rank has been updated to `Moderator`", description: usermentioned + "'s rank has been updated to `Moderator`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
} }
if (guildRank === 'Beast') { if (guildRank === 'Beast') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
} }
await roleManage.add(guildRole, "User was force updated.") await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(beast, "User was force updated.") await roleManage.add(beast, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.") await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: usermentioned + "'s rank has been updated to `Beast`.", description: usermentioned + "'s rank has been updated to `Beast`.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
return return
} }
if (guildRank === 'Elite') { if (guildRank === 'Elite') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
} }
await roleManage.add(guildRole, "User was force updated.") await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(elite, "User was force updated.") await roleManage.add(elite, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.") await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: usermentioned + "'s rank has been updated to `Elite`.", description: usermentioned + "'s rank has been updated to `Elite`.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
return return
} }
if (guildRank === 'Member') { if (guildRank === 'Member') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
} }
await roleManage.add(guildRole, "User was force updated.") await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(member, "User was force updated.") await roleManage.add(member, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.") await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: usermentioned + "'s rank has been updated to `Member`.", description: usermentioned + "'s rank has been updated to `Member`.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
return return
} }
if (guildRank === 'Trial Member') { if (guildRank === 'Trial Member') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
} }
await roleManage.add(guildRole, "User was force updated.") await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(trialmember, "User was force updated.") await roleManage.add(trialmember, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.") await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: usermentioned + "'s rank has been updated to `Trial Member`.", description: usermentioned + "'s rank has been updated to `Trial Member`.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
return return
} }
} }
} }
} }

View File

@@ -4,7 +4,7 @@ const hypixelApiKey = process.env.HYPIXELAPIKEY;
const fetch = require('axios'); const fetch = require('axios');
const { color, hypixelGuildID } = require('../config/options.json'); const { color, hypixelGuildID } = require('../config/options.json');
const verify = require('../schemas/verifySchema.js') 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'); const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
@@ -16,7 +16,7 @@ module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('forceverify') .setName('forceverify')
.setDescription('Force verify a user.') .setDescription('Force verify a user.')
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName('user')
.setDescription('The user to force verify.')) .setDescription('The user to force verify.'))
@@ -26,7 +26,7 @@ module.exports = {
.setDescription('The user\'s in-game name.')) .setDescription('The user\'s in-game name.'))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply();
@@ -35,7 +35,7 @@ module.exports = {
const user = interaction.guild.members.cache.get(user1.id); const user = interaction.guild.members.cache.get(user1.id);
const ign = interaction.options.getString('ign'); const ign = interaction.options.getString('ign');
const mod = interaction.user const mod = interaction.user
// const slothPixel = "https://api.slothpixel.me/api/players/"; // const slothPixel = "https://api.slothpixel.me/api/players/";
// const guildAPI = "https://api.slothpixel.me/api/guilds/" // const guildAPI = "https://api.slothpixel.me/api/guilds/"
@@ -90,7 +90,7 @@ module.exports = {
const hypixelCheck = await fetch(player); const hypixelCheck = await fetch(player);
if (!hypixelCheck.data.player) { if (!hypixelCheck.data.player) {
interaction.editReply({ interaction.editReply({
embeds: [{ embeds: [{
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.", description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
@@ -98,7 +98,7 @@ module.exports = {
}] }]
}); });
return; return;
} }
const guildCheck = await fetch(guild) const guildCheck = await fetch(guild)
@@ -109,50 +109,50 @@ module.exports = {
} }
if (responseGuildID === hypixelGuildID) { if (responseGuildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members; const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find(member => member.uuid === hypixelCheck.data.player.uuid).rank; const guildRank = GuildMembers.find(member => member.uuid === hypixelCheck.data.player.uuid).rank;
if (guildRank === "Guild Master") { if (guildRank === "Guild Master") {
await user.roles.add(gm, "User was force verified by " + modName); 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(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName) await user.roles.add(guildStaff, "User was force verified by " + modName)
} }
if (guildRank === "Manager") { if (guildRank === "Manager") {
await user.roles.add(manager, "User was force verified by " + modName); 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(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName) await user.roles.add(guildStaff, "User was force verified by " + modName)
} }
if (guildRank === "Moderator") { if (guildRank === "Moderator") {
await user.roles.add(moderator, "User was force verified by " + modName); 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(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName) await user.roles.add(guildStaff, "User was force verified by " + modName)
} }
if (guildRank === "Beast") { if (guildRank === "Beast") {
await user.roles.add(beast, "User was force verified by " + modName); await user.roles.add(beast, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName) await user.roles.add(guildRole, "User was force verified by " + modName)
} }
if (guildRank === "Elite") { if (guildRank === "Elite") {
await user.roles.add(elite, "User was force verified by " + modName); await user.roles.add(elite, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName) await user.roles.add(guildRole, "User was force verified by " + modName)
} }
if (guildRank === "Member") { if (guildRank === "Member") {
await user.roles.add(member, "User was force verified by " + modName); await user.roles.add(member, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName) await user.roles.add(guildRole, "User was force verified by " + modName)
} }
if (guildRank === "Trial Member") { if (guildRank === "Trial Member") {
await user.roles.add(trialmember, "User was force verified by " + modName); 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(guildRole, "User was force verified by " + modName)
} }
} }
await user.roles.add(defaultMember, "User was force verified by " + modName); await user.roles.add(defaultMember, "User was force verified by " + modName);
const newVerify = new verify({ const newVerify = new verify({
_id: new mongoose.Types.ObjectId(), _id: new mongoose.Types.ObjectId(),
userID: user.id, userID: user.id,
@@ -177,4 +177,4 @@ module.exports = {
}); });
} }
}; };

View File

@@ -5,7 +5,7 @@ module.exports = {
name: 'help', name: 'help',
description: 'Help command', description: 'Help command',
type: 'slash', type: 'slash',
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('help') .setName('help')
.setDescription('Help command') .setDescription('Help command')
@@ -47,8 +47,8 @@ module.exports = {
icon_url: interaction.guild.iconURL({ dynamic: true }), icon_url: interaction.guild.iconURL({ dynamic: true }),
text: interaction.guild.name + ' | Developed by: @Taken#0001' text: interaction.guild.name + ' | Developed by: @Taken#0001'
} }
}] }]
}); });
} }
}; };

View File

@@ -27,9 +27,9 @@ module.exports = {
fields: [ fields: [
{ {
name: '**Bedwars**', name: '**Bedwars**',
value: '**Stars:** `' + bwstars.toString() + value: '**Stars:** `' + bwstars.toString() +
'`\n**Wins:** `' + bwwins.toString() + '`\n**Wins:** `' + bwwins.toString() +
'`\n**FKDR:** `' + bwfkdr.toString() + '`' '`\n**FKDR:** `' + bwfkdr.toString() + '`'
}, },
{ {
name: '**Skywars**', name: '**Skywars**',
@@ -38,7 +38,7 @@ module.exports = {
{ {
name: '**Duels**', name: '**Duels**',
value: '**Wins:** `' + duelswins.toString() + value: '**Wins:** `' + duelswins.toString() +
'`\n**WLR:** `' + duelswlr.toString() + '`' '`\n**WLR:** `' + duelswlr.toString() + '`'
} }
], ],
footer: { footer: {

View File

@@ -9,17 +9,17 @@ module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('send') .setName('send')
.setDescription('Send a message to a channel.') .setDescription('Send a message to a channel.')
.addStringOption(option => .addStringOption(option =>
option option
.setName('message') .setName('message')
.setDescription('The message to send.')) .setDescription('The message to send.'))
.addChannelOption(option => .addChannelOption(option =>
option option
.setName('channel') .setName('channel')
.setDescription('The channel to send the message to.')) .setDescription('The channel to send the message to.'))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
@@ -54,4 +54,4 @@ module.exports = {
] ]
}); });
} }
}; };

View File

@@ -8,7 +8,7 @@ module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('setnick') .setName('setnick')
.setDescription('Set your nickname') .setDescription('Set your nickname')
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName('user')
.setDescription('The user to set the nickname for') .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 }); await interaction.reply({ content: "Set the nickname of " + userMention(member.id) + " to " + nickname, ephemeral: true });
} }
} }

View File

@@ -56,4 +56,4 @@ module.exports = {
await channel.setRateLimitPerUser(seconds) await channel.setRateLimitPerUser(seconds)
} }
} }

View File

@@ -13,9 +13,9 @@ module.exports = {
type: 'slash', type: 'slash',
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('update') .setName('update')
.setDescription('Update your guild rank.') .setDescription('Update your guild rank.')
.setDMPermission(false), .setDMPermission(false),
async execute(interaction) { async execute(interaction) {
@@ -82,200 +82,200 @@ module.exports = {
return return
} }
if (guildID === hypixelGuildID) { if (guildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members; const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; 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++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
} }
await roleManage.add(guildRole, "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(guildStaff, "User used the update command")
await roleManage.add(gm, "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(defaultMember, "User used the update command")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: "Your rank has been updated to `Guild Master`", description: "Your rank has been updated to `Guild Master`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
} }
if (guildRank === 'Manager') { if (guildRank === 'Manager') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
} }
await roleManage.add(guildRole, "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(guildStaff, "User used the update command")
await roleManage.add(manager, "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(defaultMember, "User used the update command")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: "Your rank has been updated to `Manager`", description: "Your rank has been updated to `Manager`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
} }
if (guildRank === 'Moderator') { if (guildRank === 'Moderator') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
} }
await roleManage.add(guildRole, "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(guildStaff, "User used the update command")
await roleManage.add(moderator, "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(defaultMember, "User used the update command")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: "Your rank has been updated to `Moderator`", description: "Your rank has been updated to `Moderator`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
} }
if (guildRank === 'Beast') { if (guildRank === 'Beast') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
} }
await roleManage.add(guildRole, "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(beast, "User used the update command")
await roleManage.add(defaultMember, "User used the update command") await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: "Your rank has been updated to `Beast`.", description: "Your rank has been updated to `Beast`.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
return return
} }
if (guildRank === 'Elite') { if (guildRank === 'Elite') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
} }
await roleManage.add(guildRole, "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(elite, "User used the update command")
await roleManage.add(defaultMember, "User used the update command") await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: "Your rank has been updated to `Elite`.", description: "Your rank has been updated to `Elite`.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
return return
} }
if (guildRank === 'Member') { if (guildRank === 'Member') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
} }
await roleManage.add(guildRole, "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(member, "User used the update command")
await roleManage.add(defaultMember, "User used the update command") await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: "Your rank has been updated to `Member`.", description: "Your rank has been updated to `Member`.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
return return
} }
if (guildRank === 'Trial Member') { if (guildRank === 'Trial Member') {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
} }
await roleManage.add(guildRole, "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(trialmember, "User used the update command")
await roleManage.add(defaultMember, "User used the update command") await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: "Your rank has been updated to `Trial Member`.", description: "Your rank has been updated to `Trial Member`.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
}, },
footer: { footer: {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }) icon_url: interaction.guild.iconURL({ dynamic: true })
} }
}] }]
}) })
return return
} }
} }
} }
}; };

View File

@@ -98,7 +98,7 @@ module.exports = {
return; return;
} }
const linkedDiscord = stats.data.player.socialMedia.links.DISCORD const linkedDiscord = stats.data.player.socialMedia.links.DISCORD
if (linkedDiscord !== username) { if (linkedDiscord !== username) {
interaction.editReply({ interaction.editReply({
@@ -122,48 +122,48 @@ module.exports = {
var guildID = guildCheck.data.guild._id var guildID = guildCheck.data.guild._id
} }
if (guildID === hypixelGuildID) { if (guildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members const GuildMembers = guildCheck.data.guild.members
const guildRank = GuildMembers.find((member) => member.uuid === stats.data.player.uuid).rank; const guildRank = GuildMembers.find((member) => member.uuid === stats.data.player.uuid).rank;
if (guildRank === "Guild Master" && guildID === hypixelGuildID) { if (guildRank === "Guild Master" && guildID === hypixelGuildID) {
await user.roles.add(gm, "Verification"); await user.roles.add(gm, "Verification");
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification"); await user.roles.add(guildStaff, "Verification");
} }
if (guildRank === "Manager" && guildID === hypixelGuildID) { if (guildRank === "Manager" && guildID === hypixelGuildID) {
await user.roles.add(manager, "Verification"); await user.roles.add(manager, "Verification");
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification"); await user.roles.add(guildStaff, "Verification");
} }
if (guildRank === "Moderator" && guildID === hypixelGuildID) { if (guildRank === "Moderator" && guildID === hypixelGuildID) {
await user.roles.add(moderator, "Verification"); await user.roles.add(moderator, "Verification");
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification"); await user.roles.add(guildStaff, "Verification");
} }
if (guildRank === "Beast" && guildID === hypixelGuildID) { if (guildRank === "Beast" && guildID === hypixelGuildID) {
await user.roles.add(beast, "Verification"); await user.roles.add(beast, "Verification");
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification");
} }
if (guildRank === "Elite" && guildID === hypixelGuildID) { if (guildRank === "Elite" && guildID === hypixelGuildID) {
await user.roles.add(elite, "Verification"); await user.roles.add(elite, "Verification");
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification");
} }
if (guildRank === "Member" && guildID === hypixelGuildID) { if (guildRank === "Member" && guildID === hypixelGuildID) {
await user.roles.add(member, "Verification"); await user.roles.add(member, "Verification");
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification");
} }
if (guildRank === "Trial Member" && guildID === hypixelGuildID) { if (guildRank === "Trial Member" && guildID === hypixelGuildID) {
await user.roles.add(trialmember, "Verification"); await user.roles.add(trialmember, "Verification");
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification");
} }
} }
await user.roles.add(defaultMember, "Verification"); await user.roles.add(defaultMember, "Verification");
@@ -192,4 +192,4 @@ module.exports = {
] ]
}); });
} }
}; };

View File

@@ -55,4 +55,4 @@ module.exports = {
}) })
} }
}; };

View File

@@ -130,8 +130,8 @@ module.exports = {
embeds: [{ embeds: [{
title: rank + stats.data.player.displayname + guildTag, title: rank + stats.data.player.displayname + guildTag,
description: "**Network Level:** `" + description: "**Network Level:** `" +
level.toFixed(2).toString() + "`\n" + level.toFixed(2).toString() + "`\n" +
"**Current Guild:** `" + guildName + "`", "**Current Guild:** `" + guildName + "`",
color: embedColor, color: embedColor,
thumbnail: { url: head }, thumbnail: { url: head },
footer: { footer: {
@@ -142,36 +142,36 @@ module.exports = {
{ {
name: bwtitle, name: bwtitle,
value: "**➺ Stars:** `" + value: "**➺ Stars:** `" +
hsbwstars.toFixed(2).toString() + " / " + hsbwstars.toFixed(2).toString() + " / " +
bwstars.toString() + "`\n" + bwstars.toString() + "`\n" +
"**➺ FKDR:** `" + "**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() + hsbwfkdr.toFixed(2).toString() +
" / " + bwfkdr.toString() + "`\n" + " / " + bwfkdr.toString() + "`\n" +
"**➺ Wins:** `" + "**➺ Wins:** `" +
hsbwwins.toString() + " / " + hsbwwins.toString() + " / " +
bwwins.toString() + "`" bwwins.toString() + "`"
}, },
{ {
name: swtitle, name: swtitle,
value: value:
"**➺ Stars:** `" + "**➺ Stars:** `" +
hsswstars.toFixed(2).toString() + hsswstars.toFixed(2).toString() +
" / " + swstars.toString() + "`\n" + " / " + swstars.toString() + "`\n" +
"**➺ KDR:** `" + "**➺ KDR:** `" +
hsswkd.toFixed(2).toString() + "`\n" + hsswkd.toFixed(2).toString() + "`\n" +
"**➺ Wins:** `" + "**➺ Wins:** `" +
hsswwins.toString() + "`" hsswwins.toString() + "`"
}, },
{ {
name: duelstitle, name: duelstitle,
value: "**➺ Wins:** `" + value: "**➺ Wins:** `" +
hsduelswins.toString() + hsduelswins.toString() +
" / " + duelswins.toString() + "`\n" + " / " + duelswins.toString() + "`\n" +
"**➺ WLR:** `" + "**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() + hsduelswlr.toFixed(2).toString() +
" / " + duelswlr.toString() + "`\n" + " / " + duelswlr.toString() + "`\n" +
"**➺ KDR:** `" + "**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() + "`" hsduelskd.toFixed(2).toString() + "`"
} }
] ]
}] }]

View File

@@ -23,9 +23,9 @@ module.exports = {
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/" const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"
const userRoles = guild.members.cache.get(user.id).roles.cache.map(role => role.id); const userRoles = guild.members.cache.get(user.id).roles.cache.map(role => role.id);
if (interaction.customId === 'guildapply') { if (interaction.customId === 'guildapply') {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
if (userRoles.includes(guildRole)) { if (userRoles.includes(guildRole)) {
@@ -39,7 +39,7 @@ module.exports = {
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true }); await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true });
return return
} }
const tooLong = new EmbedBuilder() const tooLong = new EmbedBuilder()
.setDescription("You took too long to respond.") .setDescription("You took too long to respond.")
.setColor(embedColor) .setColor(embedColor)
@@ -54,11 +54,11 @@ module.exports = {
await user.send({ await user.send({
embeds: [{ embeds: [{
title: 'Guild Application', title: 'Guild Application',
description: "Please answer the following questions to apply for the guild.\n" + 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 cancel your application, please press type `cancel` at any time.\n" +
"If you wish to proceed with your application, please type `yes`.\n\n" + "If you wish to proceed with your application, please type `yes`.\n\n" +
"**Do not upload images, videos, or GIFS.**\n" + "**Do not upload images, videos, or GIFS.**\n" +
"You have a minute to respond to this message.", "You have a minute to respond to this message.",
color: embedColor, color: embedColor,
}] }]
}) })
@@ -67,7 +67,7 @@ module.exports = {
return return
} }
await interaction.editReply({ content: "Please check your DMs.", ephemeral: true}) await interaction.editReply({ content: "Please check your DMs.", ephemeral: true })
const input = await user.dmChannel.awaitMessages({ const input = await user.dmChannel.awaitMessages({
@@ -84,17 +84,17 @@ module.exports = {
return return
} }
if (input.first().content.toLowerCase() !== 'yes') { if (input.first().content.toLowerCase() !== 'yes') {
await user.send({ embeds: [cancelled]} ); await user.send({ embeds: [cancelled] });
return return
} }
// first question // first question
const question1 = await user.send({ const question1 = await user.send({
embeds: [{ embeds: [{
title : "**Question 1**", title: "**Question 1**",
description: qu1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", description: qu1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 5 minutes to respond to this message." text: "You have 5 minutes to respond to this message."
} }
}] }]
@@ -123,7 +123,7 @@ module.exports = {
await user.send({ await user.send({
embeds: [{ embeds: [{
description: "That is not a valid Minecraft username.\n" + description: "That is not a valid Minecraft username.\n" +
"Application cancelled.", "Application cancelled.",
color: embedColor color: embedColor
}] }]
}) })
@@ -142,10 +142,10 @@ module.exports = {
// second question // second question
const question2 = await user.send({ const question2 = await user.send({
embeds: [{ 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)`", description: qu2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(8 characters max)`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
@@ -181,10 +181,10 @@ module.exports = {
// third question // third question
const question3 = await user.send({ const question3 = await user.send({
embeds: [{ embeds: [{
title : "**Question 3**", title: "**Question 3**",
description: qu3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", description: qu3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
@@ -219,11 +219,11 @@ module.exports = {
// fourth question // fourth question
const question4 = await user.send({ const question4 = await user.send({
embeds: [{ embeds: [{
title : "**Question 4**", title: "**Question 4**",
description: qu4 + "\n\nPlease type your answer below or type `cancel` to cancel your application." + description: qu4 + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
" `(We expect a longer answer.)`\n`" + largeM + "`", " `(We expect a longer answer.)`\n`" + largeM + "`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
@@ -258,10 +258,10 @@ module.exports = {
// fifth question // fifth question
const question5 = await user.send({ const question5 = await user.send({
embeds: [{ embeds: [{
title : "**Question 5**", title: "**Question 5**",
description: qu5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", description: qu5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
@@ -292,14 +292,14 @@ module.exports = {
return return
} }
const answer5_1 = answer5.first().content const answer5_1 = answer5.first().content
// sixth question // sixth question
const question6 = await user.send({ const question6 = await user.send({
embeds: [{ embeds: [{
title : "**Question 6**", title: "**Question 6**",
description: qu6 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", description: qu6 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
@@ -334,10 +334,10 @@ module.exports = {
// seventh question // seventh question
const question7 = await user.send({ const question7 = await user.send({
embeds: [{ embeds: [{
title : "**Question 7**", title: "**Question 7**",
description: qu7 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", description: qu7 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
@@ -372,10 +372,10 @@ module.exports = {
// eighth question // eighth question
const question8 = await user.send({ const question8 = await user.send({
embeds: [{ 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)`", description: qu8 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
@@ -428,7 +428,7 @@ module.exports = {
return return
} }
if (final.first().content.toLowerCase() !== 'yes') { if (final.first().content.toLowerCase() !== 'yes') {
await user.send({ embeds: [cancelled]} ); await user.send({ embeds: [cancelled] });
return return
} }
@@ -452,7 +452,7 @@ module.exports = {
const channel = guild.channels.cache.get(applicationsChannel); const channel = guild.channels.cache.get(applicationsChannel);
await channel.send({ await channel.send({
embeds: [{ embeds: [{
title: user.username + "#" + user.discriminator + " - Guild Application", title: user.username + "#" + user.discriminator + " - Guild Application",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
@@ -517,4 +517,4 @@ module.exports = {
} }
} }
} }

View File

@@ -52,7 +52,7 @@ module.exports = {
await applicant.send({ await applicant.send({
embeds: [{ embeds: [{
description: `Your application for the Illegitimate guild has been accepted.`, description: `Your application for the Illegitimate guild has been accepted.`,
color: embedColor color: embedColor
}] }]
}); });
@@ -76,7 +76,7 @@ module.exports = {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
title: applicantUsername + " - Guild Application", title: applicantUsername + " - Guild Application",
description: "Application has been accepted by <@" + user.id + ">.", description: "Application has been accepted by <@" + user.id + ">.",
color: embedColor, color: embedColor,
@@ -90,4 +90,4 @@ module.exports = {
}] }]
}); });
} }
}; };

View File

@@ -29,4 +29,4 @@ module.exports = {
) )
await interaction.showModal(modal); await interaction.showModal(modal);
} }
}; };

View File

@@ -6,278 +6,266 @@ const { color, inactivityLogChannel } = require("../../config/options.json");
const guildRoles = [gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole]; const guildRoles = [gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole];
module.exports = { module.exports = {
name: "guildinactivitylog", name: "guildinactivitylog",
description: "Configure the bot.", description: "Configure the bot.",
type: "button", type: "button",
async execute(interaction) { async execute(interaction) {
const guild = interaction.guild; const guild = interaction.guild;
const user = interaction.user; const user = interaction.user;
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"));
const userRoles = guild.members.cache.get(user.id).roles.cache; const userRoles = guild.members.cache.get(user.id).roles.cache;
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"; const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/";
if (!userRoles.some((role) => guildRoles.includes(role.id))) { if (!userRoles.some((role) => guildRoles.includes(role.id))) {
return await interaction.reply({ return await interaction.reply({
content: "Only guild members can use this button.", content: "Only guild members can use this button.",
ephemeral: true ephemeral: true
}); });
} }
const tooLong = new EmbedBuilder() const tooLong = new EmbedBuilder()
.setDescription("You took too long to respond.") .setDescription("You took too long to respond.")
.setColor(embedColor); .setColor(embedColor);
const cancelled = new EmbedBuilder() const cancelled = new EmbedBuilder()
.setDescription("You have cancelled your application.") .setDescription("You have cancelled your application.")
.setColor(embedColor); .setColor(embedColor);
const attachments = new EmbedBuilder() const attachments = new EmbedBuilder()
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
.setColor(embedColor); .setColor(embedColor);
try { try {
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "Guild Inactivity Log",
title: "Guild Inactivity Log", description: "Please answer the following questions to submit an inactivity log for the guild.\n" +
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 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" +
"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.",
"You have a minute to respond to this message.", color: embedColor
color: embedColor }]
} });
] } catch (error) {
}); return await interaction.reply({ content: "Please enable your DMs.", ephemeral: true });
} 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({ const input = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id, filter: (m) => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 time: 1000 * 60
}); });
if (input.first().attachments.size > 0) { if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] });
return; return;
} }
if (input.size === 0) { if (input.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] });
return; return;
} }
if (input.first().content.toLowerCase() !== "yes") { if (input.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] });
return; return;
} }
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 1**",
title: "**Question 1**", description: ia1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
description: ia1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", color: embedColor,
color: embedColor, footer: {
footer: { text: "You have 5 minutes to respond to this message."
text: "You have 5 minutes to respond to this message." }
} }]
} });
]
});
const answer1 = await user.dmChannel.awaitMessages({ const answer1 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id, filter: (m) => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5 time: 1000 * 60 * 5
}); });
if (answer1.first().attachments.size > 0) { if (answer1.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] });
return; return;
} }
if (answer1.first().content > 16) { if (answer1.first().content > 16) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 16.",
description: "Max character limit is 16.", color: embedColor
color: embedColor }]
} });
] return;
}); }
return; try {
} await fetch(mojangAPI + answer1.first().content);
try { } catch (error) {
await fetch(mojangAPI + answer1.first().content); await user.send({
} catch (error) { embeds: [{
await user.send({ description: "That is not a valid Minecraft username.\n" + "Application cancelled.",
embeds: [ color: embedColor
{ }]
description: "That is not a valid Minecraft username.\n" + "Application cancelled.", });
color: embedColor return;
} }
] if (answer1.size === 0) {
}); await user.send({ embeds: [tooLong] });
return; return;
} }
if (answer1.size === 0) { if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [cancelled] });
return; return;
} }
if (answer1.first().content.toLowerCase() === "cancel") { const answer1_1 = answer1.first().content;
await user.send({ embeds: [cancelled] });
return;
}
const answer1_1 = answer1.first().content;
await user.send({ await user.send({
embeds: [{ embeds: [{
title: "**Question 2**", title: "**Question 2**",
description: ia2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", description: ia2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor, color: embedColor,
footer: { footer: {
text: "You have 5 minutes to respond to this message." text: "You have 5 minutes to respond to this message."
} }
}] }]
}); });
const answer2 = await user.dmChannel.awaitMessages({ const answer2 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id, filter: (m) => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5 time: 1000 * 60 * 5
}); });
if (answer2.first().attachments.size > 0) { if (answer2.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] });
return; return;
} }
if (answer2.first().content > 128) { if (answer2.first().content > 128) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 128.",
description: "Max character limit is 128.", color: embedColor
color: embedColor }]
} });
] return;
}); }
return; if (answer1.size === 0) {
} await user.send({ embeds: [tooLong] });
if (answer1.size === 0) { return;
await user.send({ embeds: [tooLong] }); }
return; if (answer1.first().content.toLowerCase() === "cancel") {
} await user.send({ embeds: [cancelled] });
if (answer1.first().content.toLowerCase() === "cancel") { return;
await user.send({ embeds: [cancelled] }); }
return; const answer2_1 = answer1.first().content;
}
const answer2_1 = answer1.first().content;
await user.send({ await user.send({
embeds: [{ embeds: [{
title: "**Question 3**", title: "**Question 3**",
description: ia3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", description: ia3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
color: embedColor, color: embedColor,
footer: { footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
}); });
const answer3 = await user.dmChannel.awaitMessages({ const answer3 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id, filter: (m) => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); });
if (answer3.first().attachments.size > 0) { if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] });
return; return;
} }
if (answer3.first().content > 256) { if (answer3.first().content > 256) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 256",
description: "Max character limit is 256", color: embedColor
color: embedColor }]
} });
] return;
}); }
return; if (answer1.size === 0) {
} await user.send({ embeds: [tooLong] });
if (answer1.size === 0) { return;
await user.send({ embeds: [tooLong] }); }
return; if (answer1.first().content.toLowerCase() === "cancel") {
} await user.send({ embeds: [cancelled] });
if (answer1.first().content.toLowerCase() === "cancel") { return;
await user.send({ embeds: [cancelled] }); }
return; const answer3_1 = answer1.first().content;
}
const answer3_1 = answer1.first().content;
await user.send({ await user.send({
embeds: [{ embeds: [{
description: "If you want to submit your application, type `yes` if not, type `no`", description: "If you want to submit your application, type `yes` if not, type `no`",
color: embedColor color: embedColor
}] }]
}) })
const final = await user.dmChannel.awaitMessages({ const final = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5 time: 1000 * 60 * 5
}); });
if (final.first().attachments.size > 0) { if (final.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] });
return 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),
)
]
});
}
}; };

View File

@@ -1,11 +1,11 @@
module.exports = { module.exports = {
name: "inactiveapplicationaccept", name: "inactiveapplicationaccept",
description: "Accept an inactivity application.", description: "Accept an inactivity application.",
type: "button", type: "button",
async execute(interaction) {
await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); async execute(interaction) {
} await interaction.reply({ content: "This button is currently disabled.", ephemeral: true });
}
}
}

View File

@@ -1,11 +1,11 @@
module.exports = { module.exports = {
name: "inactiveapplicationdeny", name: "inactiveapplicationdeny",
description: "Denies an inactivity application.", description: "Denies an inactivity application.",
type: "button", type: "button",
async execute(interaction) {
await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); async execute(interaction) {
} await interaction.reply({ content: "This button is currently disabled.", ephemeral: true });
}
}
}

View File

@@ -10,7 +10,6 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
const user = interaction.user; const user = interaction.user;
const channel = interaction.channel;
const guild = interaction.guild; const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"));
@@ -63,4 +62,4 @@ module.exports = {
}); });
} }
} }

View File

@@ -22,4 +22,4 @@ module.exports = {
) )
await interaction.showModal(modal); await interaction.showModal(modal);
} }
}; };

View File

@@ -27,22 +27,22 @@ module.exports = {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
if (!userRoles.has(guildRole)) { 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 return
} }
if (userRoles.has(guildStaff)) { 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 return
} }
const application = await staffapp.findOne({ userID: user.id }); const application = await staffapp.findOne({ userID: user.id });
if (application) { if (application) {
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true }); await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true });
return return
} }
const tooLong = new EmbedBuilder() const tooLong = new EmbedBuilder()
.setDescription("You took too long to respond.") .setDescription("You took too long to respond.")
.setColor(embedColor) .setColor(embedColor)
@@ -52,386 +52,385 @@ module.exports = {
const attachments = new EmbedBuilder() const attachments = new EmbedBuilder()
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
.setColor(embedColor) .setColor(embedColor)
try { try {
await user.send({ await user.send({
embeds: [{ embeds: [{
title: 'Staff Application', title: 'Staff Application',
description: "Please answer the following questions to apply for staff.\n" + 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 cancel your application, please press type `cancel` at any time.\n" +
"If you wish to proceed with your application, please type `yes`.\n\n" + "If you wish to proceed with your application, please type `yes`.\n\n" +
"**Do not upload images, videos, or GIFS.**\n" + "**Do not upload images, videos, or GIFS.**\n" +
"You have a minute to respond to this message.", "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, color: embedColor,
footer:{
text: "You have 5 minutes to respond to this message."
}
}] }]
}) })
const answer1 = await user.dmChannel.awaitMessages({ } catch (error) {
filter: m => m.author.id === user.id, await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true });
max: 1, return
time: 1000 * 60 * 5, }
});
if (answer1.first().attachments.size > 0) { await interaction.editReply({ content: "Please check your DMs.", ephemeral: true })
await user.send({ embeds: [attachments] });
return const input = await user.dmChannel.awaitMessages({
} filter: m => m.author.id === user.id,
if (answer1.first().content > 16) { max: 1,
await user.send({ time: 1000 * 60
embeds: [{ });
description: "Max character limit is 16.", if (input.first().attachments.size > 0) {
color: embedColor await user.send({ embeds: [attachments] });
}] return
}) }
return if (input.size === 0) {
} await user.send({ embeds: [tooLong] });
try { return
await fetch(mojangAPI + answer1.first().content) }
} catch (error) { if (input.first().content.toLowerCase() !== 'yes') {
await user.send({ await user.send({ embeds: [cancelled] });
embeds: [{ return
description: "That is not a valid Minecraft username.\n" + }
// 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.", "Application cancelled.",
color: embedColor color: embedColor
}]
})
return
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] })
return
}
if (answer1.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
}
const answer1_1 = answer1.first().content
// second question
const question2 = await user.send({
embeds: [{
title : "**Question 2**",
description: sq2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}] }]
}) })
const answer2 = await user.dmChannel.awaitMessages({ return
filter: m => m.author.id === user.id, }
max: 1, if (answer1.size === 0) {
time: 1000 * 60 * 15 await user.send({ embeds: [tooLong] })
}); return
if (answer2.first().attachments.size > 0) { }
await user.send({ embeds: [attachments] }); if (answer1.first().content.toLowerCase() === 'cancel') {
return await user.send({ embeds: [cancelled] })
} return
if (answer2.first().content > 64) { }
await user.send({ const answer1_1 = answer1.first().content
embeds: [{
description: "Max character limit is 64.", // second question
color: embedColor const question2 = await user.send({
}] embeds: [{
}) title: "**Question 2**",
return description: sq2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`",
} color: embedColor,
if (answer2.size === 0) { footer: {
await user.send({ embeds: [tooLong] }) text: "You have 15 minutes to respond to this message."
return }
} }]
if (answer2.first().content.toLowerCase() === 'cancel') { })
await user.send({ embeds: [cancelled] }) const answer2 = await user.dmChannel.awaitMessages({
return filter: m => m.author.id === user.id,
} max: 1,
const answer2_1 = answer2.first().content time: 1000 * 60 * 15
});
// third question if (answer2.first().attachments.size > 0) {
const question3 = await user.send({ await user.send({ embeds: [attachments] });
return
}
if (answer2.first().content > 64) {
await user.send({
embeds: [{ embeds: [{
title : "**Question 3**", description: "Max character limit is 64.",
description: sq3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", color: embedColor
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}] }]
}) })
const answer3 = await user.dmChannel.awaitMessages({ return
filter: m => m.author.id === user.id, }
max: 1, if (answer2.size === 0) {
time: 1000 * 60 * 15 await user.send({ embeds: [tooLong] })
}); return
if (answer3.first().attachments.size > 0) { }
await user.send({ embeds: [attachments] }); if (answer2.first().content.toLowerCase() === 'cancel') {
return await user.send({ embeds: [cancelled] })
} return
if (answer3.first().content > 256) { }
await user.send({ const answer2_1 = answer2.first().content
embeds: [{
description: "Max character limit is 256.", // third question
color: embedColor 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 + "`",
if (answer3.size === 0) { color: embedColor,
await user.send({ embeds: [tooLong] }) footer: {
return text: "You have 15 minutes to respond to this message."
} }
if (answer3.first().content.toLowerCase() === 'cancel') { }]
await user.send({ embeds: [cancelled] }) })
return const answer3 = await user.dmChannel.awaitMessages({
} filter: m => m.author.id === user.id,
const answer3_1 = answer3.first().content max: 1,
time: 1000 * 60 * 15
// fourth question });
const question4 = await user.send({ if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
}
if (answer3.first().content > 256) {
await user.send({
embeds: [{ embeds: [{
title : "**Question 4**", description: "Max character limit is 256.",
description: sq4 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", color: embedColor
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, if (answer3.size === 0) {
max: 1, await user.send({ embeds: [tooLong] })
time: 1000 * 60 * 15 return
}); }
if (answer4.first().attachments.size > 0) { if (answer3.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [cancelled] })
return return
} }
if (answer4.first().content > 256) { const answer3_1 = answer3.first().content
await user.send({
embeds: [{ // fourth question
description: "Max character limit is 256.", const question4 = await user.send({
color: embedColor embeds: [{
}] title: "**Question 4**",
}) description: sq4 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
} color: embedColor,
if (answer4.size === 0) { footer: {
await user.send({ embeds: [tooLong] }) text: "You have 15 minutes to respond to this message."
return }
} }]
if (answer4.first().content.toLowerCase() === 'cancel') { })
await user.send({ embeds: [cancelled] }) const answer4 = await user.dmChannel.awaitMessages({
return filter: m => m.author.id === user.id,
} max: 1,
const answer4_1 = answer4.first().content time: 1000 * 60 * 15
});
// fifth question if (answer4.first().attachments.size > 0) {
const question5 = await user.send({ await user.send({ embeds: [attachments] });
return
}
if (answer4.first().content > 256) {
await user.send({
embeds: [{ embeds: [{
title : "**Question 5**", description: "Max character limit is 256.",
description: sq5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", color: embedColor
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, if (answer4.size === 0) {
max: 1, await user.send({ embeds: [tooLong] })
time: 1000 * 60 * 15 return
}); }
if (answer5.first().attachments.size > 0) { if (answer4.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [cancelled] })
return return
} }
if (answer5.first().content > 256) { const answer4_1 = answer4.first().content
await user.send({
embeds: [{ // fifth question
description: "Max character limit is 256.", const question5 = await user.send({
color: embedColor embeds: [{
}] title: "**Question 5**",
}) description: sq5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
} color: embedColor,
if (answer5.size === 0) { footer: {
await user.send({ embeds: [tooLong] }) text: "You have 15 minutes to respond to this message."
return }
} }]
if (answer5.first().content.toLowerCase() === 'cancel') { })
await user.send({ embeds: [cancelled] }) const answer5 = await user.dmChannel.awaitMessages({
return filter: m => m.author.id === user.id,
} max: 1,
const answer5_1 = answer5.first().content time: 1000 * 60 * 15
});
// sixth question if (answer5.first().attachments.size > 0) {
const question6 = await user.send({ await user.send({ embeds: [attachments] });
return
}
if (answer5.first().content > 256) {
await user.send({
embeds: [{ embeds: [{
title : "**Question 6**", description: "Max character limit is 256.",
description: sq6 + "\n\nPlease type your answer below or type `cancel` to cancel your application." + 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 + "`", "`(We expect a longer answer here)`\n`" + largeM + "`",
color: embedColor, color: embedColor,
footer:{ footer: {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
}) })
const answer6 = await user.dmChannel.awaitMessages({ const answer6 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); });
if (answer6.first().attachments.size > 0) { if (answer6.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] });
return return
} }
if (answer6.first().content > 256) { if (answer6.first().content > 256) {
await user.send({
embeds: [{
description: "Max character limit is 256.",
color: embedColor
}]
})
}
if (answer6.size === 0) {
await user.send({ embeds: [tooLong] })
return
}
if (answer6.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
}
const answer6_1 = answer6.first().content
await user.send({ await user.send({
embeds: [{ embeds: [{
description: "If you want to submit your application, type `yes` if not, type `no`", description: "Max character limit is 256.",
color: embedColor
}]
})
const final = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5
});
if (final.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
}
if (final.size === 0) {
await user.send({ embeds: [tooLong] });
return
}
if (final.first().content.toLowerCase() !== 'yes') {
await user.send({ embeds: [cancelled]} );
return
}
await user.send({
embeds: [{
description: "Your application has been submitted!",
color: embedColor color: embedColor
}] }]
}) })
}
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) await user.send({
const uuid = userCheck.data.id embeds: [{
description: "If you want to submit your application, type `yes` if not, type `no`",
color: embedColor
}]
})
const newStaffApp = new staffapp({ const final = await user.dmChannel.awaitMessages({
_id: new mongoose.Types.ObjectId(), filter: m => m.author.id === user.id,
userID: user.id, max: 1,
uuid: uuid, 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.send({
await user.deleteDM(); 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({ const newStaffApp = new staffapp({
embeds: [{ _id: new mongoose.Types.ObjectId(),
title: user.username + "#" + user.discriminator + " - Staff Application", userID: user.id,
color: embedColor, uuid: uuid,
thumbnail: { })
url: user.avatarURL()
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: rsq2,
name: rsq1, value: "```" + answer2_1 + "```"
value: "```" + answer1_1 + "```" },
}, {
{ name: rsq3,
name: rsq2, value: "```" + answer3_1 + "```"
value: "```" + answer2_1 + "```" },
}, {
{ name: rsq4,
name: rsq3, value: "```" + answer4_1 + "```"
value: "```" + answer3_1 + "```" },
}, {
{ name: rsq5,
name: rsq4, value: "```" + answer5_1 + "```"
value: "```" + answer4_1 + "```" },
}, {
{ name: rsq6,
name: rsq5, value: "```" + answer6_1 + "```"
value: "```" + answer5_1 + "```"
},
{
name: rsq6,
value: "```" + answer6_1 + "```"
}
],
footer: {
iconURL: guild.iconURL(),
text: "ID: " + user.id
} }
}],
components: [ ],
new ActionRowBuilder().addComponents( footer: {
new ButtonBuilder() iconURL: guild.iconURL(),
.setCustomId("staffapplicationaccept") text: "ID: " + user.id
.setLabel("Accept") }
.setStyle(ButtonStyle.Primary), }],
new ButtonBuilder() components: [
.setCustomId("staffapplicationdeny") new ActionRowBuilder().addComponents(
.setLabel("Deny") new ButtonBuilder()
.setStyle(ButtonStyle.Danger) .setCustomId("staffapplicationaccept")
) .setLabel("Accept")
] .setStyle(ButtonStyle.Primary),
} new ButtonBuilder()
); .setCustomId("staffapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger)
)
]
});
} }
} }
} }

View File

@@ -2,27 +2,27 @@ const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = req
const { color } = require('../../config/options.json') const { color } = require('../../config/options.json')
module.exports = { module.exports = {
name: 'verify', name: 'verify',
description: 'Configure the bot.', description: 'Configure the bot.',
type: 'button', type: 'button',
async execute(interaction) { async execute(interaction) {
const modal = new ModalBuilder() const modal = new ModalBuilder()
.setTitle("Verification") .setTitle("Verification")
.setCustomId("verifybox") .setCustomId("verifybox")
.setComponents( .setComponents(
new ActionRowBuilder().setComponents( new ActionRowBuilder().setComponents(
new TextInputBuilder() new TextInputBuilder()
.setLabel("IGN") .setLabel("IGN")
.setCustomId("verifyfield") .setCustomId("verifyfield")
.setStyle(TextInputStyle.Short) .setStyle(TextInputStyle.Short)
.setPlaceholder("Enter your ign.") .setPlaceholder("Enter your ign.")
.setRequired(true) .setRequired(true)
.setMinLength(3) .setMinLength(3)
.setMaxLength(16) .setMaxLength(16)
)
) )
) await interaction.showModal(modal)
await interaction.showModal(modal) }
}
} }

View File

@@ -6,18 +6,18 @@ const { hypixelGuildID } = require("../../config/options.json")
const fetch = require("axios"); const fetch = require("axios");
module.exports = { module.exports = {
name: 'waitinglistupdate', name: 'waitinglistupdate',
description: 'Update the waiting list.', description: 'Update the waiting list.',
type: 'button', type: 'button',
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const user = interaction.user; const user = interaction.user;
const message = interaction.message; const message = interaction.message;
const embed = message.embeds[0]; const embed = message.embeds[0];
const accepted = await waitinglist.find() const accepted = await waitinglist.find()
const guildAPI = "https://api.hypixel.net/guild" const guildAPI = "https://api.hypixel.net/guild"
const guild = guildAPI + "?key=" + key + "&player=" 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 timestamp1 = accepted[i].timestamp / 1000
const timestamp = Math.floor(timestamp1) const timestamp = Math.floor(timestamp1)
fields.push({ fields.push({
name: `${i + 1}. ${accepted[i].IGN}`, name: `${i + 1}. ${accepted[i].IGN}`,
value: `TS: <t:${timestamp}:R>` value: `TS: <t:${timestamp}:R>`
}); });
} }
await message.edit({ await message.edit({
embeds: [{ embeds: [{
title: embed.title, title: embed.title,
description: embed.description, description: embed.description,
color: embed.color, color: embed.color,
footer: { footer: {
text: "Last updated by " + user.username, text: "Last updated by " + user.username,
icon_url: user.avatarURL(), icon_url: user.avatarURL(),
}, },
thumbnail: embed.thumbnail, thumbnail: embed.thumbnail,
fields: fields, fields: fields,
timestamp: new Date(), timestamp: new Date(),
}], }],
}); });
await interaction.editReply({ content: 'Updated the waiting list', ephemeral: true }); await interaction.editReply({ content: 'Updated the waiting list', ephemeral: true });
} }
} }

View File

@@ -11,12 +11,12 @@ module.exports = {
type: 'modal', type: 'modal',
async execute(interaction) { async execute(interaction) {
if (interaction.type !== InteractionType.ModalSubmit) return; if (interaction.type !== InteractionType.ModalSubmit) return;
if (interaction.customId !== "denyreasonbox") return; if (interaction.customId !== "denyreasonbox") return;
interaction.deferReply(); interaction.deferReply();
const guild = interaction.guild; const guild = interaction.guild;
const message = interaction.message; const message = interaction.message;
@@ -52,7 +52,7 @@ module.exports = {
const dmMessage = new EmbedBuilder() const dmMessage = new EmbedBuilder()
.setDescription("Your application for the Illegitimate guild has been denied\n" + .setDescription("Your application for the Illegitimate guild has been denied\n" +
"**Reason:** `" + reason + "`") "**Reason:** `" + reason + "`")
.setColor(embedColor); .setColor(embedColor);
await applicant.send({ embeds: [dmMessage] }); await applicant.send({ embeds: [dmMessage] });
@@ -62,8 +62,8 @@ module.exports = {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
title: "Application Denied", title: "Application Denied",
description: "The application has been denied by <@" + interaction.user.id + ">.\n" + description: "The application has been denied by <@" + interaction.user.id + ">.\n" +
"**Reason:** `" + reason + "`", "**Reason:** `" + reason + "`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: applicant.avatarURL() url: applicant.avatarURL()
@@ -75,4 +75,4 @@ module.exports = {
}], }],
}); });
} }
} }

View File

@@ -11,12 +11,12 @@ module.exports = {
type: 'modal', type: 'modal',
async execute(interaction) { async execute(interaction) {
if (interaction.type !== InteractionType.ModalSubmit) return; if (interaction.type !== InteractionType.ModalSubmit) return;
if (interaction.customId !== "staffdenyreasonbox") return; if (interaction.customId !== "staffdenyreasonbox") return;
interaction.deferReply(); interaction.deferReply();
const channel = interaction.channel; const channel = interaction.channel;
const guild = interaction.guild; const guild = interaction.guild;
const reason = interaction.fields.fields.get('staffdenyreason').value || "No reason provided"; const reason = interaction.fields.fields.get('staffdenyreason').value || "No reason provided";
@@ -46,7 +46,7 @@ module.exports = {
const dmMessage = new EmbedBuilder() const dmMessage = new EmbedBuilder()
.setDescription("Your application for the Illegitimate guild staff has been denied\n" + .setDescription("Your application for the Illegitimate guild staff has been denied\n" +
"**Reason:** `" + reason + "`") "**Reason:** `" + reason + "`")
.setColor(embedColor); .setColor(embedColor);
await applicant.send({ embeds: [dmMessage] }); await applicant.send({ embeds: [dmMessage] });
@@ -56,8 +56,8 @@ module.exports = {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
title: "Application Denied", title: "Application Denied",
description: "The application has been denied by <@" + interaction.user.id + ">.\n" + description: "The application has been denied by <@" + interaction.user.id + ">.\n" +
"**Reason:** `" + reason + "`", "**Reason:** `" + reason + "`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: applicant.avatarURL() url: applicant.avatarURL()
@@ -69,4 +69,4 @@ module.exports = {
}], }],
});; });;
} }
} }

View File

@@ -203,13 +203,14 @@ client.on(Events.ClientReady, () => {
embeds: [{ embeds: [{
description: `Bot is online!`, description: `Bot is online!`,
color: embedColor color: embedColor
}] }]
}); });
}); });
client.on(Events.ClientReady, () => { client.on(Events.ClientReady, () => {
client.user.setActivity( client.user.setActivity(
{ name: "over the Illegitimate Server", type: ActivityType.Watching }); { name: "over the Illegitimate Server", type: ActivityType.Watching }
);
const activities = [ const activities = [
{ name: "for Martina's return", type: ActivityType.Watching }, { name: "for Martina's return", type: ActivityType.Watching },
@@ -229,9 +230,11 @@ client.on(Events.ClientReady, () => {
1000 * 60 * 30 1000 * 60 * 30
) )
}); });
client.on(Events.ClientReady, () => { client.on(Events.ClientReady, () => {
client.user.setStatus('dnd'); client.user.setStatus('dnd');
}); });
client.login(token); client.login(token);
connect(mongoURI, {}).then(() => { connect(mongoURI, {}).then(() => {

View File

@@ -6,4 +6,4 @@ const guildAppSchema = new Schema({
uuid: { type: String, required: true }, uuid: { type: String, required: true },
}); });
module.exports = model('guildapp', guildAppSchema, 'guildapp'); module.exports = model('guildapp', guildAppSchema, 'guildapp');

View File

@@ -6,4 +6,4 @@ const staffAppSchema = new Schema({
uuid: { type: String, required: true }, uuid: { type: String, required: true },
}); });
module.exports = model('staffapp', staffAppSchema, 'staffapp'); module.exports = model('staffapp', staffAppSchema, 'staffapp');

View File

@@ -6,4 +6,4 @@ const verifySchema = new Schema({
uuid: { type: String, required: true }, uuid: { type: String, required: true },
}); });
module.exports = model('verify', verifySchema, 'verify'); module.exports = model('verify', verifySchema, 'verify');

View File

@@ -8,80 +8,80 @@ const args = process.argv.slice(2);
const arg = args[0]; const arg = args[0];
if (!arg) { if (!arg) {
console.log('Please specify a command to run!'); console.log('Please specify a command to run!');
} }
else if (arg === '--prod') { else if (arg === '--prod') {
const commands = []; const commands = [];
// Grab all the command files from the commands directory you created earlier // Grab all the command files from the commands directory you created earlier
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
const contentMenuCommands = fs.readdirSync('./commands-contextmenu').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 // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`../commands/${file}`); const command = require(`../commands/${file}`);
commands.push(command.data.toJSON()); commands.push(command.data.toJSON());
} }
for (const file of contentMenuCommands) { for (const file of contentMenuCommands) {
const command = require(`../commands-contextmenu/${file}`); const command = require(`../commands-contextmenu/${file}`);
commands.push(command.data.toJSON()); commands.push(command.data.toJSON());
} }
// Construct and prepare an instance of the REST module // Construct and prepare an instance of the REST module
const rest = new REST({ version: '10' }).setToken(token); const rest = new REST({ version: '10' }).setToken(token);
// and deploy your commands! // and deploy your commands!
(async () => { (async () => {
try { try {
console.log(`Started refreshing ${commands.length} application (/) commands.`); 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 // The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put( const data = await rest.put(
Routes.applicationCommands(clientId), Routes.applicationCommands(clientId),
{ body: commands }, { body: commands },
); );
console.log(`Successfully reloaded ${data.length} application (/) commands.`); console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) { } catch (error) {
// And of course, make sure you catch and log any errors! // And of course, make sure you catch and log any errors!
console.error(error); console.error(error);
} }
})(); })();
} }
else if (arg === '--dev') { else if (arg === '--dev') {
const commands = []; const commands = [];
// Grab all the command files from the commands directory you created earlier // Grab all the command files from the commands directory you created earlier
const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js')); const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`../commands-testing/${file}`); const command = require(`../commands-testing/${file}`);
commands.push(command.data.toJSON()); commands.push(command.data.toJSON());
} }
// Construct and prepare an instance of the REST module // Construct and prepare an instance of the REST module
const rest = new REST({ version: '10' }).setToken(token); const rest = new REST({ version: '10' }).setToken(token);
// and deploy your commands! // and deploy your commands!
(async () => { (async () => {
try { try {
console.log(`Started refreshing ${commands.length} application (/) commands.`); 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 // The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put( const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId), Routes.applicationGuildCommands(clientId, guildId),
{ body: commands }, { body: commands },
); );
console.log(`Successfully reloaded ${data.length} application (/) commands.`); console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) { } catch (error) {
// And of course, make sure you catch and log any errors! // And of course, make sure you catch and log any errors!
console.error(error); console.error(error);
} }
})(); })();
} }
else if (arg && arg !== '--prod' && arg !== '--dev') { else if (arg && arg !== '--prod' && arg !== '--dev') {
console.log('Invalid argument!'); console.log('Invalid argument!');
} }

View File

@@ -9,13 +9,13 @@ const commands = [];
// const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js')); // const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js'));
const commandFiles = [ const commandFiles = [
'./commands/config.js', './commands/config.js',
] ]
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`${file}`); const command = require(`${file}`);
commands.push(command.data.toJSON()); commands.push(command.data.toJSON());
} }
// Construct and prepare an instance of the REST module // 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! // and deploy your commands!
(async () => { (async () => {
try { try {
console.log(`Started refreshing ${commands.length} application (/) commands.`); 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 // The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put( const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId), Routes.applicationGuildCommands(clientId, guildId),
{ body: commands }, { body: commands },
); );
console.log(`Successfully reloaded ${data.length} application (/) commands.`); console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) { } catch (error) {
// And of course, make sure you catch and log any errors! // And of course, make sure you catch and log any errors!
console.error(error); console.error(error);
} }
})(); })();

View File

@@ -1,109 +1,111 @@
/* ---------- bedwars level ---------- */ /* ---------- bedwars level ---------- */
function getExpForLevel(level){ function getExpForLevel(level) {
if(level == 0) return 0; if (level == 0) return 0;
var respectedLevel = getLevelRespectingPrestige(level); var respectedLevel = getLevelRespectingPrestige(level);
if(respectedLevel > EASY_LEVELS){ if (respectedLevel > EASY_LEVELS) {
return 5000; return 5000;
} }
switch(respectedLevel){ switch (respectedLevel) {
case 1: case 1:
return 500; return 500;
case 2: case 2:
return 1000; return 1000;
case 3: case 3:
return 2000; return 2000;
case 4: case 4:
return 3500; return 3500;
} }
return 5000; return 5000;
} }
function getLevelRespectingPrestige(level){ function getLevelRespectingPrestige(level) {
if(level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE){ if (level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE) {
return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE; return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE;
} }
else { else {
return level % LEVELS_PER_PRESTIGE; return level % LEVELS_PER_PRESTIGE;
} }
} }
const EASY_LEVELS = 4; const EASY_LEVELS = 4;
const EASY_LEVELS_XP = 7000; const EASY_LEVELS_XP = 7000;
const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP; const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP;
const LEVELS_PER_PRESTIGE = 100; const LEVELS_PER_PRESTIGE = 100;
const HIGHEST_PRESTIGE = 50; const HIGHEST_PRESTIGE = 50;
function getLevelForExp(exp){ function getLevelForExp(exp) {
var prestiges = Math.floor(exp / XP_PER_PRESTIGE); var prestiges = Math.floor(exp / XP_PER_PRESTIGE);
var level = prestiges * LEVELS_PER_PRESTIGE; var level = prestiges * LEVELS_PER_PRESTIGE;
var expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE); var expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE);
for(let i = 1; i <= EASY_LEVELS; ++i){ for (let i = 1; i <= EASY_LEVELS; ++i) {
var expForEasyLevel = getExpForLevel(i); var expForEasyLevel = getExpForLevel(i);
if(expWithoutPrestiges < expForEasyLevel){ if (expWithoutPrestiges < expForEasyLevel) {
break; break;
} }
level++; level++;
expWithoutPrestiges -= expForEasyLevel; expWithoutPrestiges -= expForEasyLevel;
} }
return level + expWithoutPrestiges / 5000 return level + expWithoutPrestiges / 5000
} }
// hypixel // hypixel
const BASE = 10000; const BASE = 10000;
const GROWTH = 2500; const GROWTH = 2500;
const HALF_GROWTH = 0.5 * GROWTH; const HALF_GROWTH = 0.5 * GROWTH;
const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH; const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH;
const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX; const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX;
const GROWTH_DIVIDES_2 = 2 / GROWTH; const GROWTH_DIVIDES_2 = 2 / GROWTH;
function getLevel(exp) { 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) { function getExactLevel(exp) {
return getLevel(exp) + getPercentageToNextLevel(exp); return getLevel(exp) + getPercentageToNextLevel(exp);
} }
function getExpFromLevelToNext(level) { function getExpFromLevelToNext(level) {
return level < 1 ? BASE : GROWTH * (level - 1) + BASE; return level < 1 ? BASE : GROWTH * (level - 1) + BASE;
} }
function getTotalExpToLevel(level) { function getTotalExpToLevel(level) {
const lv = Math.floor(level); const const lv = Math.floor(level); const
x0 = getTotalExpToFullLevel(lv); x0 = getTotalExpToFullLevel(lv);
if (level === lv) return x0; if (level === lv) return x0;
return (getTotalExpToFullLevel(lv + 1) - x0) * (level % 1) + x0; return (getTotalExpToFullLevel(lv + 1) - x0) * (level % 1) + x0;
} }
function getTotalExpToFullLevel(level) { function getTotalExpToFullLevel(level) {
return (HALF_GROWTH * (level - 2) + BASE) * (level - 1); return (HALF_GROWTH * (level - 2) + BASE) * (level - 1);
} }
function getPercentageToNextLevel(exp) { function getPercentageToNextLevel(exp) {
const lv = getLevel(exp); const lv = getLevel(exp);
const x0 = getTotalExpToLevel(lv); const x0 = getTotalExpToLevel(lv);
return (exp - x0) / (getTotalExpToLevel(lv + 1) - x0); return (exp - x0) / (getTotalExpToLevel(lv + 1) - x0);
} }
/* ---------- skywars level ---------- */ /* ---------- skywars level ---------- */
function skywarsLevel(xp) { function skywarsLevel(xp) {
var xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000]; var xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000];
let exactLevel = 0 let exactLevel = 0
if (xp >= 15000) { if (xp >= 15000) {
exactLevel = (xp - 15000) / 10000 + 12; exactLevel = (xp - 15000) / 10000 + 12;
return exactLevel; return exactLevel;
} else { } else {
for (i = 0; i < xps.length; i++) { for (i = 0; i < xps.length; i++) {
if (xp < xps[i]) { if (xp < xps[i]) {
exactLevel = i + (xp - xps[i-1]) / (xps[i] - xps[i-1]); exactLevel = i + (xp - xps[i - 1]) / (xps[i] - xps[i - 1]);
return exactLevel; return exactLevel;
} }
} }
} }
} }
module.exports = { module.exports = {
getExactLevel, getExactLevel,
skywarsLevel, skywarsLevel,
getLevelForExp getLevelForExp
} }