Making all files use prettier

Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
2023-08-31 13:22:52 +02:00
parent 593f5544f7
commit 5aa85986cd
49 changed files with 4020 additions and 3779 deletions

View File

@@ -1,30 +1,29 @@
const { color } = require('../../config/options.json');
const fetch = require('axios');
const guildapp = require('../../schemas/guildAppSchema.js');
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require('../../config/reqs.json');
const { color } = require("../../config/options.json");
const fetch = require("axios");
const guildapp = require("../../schemas/guildAppSchema.js");
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../config/reqs.json");
const env = require("dotenv").config();
const hypixelApiKey = process.env.HYPIXELAPIKEY;
const { getExactLevel, skywarsLevel, getLevelForExp } = require("../../utils/functions.js");
module.exports = {
name: 'checkstats',
description: 'Check your stats.',
type: 'button',
name: "checkstats",
description: "Check your stats.",
type: "button",
async execute(interaction) {
await interaction.deferReply();
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1]
const applicantId = embed.footer.text.split(" ")[1];
const guildappdata = await guildapp.findOne({ userID: applicantId })
const guildappdata = await guildapp.findOne({ userID: applicantId });
const uuid = guildappdata.uuid;
const mojang = "https://api.mojang.com/user/profile/"
const hypixel = "https://api.hypixel.net/player"
const guildAPI = "https://api.hypixel.net/guild"
const mojang = "https://api.mojang.com/user/profile/";
const hypixel = "https://api.hypixel.net/player";
const guildAPI = "https://api.hypixel.net/guild";
const minotar = "https://minotar.net/helm/";
const embedColor = Number(color.replace("#", "0x"));
@@ -32,15 +31,17 @@ module.exports = {
const ign = userCheck.data.name;
const head = minotar + ign;
const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid
const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid;
const stats = await fetch(player);
if (!stats.data.player) {
interaction.editReply({
embeds: [{
description: "That player hasn't played Hypixel before.",
color: embedColor
}]
embeds: [
{
description: "That player hasn't played Hypixel before.",
color: embedColor,
},
],
});
return;
}
@@ -48,19 +49,19 @@ module.exports = {
const rank2 = stats.data.player.newPackageRank;
const monthlyRank = stats.data.player.monthlyPackageRank;
if (rank2 === 'VIP') {
var rank = "[VIP] "
} else if (rank2 === 'VIP_PLUS') {
var rank = "[VIP+] "
} else if (rank2 === 'MVP') {
var rank = "[MVP] "
} else if (rank2 === 'MVP_PLUS' && monthlyRank === 'NONE') {
var rank = "[MVP+] "
} else if (rank2 === 'MVP_PLUS' && monthlyRank === 'SUPERSTAR') {
var rank = "[MVP++] "
if (rank2 === "VIP") {
var rank = "[VIP] ";
} else if (rank2 === "VIP_PLUS") {
var rank = "[VIP+] ";
} else if (rank2 === "MVP") {
var rank = "[MVP] ";
} else if (rank2 === "MVP_PLUS" && monthlyRank === "NONE") {
var rank = "[MVP+] ";
} else if (rank2 === "MVP_PLUS" && monthlyRank === "SUPERSTAR") {
var rank = "[MVP++] ";
}
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid;
const guildCheck = await fetch(guild);
if (!guildCheck.data.guild) {
@@ -70,11 +71,11 @@ module.exports = {
}
if (!guildCheck.data.guild) {
var guildTag = ""
var guildTag = "";
} else if (!guildCheck.data.guild.tag) {
var guildTag = ""
var guildTag = "";
} else {
var guildTag = " [" + guildCheck.data.guild.tag + "]"
var guildTag = " [" + guildCheck.data.guild.tag + "]";
}
//bedwars level
@@ -96,9 +97,9 @@ module.exports = {
//skywars wins
const hsswwins = stats.data.player.stats.SkyWars.wins;
// dueks kdr
const hsduelskills = stats.data.player.stats.Duels.kills
const hsduelsdeaths = stats.data.player.stats.Duels.deaths
const hsduelskd = hsduelskills / hsduelsdeaths
const hsduelskills = stats.data.player.stats.Duels.kills;
const hsduelsdeaths = stats.data.player.stats.Duels.deaths;
const hsduelskd = hsduelskills / hsduelsdeaths;
// duels wins
const hsduelswins = stats.data.player.stats.Duels.wins;
// duels wlr
@@ -109,72 +110,95 @@ module.exports = {
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."
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."
var bwtitle = "<a:check_a:1087808632172847134> This player meets the BedWars requirements.";
}
if (hsswstars < swstars) {
var swtitle = "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
var swtitle = "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements.";
} else {
var swtitle = "<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
var swtitle = "<a:check_a:1087808632172847134> This player meets the SkyWars requirements.";
}
if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
var duelstitle = "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
var duelstitle = "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements.";
} else {
var duelstitle = "<a:check_a:1087808632172847134> This player meets the Duels requirements."
var duelstitle = "<a:check_a:1087808632172847134> This player meets the Duels requirements.";
}
await interaction.editReply({
embeds: [{
title: rank + stats.data.player.displayname + guildTag,
description: "**Network Level:** `" +
level.toFixed(2).toString() + "`\n" +
"**Current Guild:** `" + guildName + "`",
color: embedColor,
thumbnail: { url: head },
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL()
embeds: [
{
title: rank + stats.data.player.displayname + guildTag,
description:
"**Network Level:** `" +
level.toFixed(2).toString() +
"`\n" +
"**Current Guild:** `" +
guildName +
"`",
color: embedColor,
thumbnail: { url: head },
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL(),
},
fields: [
{
name: bwtitle,
value:
"**➺ Stars:** `" +
hsbwstars.toFixed(2).toString() +
" / " +
bwstars.toString() +
"`\n" +
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " +
bwfkdr.toString() +
"`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() +
" / " +
bwwins.toString() +
"`",
},
{
name: swtitle,
value:
"**➺ Stars:** `" +
hsswstars.toFixed(2).toString() +
" / " +
swstars.toString() +
"`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() +
"`\n" +
"**➺ Wins:** `" +
hsswwins.toString() +
"`",
},
{
name: duelstitle,
value:
"**➺ Wins:** `" +
hsduelswins.toString() +
" / " +
duelswins.toString() +
"`\n" +
"**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() +
" / " +
duelswlr.toString() +
"`\n" +
"**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() +
"`",
},
],
},
fields: [
{
name: bwtitle,
value: "**➺ Stars:** `" +
hsbwstars.toFixed(2).toString() + " / " +
bwstars.toString() + "`\n" +
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " + bwfkdr.toString() + "`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() + " / " +
bwwins.toString() + "`"
},
{
name: swtitle,
value:
"**➺ Stars:** `" +
hsswstars.toFixed(2).toString() +
" / " + swstars.toString() + "`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() + "`\n" +
"**➺ Wins:** `" +
hsswwins.toString() + "`"
},
{
name: duelstitle,
value: "**➺ Wins:** `" +
hsduelswins.toString() +
" / " + duelswins.toString() + "`\n" +
"**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() +
" / " + duelswlr.toString() + "`\n" +
"**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() + "`"
}
]
}]
],
});
}
},
};

View File

@@ -1,502 +1,572 @@
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js');
const { color } = require('../../config/options.json');
const { largeM, smallM, ignM } = require('../../config/limitmessages.json')
const { applicationsChannel } = require('../../config/options.json');
const { qu1, qu2, qu3, qu4, qu5, qu6, qu7, qu8 } = require('../../config/questions.json');
const { rq1, rq2, rq3, rq4, rq5, rq6, rq7, rq8 } = require('../../config/questions.json');
const { guildRole } = require('../../config/roles.json')
const mongoose = require('mongoose');
const guildapp = require('../../schemas/guildAppSchema.js');
const fetch = require('axios');
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require("discord.js");
const { color } = require("../../config/options.json");
const { largeM, smallM, ignM } = require("../../config/limitmessages.json");
const { applicationsChannel } = require("../../config/options.json");
const { qu1, qu2, qu3, qu4, qu5, qu6, qu7, qu8 } = require("../../config/questions.json");
const { rq1, rq2, rq3, rq4, rq5, rq6, rq7, rq8 } = require("../../config/questions.json");
const { guildRole } = require("../../config/roles.json");
const mongoose = require("mongoose");
const guildapp = require("../../schemas/guildAppSchema.js");
const fetch = require("axios");
module.exports = {
name: 'guildapply',
description: 'Guild application button.',
type: 'button',
name: "guildapply",
description: "Guild application button.",
type: "button",
async execute(interaction) {
const user = interaction.user;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/";
const userRoles = guild.members.cache.get(user.id).roles.cache.map(role => role.id);
if (interaction.customId === 'guildapply') {
const userRoles = guild.members.cache.get(user.id).roles.cache.map((role) => role.id);
if (interaction.customId === "guildapply") {
await interaction.deferReply({ ephemeral: true });
if (userRoles.includes(guildRole)) {
await interaction.editReply({ content: "You are already a member of the guild.", ephemeral: true });
return
return;
}
const application = await guildapp.findOne({ userID: user.id });
if (application) {
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true });
return
await interaction.editReply({
content: "You already have an application in progress.",
ephemeral: true,
});
return;
}
const tooLong = new EmbedBuilder()
.setDescription("You took too long to respond.")
.setColor(embedColor)
const tooLong = new EmbedBuilder().setDescription("You took too long to respond.").setColor(embedColor);
const cancelled = new EmbedBuilder()
.setDescription("You have cancelled your application.")
.setColor(embedColor)
.setColor(embedColor);
const attachments = new EmbedBuilder()
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
.setColor(embedColor)
.setColor(embedColor);
try {
await user.send({
embeds: [{
title: 'Guild Application',
description: "Please answer the following questions to apply for the guild.\n" +
"If you wish to cancel your application, please press type `cancel` at any time.\n" +
"If you wish to proceed with your application, please type `yes`.\n\n" +
"**Do not upload images, videos, or GIFS.**\n" +
"You have a minute to respond to this message.",
color: embedColor,
}]
})
embeds: [
{
title: "Guild Application",
description:
"Please answer the following questions to apply for the guild.\n" +
"If you wish to cancel your application, please press type `cancel` at any time.\n" +
"If you wish to proceed with your application, please type `yes`.\n\n" +
"**Do not upload images, videos, or GIFS.**\n" +
"You have a minute to respond to this message.",
color: embedColor,
},
],
});
} catch (error) {
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true });
return
return;
}
await interaction.editReply({ content: "Please check your DMs.", ephemeral: true})
await interaction.editReply({ content: "Please check your DMs.", ephemeral: true });
const input = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60
time: 1000 * 60,
});
if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (input.size === 0) {
await user.send({ embeds: [tooLong] });
return
return;
}
if (input.first().content.toLowerCase() !== 'yes') {
await user.send({ embeds: [cancelled]} );
return
if (input.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] });
return;
}
// first question
const question1 = await user.send({
embeds: [{
title : "**Question 1**",
description: qu1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
color: embedColor,
footer:{
text: "You have 5 minutes to respond to this message."
}
}]
})
embeds: [
{
title: "**Question 1**",
description:
qu1 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
ignM +
"`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message.",
},
},
],
});
const answer1 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5,
});
if (answer1.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (answer1.first().content > 16) {
await user.send({
embeds: [{
description: "Max character limit is 16.",
color: embedColor
}]
})
return
embeds: [
{
description: "Max character limit is 16.",
color: embedColor,
},
],
});
return;
}
try {
await fetch(mojangAPI + answer1.first().content)
await fetch(mojangAPI + answer1.first().content);
} catch (error) {
await user.send({
embeds: [{
description: "That is not a valid Minecraft username.\n" +
"Application cancelled.",
color: embedColor
}]
})
return
embeds: [
{
description: "That is not a valid Minecraft username.\n" + "Application cancelled.",
color: embedColor,
},
],
});
return;
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] })
return
await user.send({ embeds: [tooLong] });
return;
}
if (answer1.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer1_1 = answer1.first().content
const answer1_1 = answer1.first().content;
// second question
const question2 = await user.send({
embeds: [{
title : "**Question 2**",
description: qu2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(8 characters max)`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}]
})
embeds: [
{
title: "**Question 2**",
description:
qu2 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n" +
"`(8 characters max)`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message.",
},
},
],
});
const answer2 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
time: 1000 * 60 * 15,
});
if (answer2.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (answer2.first().content.size > 8) {
await user.send({
embeds: [{
description: "Max character limit is 8.",
color: embedColor
}]
})
return
embeds: [
{
description: "Max character limit is 8.",
color: embedColor,
},
],
});
return;
}
if (answer2.size === 0) {
await user.send({ embeds: [tooLong] })
return
await user.send({ embeds: [tooLong] });
return;
}
if (answer2.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
if (answer2.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer2_1 = answer2.first().content
const answer2_1 = answer2.first().content;
// third question
const question3 = await user.send({
embeds: [{
title : "**Question 3**",
description: qu3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}]
})
embeds: [
{
title: "**Question 3**",
description:
qu3 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
smallM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message.",
},
},
],
});
const answer3 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
time: 1000 * 60 * 15,
});
if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (answer3.first().content > 128) {
await user.send({
embeds: [{
description: "Max character limit is 128.",
color: embedColor
}]
})
embeds: [
{
description: "Max character limit is 128.",
color: embedColor,
},
],
});
}
if (answer3.size === 0) {
await user.send({ embeds: [tooLong] })
return
await user.send({ embeds: [tooLong] });
return;
}
if (answer3.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
if (answer3.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer3_1 = answer3.first().content
const answer3_1 = answer3.first().content;
// fourth question
const question4 = await user.send({
embeds: [{
title : "**Question 4**",
description: qu4 + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
" `(We expect a longer answer.)`\n`" + largeM + "`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}]
})
embeds: [
{
title: "**Question 4**",
description:
qu4 +
"\n\nPlease type your answer below or type `cancel` to cancel your application." +
" `(We expect a longer answer.)`\n`" +
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message.",
},
},
],
});
const answer4 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
time: 1000 * 60 * 15,
});
if (answer4.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (answer4.first().content > 256) {
await user.send({
embeds: [{
description: "Max character limit is 256.",
color: embedColor
}]
})
embeds: [
{
description: "Max character limit is 256.",
color: embedColor,
},
],
});
}
if (answer4.size === 0) {
await user.send({ embeds: [tooLong] })
return
await user.send({ embeds: [tooLong] });
return;
}
if (answer4.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
if (answer4.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer4_1 = answer4.first().content
const answer4_1 = answer4.first().content;
// fifth question
const question5 = await user.send({
embeds: [{
title : "**Question 5**",
description: qu5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}]
})
embeds: [
{
title: "**Question 5**",
description:
qu5 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
smallM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message.",
},
},
],
});
const answer5 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
time: 1000 * 60 * 15,
});
if (answer5.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (answer5.first().content > 128) {
await user.send({
embeds: [{
description: "Max character limit is 128.",
color: embedColor
}]
})
embeds: [
{
description: "Max character limit is 128.",
color: embedColor,
},
],
});
}
if (answer5.size === 0) {
await user.send({ embeds: [tooLong] })
return
await user.send({ embeds: [tooLong] });
return;
}
if (answer5.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
if (answer5.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer5_1 = answer5.first().content
const answer5_1 = answer5.first().content;
// sixth question
const question6 = await user.send({
embeds: [{
title : "**Question 6**",
description: qu6 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}]
})
embeds: [
{
title: "**Question 6**",
description:
qu6 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message.",
},
},
],
});
const answer6 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
time: 1000 * 60 * 15,
});
if (answer6.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (answer6.first().content > 256) {
await user.send({
embeds: [{
description: "Max character limit is 256.",
color: embedColor
}]
})
embeds: [
{
description: "Max character limit is 256.",
color: embedColor,
},
],
});
}
if (answer6.size === 0) {
await user.send({ embeds: [tooLong] })
return
await user.send({ embeds: [tooLong] });
return;
}
if (answer6.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
if (answer6.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer6_1 = answer6.first().content
const answer6_1 = answer6.first().content;
// seventh question
const question7 = await user.send({
embeds: [{
title : "**Question 7**",
description: qu7 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}]
})
embeds: [
{
title: "**Question 7**",
description:
qu7 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
smallM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message.",
},
},
],
});
const answer7 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
time: 1000 * 60 * 15,
});
if (answer7.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (answer7.first().content > 128) {
await user.send({
embeds: [{
description: "Max character limit is 128.",
color: embedColor
}]
})
embeds: [
{
description: "Max character limit is 128.",
color: embedColor,
},
],
});
}
if (answer7.size === 0) {
await user.send({ embeds: [tooLong] })
return
await user.send({ embeds: [tooLong] });
return;
}
if (answer7.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
if (answer7.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer7_1 = answer7.first().content
const answer7_1 = answer7.first().content;
// eighth question
const question8 = await user.send({
embeds: [{
title : "**Question 8**",
description: qu8 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}]
})
embeds: [
{
title: "**Question 8**",
description:
qu8 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n" +
"`(64 characters max)`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message.",
},
},
],
});
const answer8 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
time: 1000 * 60 * 15,
});
if (answer8.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (answer8.first().content > 64) {
await user.send({
embeds: [{
description: "Max character limit is 64.",
color: embedColor
}]
})
embeds: [
{
description: "Max character limit is 64.",
color: embedColor,
},
],
});
}
if (answer8.size === 0) {
await user.send({ embeds: [tooLong] })
return
await user.send({ embeds: [tooLong] });
return;
}
if (answer8.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
if (answer8.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer8_1 = answer8.first().content
const answer8_1 = answer8.first().content;
await user.send({
embeds: [{
description: "If you want to submit your application, type `yes` if not, type `no`",
color: embedColor
}]
})
embeds: [
{
description: "If you want to submit your application, type `yes` if not, type `no`",
color: embedColor,
},
],
});
const final = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5
time: 1000 * 60 * 5,
});
if (final.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
return;
}
if (final.size === 0) {
await user.send({ embeds: [tooLong] });
return
return;
}
if (final.first().content.toLowerCase() !== 'yes') {
await user.send({ embeds: [cancelled]} );
return
if (final.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] });
return;
}
await user.send({
embeds: [{
description: "Your application has been submitted!",
color: embedColor
}]
})
embeds: [
{
description: "Your application has been submitted!",
color: embedColor,
},
],
});
const userCheck = await fetch(mojangAPI + answer1_1)
const uuid = userCheck.data.id
const userCheck = await fetch(mojangAPI + answer1_1);
const uuid = userCheck.data.id;
const newGuildApp = new guildapp({
_id: new mongoose.Types.ObjectId(),
userID: user.id,
uuid: uuid,
})
});
await newGuildApp.save()
await newGuildApp.save();
const channel = guild.channels.cache.get(applicationsChannel);
await channel.send({
embeds: [{
title: user.username + "#" + user.discriminator + " - Guild Application",
color: embedColor,
thumbnail: {
url: user.avatarURL()
embeds: [
{
title: user.username + "#" + user.discriminator + " - Guild Application",
color: embedColor,
thumbnail: {
url: user.avatarURL(),
},
fields: [
{
name: rq1,
value: "```" + answer1_1 + "```",
},
{
name: rq2,
value: "```" + answer2_1 + "```",
},
{
name: rq3,
value: "```" + answer3_1 + "```",
},
{
name: rq4,
value: "```" + answer4_1 + "```",
},
{
name: rq5,
value: "```" + answer5_1 + "```",
},
{
name: rq6,
value: "```" + answer6_1 + "```",
},
{
name: rq7,
value: "```" + answer7_1 + "```",
},
{
name: rq8,
value: "```" + answer8_1 + "```",
},
],
footer: {
iconURL: guild.iconURL(),
text: "ID: " + user.id,
},
},
fields: [
{
name: rq1,
value: "```" + answer1_1 + "```"
},
{
name: rq2,
value: "```" + answer2_1 + "```"
},
{
name: rq3,
value: "```" + answer3_1 + "```"
},
{
name: rq4,
value: "```" + answer4_1 + "```"
},
{
name: rq5,
value: "```" + answer5_1 + "```"
},
{
name: rq6,
value: "```" + answer6_1 + "```"
},
{
name: rq7,
value: "```" + answer7_1 + "```"
},
{
name: rq8,
value: "```" + answer8_1 + "```"
}
],
footer: {
iconURL: guild.iconURL(),
text: "ID: " + user.id
}
}],
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
@@ -510,11 +580,10 @@ module.exports = {
new ButtonBuilder()
.setCustomId("checkstats")
.setLabel("Check Stats")
.setStyle(ButtonStyle.Secondary)
)
]
.setStyle(ButtonStyle.Secondary),
),
],
});
}
}
}
},
};

View File

@@ -1,17 +1,16 @@
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require('discord.js');
const { color } = require('../../config/options.json');
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require("discord.js");
const { color } = require("../../config/options.json");
const mongoose = require("mongoose");
const guildapp = require('../../schemas/guildAppSchema.js');
const waitingList = require('../../schemas/waitinglistSchema.js');
const { waitingListRole } = require('../../config/roles.json');
const guildapp = require("../../schemas/guildAppSchema.js");
const waitingList = require("../../schemas/waitinglistSchema.js");
const { waitingListRole } = require("../../config/roles.json");
module.exports = {
name: 'guildapplicationaccept',
description: 'Accept a guild application.',
type: 'button',
name: "guildapplicationaccept",
description: "Accept a guild application.",
type: "button",
async execute(interaction) {
await interaction.deferReply();
const user = interaction.user;
@@ -20,12 +19,12 @@ module.exports = {
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1]
const applicantId = embed.footer.text.split(" ")[1];
const applicantIGN1 = embed.fields[0].value;
const applicantIGN = applicantIGN1.replaceAll("`", "");
const applicant = await guild.members.fetch(applicantId)
const applicant = await guild.members.fetch(applicantId);
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator;
await message.edit({
@@ -45,19 +44,21 @@ module.exports = {
.setCustomId("checkstats")
.setLabel("Check Stats")
.setStyle(ButtonStyle.Secondary)
.setDisabled(true)
)
]
.setDisabled(true),
),
],
});
await applicant.send({
embeds: [{
description: `Your application for the Illegitimate guild has been accepted.`,
color: embedColor
}]
embeds: [
{
description: `Your application for the Illegitimate guild has been accepted.`,
color: embedColor,
},
],
});
const applicantEntry = await guildapp.findOne({ userID: applicantId })
const applicantEntry = await guildapp.findOne({ userID: applicantId });
const applicantUUID = applicantEntry.uuid;
const time = Date.now();
@@ -66,7 +67,7 @@ module.exports = {
userID: applicantId,
uuid: applicantUUID,
IGN: applicantIGN,
timestamp: time
timestamp: time,
});
await waitingListAdd.save();
@@ -74,20 +75,21 @@ module.exports = {
await applicant.roles.add(waitingListRole);
await guildapp.findOneAndDelete({ userID: applicantId });
await interaction.editReply({
embeds: [{
title: applicantUsername + " - Guild Application",
description: "Application has been accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()
embeds: [
{
title: applicantUsername + " - Guild Application",
description: "Application has been accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL(),
},
footer: {
iconURL: guild.iconURL(),
text: "ID: " + applicant.id,
},
},
footer: {
iconURL: guild.iconURL(),
text: "ID: " + applicant.id
}
}]
],
});
}
};
},
};

View File

@@ -1,13 +1,12 @@
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
const { color } = require('../../config/options.json');
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js");
const { color } = require("../../config/options.json");
module.exports = {
name: 'guildapplicationdeny',
description: 'Deny a guild application.',
type: 'button',
name: "guildapplicationdeny",
description: "Deny a guild application.",
type: "button",
async execute(interaction) {
const channel = interaction.channel;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
@@ -15,18 +14,18 @@ module.exports = {
const message = interaction.message;
const modal = new ModalBuilder()
.setTitle('Deny Reason')
.setCustomId('denyreasonbox')
.setTitle("Deny Reason")
.setCustomId("denyreasonbox")
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel('Deny Reason')
.setCustomId('denyreason')
.setLabel("Deny Reason")
.setCustomId("denyreason")
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder('Enter a reason for denying the application')
.setRequired(false)
)
)
.setPlaceholder("Enter a reason for denying the application")
.setRequired(false),
),
);
await interaction.showModal(modal);
}
};
},
};

View File

@@ -1,283 +1,314 @@
const { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder } = require("discord.js");
const { gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole } = require("../../config/roles.json");
const {
gm,
manager,
moderator,
beast,
member,
trialmember,
guildStaff,
guildRole,
} = require("../../config/roles.json");
const { ignM, smallM, largeM } = require("../../config/limitmessages.json");
const { ia1, ia2, ia3, ria1, ria2, ria3 } = require("../../config/questions.json");
const { color, inactivityLogChannel } = require("../../config/options.json");
const guildRoles = [gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole];
module.exports = {
name: "guildinactivitylog",
description: "Configure the bot.",
type: "button",
name: "guildinactivitylog",
description: "Configure the bot.",
type: "button",
async execute(interaction) {
const guild = interaction.guild;
const user = interaction.user;
const embedColor = Number(color.replace("#", "0x"));
const userRoles = guild.members.cache.get(user.id).roles.cache;
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/";
async execute(interaction) {
const guild = interaction.guild;
const user = interaction.user;
const embedColor = Number(color.replace("#", "0x"));
const userRoles = guild.members.cache.get(user.id).roles.cache;
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/";
if (!userRoles.some((role) => guildRoles.includes(role.id))) {
return await interaction.reply({
content: "Only guild members can use this button.",
ephemeral: true
});
}
if (!userRoles.some((role) => guildRoles.includes(role.id))) {
return await interaction.reply({
content: "Only guild members can use this button.",
ephemeral: true,
});
}
const tooLong = new EmbedBuilder()
.setDescription("You took too long to respond.")
.setColor(embedColor);
const cancelled = new EmbedBuilder()
.setDescription("You have cancelled your application.")
.setColor(embedColor);
const attachments = new EmbedBuilder()
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
.setColor(embedColor);
const tooLong = new EmbedBuilder().setDescription("You took too long to respond.").setColor(embedColor);
const cancelled = new EmbedBuilder()
.setDescription("You have cancelled your application.")
.setColor(embedColor);
const attachments = new EmbedBuilder()
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
.setColor(embedColor);
try {
await user.send({
embeds: [
{
title: "Guild Inactivity Log",
description: "Please answer the following questions to submit an inactivity log for the guild.\n" +
"If you wish to cancel your form, please press type `cancel` at any time.\n" +
"If you wish to proceed with your form, please type `yes`.\n\n" + "**Do not upload images, videos, or GIFS.**\n" +
"You have a minute to respond to this message.",
color: embedColor
}
]
});
} catch (error) {
return await interaction.reply({ content: "Please enable your DMs.", ephemeral: true });
}
try {
await user.send({
embeds: [
{
title: "Guild Inactivity Log",
description:
"Please answer the following questions to submit an inactivity log for the guild.\n" +
"If you wish to cancel your form, please press type `cancel` at any time.\n" +
"If you wish to proceed with your form, please type `yes`.\n\n" +
"**Do not upload images, videos, or GIFS.**\n" +
"You have a minute to respond to this message.",
color: embedColor,
},
],
});
} catch (error) {
return await interaction.reply({ content: "Please enable your DMs.", ephemeral: true });
}
await interaction.reply({ content: "Please check your DMs.", ephemeral: true });
await interaction.reply({ content: "Please check your DMs.", ephemeral: true });
const input = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60
});
if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (input.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (input.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] });
return;
}
const input = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60,
});
if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (input.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (input.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] });
return;
}
await user.send({
embeds: [
{
title: "**Question 1**",
description: ia1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message."
}
}
]
});
await user.send({
embeds: [
{
title: "**Question 1**",
description:
ia1 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
ignM +
"`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message.",
},
},
],
});
const answer1 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5
});
if (answer1.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (answer1.first().content > 16) {
await user.send({
embeds: [
{
description: "Max character limit is 16.",
color: embedColor
}
]
});
return;
}
try {
await fetch(mojangAPI + answer1.first().content);
} catch (error) {
await user.send({
embeds: [
{
description: "That is not a valid Minecraft username.\n" + "Application cancelled.",
color: embedColor
}
]
});
return;
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer1_1 = answer1.first().content;
const answer1 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5,
});
if (answer1.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (answer1.first().content > 16) {
await user.send({
embeds: [
{
description: "Max character limit is 16.",
color: embedColor,
},
],
});
return;
}
try {
await fetch(mojangAPI + answer1.first().content);
} catch (error) {
await user.send({
embeds: [
{
description: "That is not a valid Minecraft username.\n" + "Application cancelled.",
color: embedColor,
},
],
});
return;
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer1_1 = answer1.first().content;
await user.send({
embeds: [{
title: "**Question 2**",
description: ia2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message."
}
}]
});
const answer2 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5
});
if (answer2.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (answer2.first().content > 128) {
await user.send({
embeds: [
{
description: "Max character limit is 128.",
color: embedColor
}
]
});
return;
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer2_1 = answer1.first().content;
await user.send({
embeds: [
{
title: "**Question 2**",
description:
ia2 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
smallM +
"`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message.",
},
},
],
});
const answer2 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5,
});
if (answer2.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (answer2.first().content > 128) {
await user.send({
embeds: [
{
description: "Max character limit is 128.",
color: embedColor,
},
],
});
return;
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer2_1 = answer1.first().content;
await user.send({
embeds: [{
title: "**Question 3**",
description: ia3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
}]
});
const answer3 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
});
if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (answer3.first().content > 256) {
await user.send({
embeds: [
{
description: "Max character limit is 256",
color: embedColor
}
]
});
return;
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer3_1 = answer1.first().content;
await user.send({
embeds: [
{
title: "**Question 3**",
description:
ia3 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message.",
},
},
],
});
const answer3 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15,
});
if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (answer3.first().content > 256) {
await user.send({
embeds: [
{
description: "Max character limit is 256",
color: embedColor,
},
],
});
return;
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] });
return;
}
const answer3_1 = answer1.first().content;
await user.send({
embeds: [{
description: "If you want to submit your application, type `yes` if not, type `no`",
color: embedColor
}]
})
const final = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5
});
if (final.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
}
if (final.size === 0) {
await user.send({ embeds: [tooLong] });
return
}
if (final.first().content.toLowerCase() !== 'yes') {
await user.send({ embeds: [cancelled]} );
return
}
await user.send({
embeds: [
{
description: "If you want to submit your application, type `yes` if not, type `no`",
color: embedColor,
},
],
});
const final = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5,
});
if (final.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (final.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (final.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] });
return;
}
await user.send({
embeds: [{
description: "Your application has been submitted!",
color: embedColor
}]
})
await user.send({
embeds: [
{
description: "Your application has been submitted!",
color: embedColor,
},
],
});
const appChannel = await guild.channels.cache.get(inactivityLogChannel);
const appChannel = await guild.channels.cache.get(inactivityLogChannel);
await appChannel.send({
embeds: [{
title: user.username + "#" + user.discriminator + " - Inactivity Application",
color: embedColor,
thumbnail: {
url: user.displayAvatarURL({ dynamic: true })
},
fields: [
{
name: ria1,
value: "`" + answer1_1 + "`"
},
{
name: ria2,
value: "`" + answer2_1 + "`"
},
{
name: ria3,
value: "`" + answer3_1 + "`"
}
],
footer: {
icon_url: user.displayAvatarURL({ dynamic: true }),
text: "ID: " + user.id
}
}],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("inactiveapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("inactiveapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger),
)
]
});
}
await appChannel.send({
embeds: [
{
title: user.username + "#" + user.discriminator + " - Inactivity Application",
color: embedColor,
thumbnail: {
url: user.displayAvatarURL({ dynamic: true }),
},
fields: [
{
name: ria1,
value: "`" + answer1_1 + "`",
},
{
name: ria2,
value: "`" + answer2_1 + "`",
},
{
name: ria3,
value: "`" + answer3_1 + "`",
},
],
footer: {
icon_url: user.displayAvatarURL({ dynamic: true }),
text: "ID: " + user.id,
},
},
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("inactiveapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("inactiveapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger),
),
],
});
},
};

View File

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

View File

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

View File

@@ -1,14 +1,13 @@
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const { color } = require('../../config/options.json');
const staffapp = require('../../schemas/staffAppSchema.js');
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const { color } = require("../../config/options.json");
const staffapp = require("../../schemas/staffAppSchema.js");
module.exports = {
name: 'staffapplicationaccept',
description: 'Accept a staff application.',
type: 'button',
name: "staffapplicationaccept",
description: "Accept a staff application.",
type: "button",
async execute(interaction) {
const user = interaction.user;
const channel = interaction.channel;
const guild = interaction.guild;
@@ -16,16 +15,18 @@ module.exports = {
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1]
const applicantId = embed.footer.text.split(" ")[1];
const applicant = await guild.members.fetch(applicantId)
const applicant = await guild.members.fetch(applicantId);
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator;
await applicant.send({
embeds: [{
description: `Your application for the Illegitimate staff team has been accepted.`,
color: embedColor
}]
embeds: [
{
description: `Your application for the Illegitimate staff team has been accepted.`,
color: embedColor,
},
],
});
await message.edit({
@@ -40,27 +41,28 @@ module.exports = {
.setCustomId("staffapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger)
.setDisabled(true)
)
]
.setDisabled(true),
),
],
});
await staffapp.findOneAndDelete({ userId: applicantId });
await interaction.reply({
embeds: [{
title: applicantUsername + " - Staff Application.",
description: "Application accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()
embeds: [
{
title: applicantUsername + " - Staff Application.",
description: "Application accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL(),
},
footer: {
iconurl: guild.iconURL(),
text: "ID: " + applicantId,
},
},
footer: {
iconurl: guild.iconURL(),
text: "ID: " + applicantId
}
}]
],
});
}
}
},
};

View File

@@ -1,25 +1,24 @@
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js");
module.exports = {
name: 'staffapplicationdeny',
description: 'Deny a guild application.',
type: 'button',
name: "staffapplicationdeny",
description: "Deny a guild application.",
type: "button",
async execute(interaction) {
const modal = new ModalBuilder()
.setTitle('Deny Reason')
.setCustomId('staffdenyreasonbox')
.setTitle("Deny Reason")
.setCustomId("staffdenyreasonbox")
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel('Deny Reason')
.setCustomId('staffdenyreason')
.setLabel("Deny Reason")
.setCustomId("staffdenyreason")
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder('Enter a reason for denying the application')
.setRequired(false)
)
)
.setPlaceholder("Enter a reason for denying the application")
.setRequired(false),
),
);
await interaction.showModal(modal);
}
};
},
};

View File

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

View File

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

View File

@@ -1,66 +1,64 @@
const mongoose = require('mongoose');
const waitinglist = require('../../schemas/waitinglistSchema.js');
const env = require('dotenv').config();
const mongoose = require("mongoose");
const waitinglist = require("../../schemas/waitinglistSchema.js");
const env = require("dotenv").config();
const key = process.env.HYPIXELAPIKEY;
const { hypixelGuildID } = require("../../config/options.json")
const { hypixelGuildID } = require("../../config/options.json");
const fetch = require("axios");
module.exports = {
name: 'waitinglistupdate',
description: 'Update the waiting list.',
type: 'button',
name: "waitinglistupdate",
description: "Update the waiting list.",
type: "button",
async execute(interaction) {
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
await interaction.deferReply({ ephemeral: true });
const user = interaction.user;
const message = interaction.message;
const embed = message.embeds[0];
const accepted = await waitinglist.find()
const guildAPI = "https://api.hypixel.net/guild"
const guild = guildAPI + "?key=" + key + "&player="
const user = interaction.user;
const message = interaction.message;
const embed = message.embeds[0];
const accepted = await waitinglist.find();
const guildAPI = "https://api.hypixel.net/guild";
const guild = guildAPI + "?key=" + key + "&player=";
for (let i = 0; i < accepted.length; i++) {
const uuid = accepted[i].uuid
const check = await fetch(guild + uuid)
const uuid = accepted[i].uuid;
const check = await fetch(guild + uuid);
if (check.data.guild._id === hypixelGuildID) {
await waitinglist.findOneAndDelete({ uuid: uuid })
continue
await waitinglist.findOneAndDelete({ uuid: uuid });
continue;
}
}
let fields = [];
let fields = [];
for (let i = 0; i < accepted.length; i++) {
for (let i = 0; i < accepted.length; i++) {
const timestamp1 = accepted[i].timestamp / 1000;
const timestamp = Math.floor(timestamp1);
const timestamp1 = accepted[i].timestamp / 1000
const timestamp = Math.floor(timestamp1)
fields.push({
name: `${i + 1}. ${accepted[i].IGN}`,
value: `TS: <t:${timestamp}:R>`,
});
}
fields.push({
name: `${i + 1}. ${accepted[i].IGN}`,
value: `TS: <t:${timestamp}:R>`
});
}
await message.edit({
embeds: [
{
title: embed.title,
description: embed.description,
color: embed.color,
footer: {
text: "Last updated by " + user.username,
icon_url: user.avatarURL(),
},
thumbnail: embed.thumbnail,
fields: fields,
timestamp: new Date(),
},
],
});
await message.edit({
embeds: [{
title: embed.title,
description: embed.description,
color: embed.color,
footer: {
text: "Last updated by " + user.username,
icon_url: user.avatarURL(),
},
thumbnail: embed.thumbnail,
fields: fields,
timestamp: new Date(),
}],
});
await interaction.editReply({ content: 'Updated the waiting list', ephemeral: true });
}
}
await interaction.editReply({ content: "Updated the waiting list", ephemeral: true });
},
};