Beautifying

This commit is contained in:
2023-04-24 23:38:33 +02:00
parent e2747dab3f
commit 3a3bb89635
40 changed files with 4010 additions and 3388 deletions

View File

@@ -1,127 +1,167 @@
const { color } = require('../../config/options.json');
const fetch = require('axios');
const guildapp = require('../../schemas/guildAppSchema.js');
const { bwfdkr, bwstars, bwwins, duelswins, swstars } = require('../../config/reqs.json');
const { color } = require("../../config/options.json");
const fetch = require("axios");
const guildapp = require("../../schemas/guildAppSchema.js");
const {
bwfdkr,
bwstars,
bwwins,
duelswins,
swstars
} = require("../../config/reqs.json");
module.exports = {
name: 'checkstats',
description: 'Check your stats.',
type: 'button',
name: "checkstats",
description: "Check your stats.",
type: "button",
async execute(interaction) {
async execute(interaction) {
await interaction.deferReply();
await interaction.deferReply();
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1];
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1]
const guildappdata = await guildapp.findOne({ userID: applicantId });
const uuid = guildappdata.uuid;
const guildappdata = await guildapp.findOne({ userID: applicantId })
const uuid = guildappdata.uuid;
const mojang = "https://api.mojang.com/user/profile/"
const slothPixel = "https://api.slothpixel.me/api/players/";
const guildAPI = "https://api.slothpixel.me/api/guilds/"
const minotar = "https://minotar.net/helm/";
const embedColor = Number(color.replace("#", "0x"));
const mojang = "https://api.mojang.com/user/profile/";
const slothPixel = "https://api.slothpixel.me/api/players/";
const guildAPI = "https://api.slothpixel.me/api/guilds/";
const minotar = "https://minotar.net/helm/";
const embedColor = Number(color.replace("#", "0x"));
const userCheck = await fetch(mojang + uuid);
const ign = userCheck.data.name;
const userCheck = await fetch(mojang + uuid);
const ign = userCheck.data.name;
try {
await fetch(slothPixel + uuid);
} catch (error) {
interaction.editReply('That player doesn\'t exist. [Hypixel]')
return
}
const stats = await fetch(slothPixel + uuid);
const head = minotar + ign;
const rank_formatted = stats.data.rank_formatted
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "")
if (rank2 === "") {
var rank = ""
} else {
var rank = rank2 + " "
}
try {
const guildCheck = await fetch(guildAPI + uuid);
var guildName = guildCheck.data.name
} catch (error) {
var guildName = "None"
}
const hsbwstars = stats.data.stats.BedWars.level
const hsbwfkdr = stats.data.stats.BedWars.final_k_d
const hsbwwins = stats.data.stats.BedWars.wins
const hsswstars = stats.data.stats.SkyWars.level
const hsduelswins = stats.data.stats.Duels.general.wins
if (hsbwstars < bwstars && hsbwfkdr < bwfdkr && 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) {
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."
}
if (hsduelswins < duelswins) {
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."
}
try {
const guildCheck = await fetch(guildAPI + userUUID);
const tag_formatted = guildCheck.data.tag_formatted
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "")
var guildTag = " " + guildTag2
} catch (error) {
var guildTag = ""
}
await interaction.editReply({
embeds: [{
title: rank + stats.data.username + guildTag,
description: "**Network Level:** `" + stats.data.level.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:** `" + stats.data.stats.BedWars.level.toString() + "`\n" +
"**➺ FKDR:** `" + stats.data.stats.BedWars.final_k_d.toString() + "`\n" +
"**➺ Wins:** `" + stats.data.stats.BedWars.wins.toString() + "`"
},
{
name: swtitle,
value: "**➺ Stars:** `" + stats.data.stats.SkyWars.level.toFixed(2).toString() + "`\n" +
"**➺ KDR:** `" + stats.data.stats.SkyWars.kill_death_ratio.toString() + "`\n" +
"**➺ Wins:** `" + stats.data.stats.SkyWars.wins.toString() + "`"
},
{
name: duelstitle,
value: "**➺ Wins:** `" + stats.data.stats.Duels.general.wins.toString() + "`\n" +
"**➺ KDR:** `" + stats.data.stats.Duels.general.kd_ratio.toFixed(2).toString() + "`\n" +
"**➺ WLR:** `" + stats.data.stats.Duels.general.win_loss_ratio.toFixed(2).toString() + "`"
}
]
}]
})
try {
await fetch(slothPixel + uuid);
} catch (error) {
interaction.editReply("That player doesn't exist. [Hypixel]");
return;
}
};
const stats = await fetch(slothPixel + uuid);
const head = minotar + ign;
const rank_formatted = stats.data.rank_formatted;
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "");
if (rank2 === "") {
var rank = "";
} else {
var rank = rank2 + " ";
}
try {
const guildCheck = await fetch(guildAPI + uuid);
var guildName = guildCheck.data.name;
} catch (error) {
var guildName = "None";
}
const hsbwstars = stats.data.stats.BedWars.level;
const hsbwfkdr = stats.data.stats.BedWars.final_k_d;
const hsbwwins = stats.data.stats.BedWars.wins;
const hsswstars = stats.data.stats.SkyWars.level;
const hsduelswins = stats.data.stats.Duels.general.wins;
if (hsbwstars < bwstars && hsbwfkdr < bwfdkr && 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) {
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.";
}
if (hsduelswins < duelswins) {
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.";
}
try {
const guildCheck = await fetch(guildAPI + userUUID);
const tag_formatted = guildCheck.data.tag_formatted;
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "");
var guildTag = " " + guildTag2;
} catch (error) {
var guildTag = "";
}
await interaction.editReply({
embeds: [
{
title: rank + stats.data.username + guildTag,
description:
"**Network Level:** `" +
stats.data.level.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:** `" +
stats.data.stats.BedWars.level.toString() +
"`\n" +
"**➺ FKDR:** `" +
stats.data.stats.BedWars.final_k_d.toString() +
"`\n" +
"**➺ Wins:** `" +
stats.data.stats.BedWars.wins.toString() +
"`"
},
{
name: swtitle,
value:
"**➺ Stars:** `" +
stats.data.stats.SkyWars.level.toFixed(2).toString() +
"`\n" +
"**➺ KDR:** `" +
stats.data.stats.SkyWars.kill_death_ratio.toString() +
"`\n" +
"**➺ Wins:** `" +
stats.data.stats.SkyWars.wins.toString() +
"`"
},
{
name: duelstitle,
value:
"**➺ Wins:** `" +
stats.data.stats.Duels.general.wins.toString() +
"`\n" +
"**➺ KDR:** `" +
stats.data.stats.Duels.general.kd_ratio.toFixed(2).toString() +
"`\n" +
"**➺ WLR:** `" +
stats.data.stats.Duels.general.win_loss_ratio
.toFixed(2)
.toString() +
"`"
}
]
}
]
});
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,73 +1,77 @@
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require('discord.js');
const { color } = require('../../config/options.json');
const guildapp = require('../../schemas/guildAppSchema.js');
const { waitingList } = require('../../config/roles.json');
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require("discord.js");
const { color } = require("../../config/options.json");
const guildapp = require("../../schemas/guildAppSchema.js");
const { waitingList } = 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) {
async execute(interaction) {
await interaction.deferReply();
await interaction.deferReply();
const user = interaction.user;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const user = interaction.user;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1];
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1]
const applicant = await guild.members.fetch(applicantId);
const applicantUsername =
applicant.user.username + "#" + applicant.user.discriminator;
const applicant = await guild.members.fetch(applicantId)
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator;
await message.edit({
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("guildapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary)
.setDisabled(true),
new ButtonBuilder()
.setCustomId("guildapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger)
.setDisabled(true),
new ButtonBuilder()
.setCustomId("checkstats")
.setLabel("Check Stats")
.setStyle(ButtonStyle.Secondary)
.setDisabled(true)
)
]
});
await message.edit({
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("guildapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary)
.setDisabled(true),
new ButtonBuilder()
.setCustomId("guildapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger)
.setDisabled(true),
new ButtonBuilder()
.setCustomId("checkstats")
.setLabel("Check Stats")
.setStyle(ButtonStyle.Secondary)
.setDisabled(true)
)
]
});
await applicant.send({
embeds: [
{
description: `Your application for the Illegitimate guild has been accepted.`,
color: embedColor
}
]
});
await applicant.send({
embeds: [{
description: `Your application for the Illegitimate guild has been accepted.`,
color: embedColor
}]
});
await applicant.roles.add(waitingList);
await guildapp.findOneAndDelete({ userID: applicantId });
await applicant.roles.add(waitingList);
await guildapp.findOneAndDelete({ userID: applicantId });
await interaction.editReply({
embeds: [{
title: applicantUsername + " - Guild Application",
description: "Application has been accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()
},
footer: {
iconURL: guild.iconURL(),
text: "ID: " + applicant.id
}
}]
});
}
};
await interaction.editReply({
embeds: [
{
title: applicantUsername + " - Guild Application",
description: "Application has been accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()
},
footer: {
iconURL: guild.iconURL(),
text: "ID: " + applicant.id
}
}
]
});
}
};

View File

@@ -1,32 +1,36 @@
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) {
async execute(interaction) {
const channel = interaction.channel;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const channel = interaction.channel;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const message = interaction.message;
const message = interaction.message;
const modal = new ModalBuilder()
.setTitle('Deny Reason')
.setCustomId('denyreasonbox')
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel('Deny Reason')
.setCustomId('denyreason')
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder('Enter a reason for denying the application')
.setRequired(false)
)
)
await interaction.showModal(modal);
}
};
const modal = new ModalBuilder()
.setTitle("Deny Reason")
.setCustomId("denyreasonbox")
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel("Deny Reason")
.setCustomId("denyreason")
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder("Enter a reason for denying the application")
.setRequired(false)
)
);
await interaction.showModal(modal);
}
};

View File

@@ -1,66 +1,69 @@
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) {
async execute(interaction) {
const user = interaction.user;
const channel = interaction.channel;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const user = interaction.user;
const channel = interaction.channel;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1];
const message = interaction.message;
const embed = message.embeds[0];
const applicantId = embed.footer.text.split(" ")[1]
const applicant = await guild.members.fetch(applicantId);
const applicantUsername =
applicant.user.username + "#" + applicant.user.discriminator;
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
}
]
});
await applicant.send({
embeds: [{
description: `Your application for the Illegitimate staff team has been accepted.`,
color: embedColor
}]
});
await message.edit({
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("staffapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary)
.setDisabled(true),
new ButtonBuilder()
.setCustomId("staffapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger)
.setDisabled(true)
)
]
});
await message.edit({
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("staffapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary)
.setDisabled(true),
new ButtonBuilder()
.setCustomId("staffapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger)
.setDisabled(true)
)
]
});
await staffapp.findOneAndDelete({ userId: applicantId });
await staffapp.findOneAndDelete({ userId: applicantId });
await interaction.reply({
embeds: [{
title: applicantUsername + " - Staff Application.",
description: "Application accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()
},
footer: {
iconurl: guild.iconURL(),
text: "ID: " + applicantId
}
}]
});
}
}
await interaction.reply({
embeds: [
{
title: applicantUsername + " - Staff Application.",
description: "Application accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()
},
footer: {
iconurl: guild.iconURL(),
text: "ID: " + applicantId
}
}
]
});
}
};

View File

@@ -1,25 +1,29 @@
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')
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel('Deny Reason')
.setCustomId('staffdenyreason')
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder('Enter a reason for denying the application')
.setRequired(false)
)
)
await interaction.showModal(modal);
}
};
async execute(interaction) {
const modal = new ModalBuilder()
.setTitle("Deny Reason")
.setCustomId("staffdenyreasonbox")
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel("Deny Reason")
.setCustomId("staffdenyreason")
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder("Enter a reason for denying the application")
.setRequired(false)
)
);
await interaction.showModal(modal);
}
};

View File

@@ -1,437 +1,523 @@
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) {
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 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/"
if (interaction.customId === "staffapply") {
await interaction.deferReply({ ephemeral: true });
if (interaction.customId === "staffapply") {
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.deferReply({ ephemeral: true });
if (userRoles.has(guildStaff)) {
await interaction.editReply({
content: "You are already a staff member.",
ephemeral: true
});
return;
}
if (!userRoles.has(guildRole)) {
await interaction.editReply({content: "You must be a member of the guild to apply for staff.", ephemeral: true});
return
const application = await staffapp.findOne({ userID: user.id });
if (application) {
await interaction.editReply({
content: "You already have an application in progress.",
ephemeral: true
});
return;
}
const tooLong = new EmbedBuilder()
.setDescription("You took too long to respond.")
.setColor(embedColor);
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: "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;
}
if (userRoles.has(guildStaff)) {
await interaction.editReply({content: "You are already a staff member.", ephemeral: true});
return
await interaction.editReply({
content: "Please check your DMs.",
ephemeral: true
});
const input = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60
});
if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (input.size === 0) {
await user.send({ embeds: [tooLong] });
return;
}
if (input.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] });
return;
}
// first question
const question1 = await user.send({
embeds: [
{
title: "**Question 1**",
description:
sq1 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
ignM +
"`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message."
}
const application = await staffapp.findOne({ userID: user.id });
if (application) {
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true });
return
}
]
});
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
}
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: '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})
]
});
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 input = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
max: 1,
time: 1000 * 60
});
if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
}
if (input.size === 0) {
await user.send({ embeds: [tooLong] });
return
}
if (input.first().content.toLowerCase() !== 'yes') {
await user.send({ embeds: [cancelled]} );
return
}
// first question
const question1 = await user.send({
embeds: [{
title : "**Question 1**",
description: sq1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
color: embedColor,
footer:{
text: "You have 5 minutes to respond to this message."
}
}]
})
const answer1 = await user.dmChannel.awaitMessages({
filter: m => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 5,
});
if (answer1.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return
}
if (answer1.first().content > 16) {
await user.send({
embeds: [{
description: "Max character limit is 16.",
color: embedColor
}]
})
return
}
try {
await fetch(mojangAPI + answer1.first().content)
} catch (error) {
await user.send({
embeds: [{
description: "That is not a valid Minecraft username.\n" +
"Application cancelled.",
color: embedColor
}]
})
return
}
if (answer1.size === 0) {
await user.send({ embeds: [tooLong] })
return
}
if (answer1.first().content.toLowerCase() === 'cancel') {
await user.send({ embeds: [cancelled] })
return
}
const answer1_1 = answer1.first().content
// second question
const question2 = await user.send({
embeds: [{
title : "**Question 2**",
description: sq2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`",
color: embedColor,
footer:{
text: "You have 15 minutes to respond to this message."
}
}]
})
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
});
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
// 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;
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
}]
})
// third question
const question3 = await user.send({
embeds: [
{
title: "**Question 3**",
description:
sq3 +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
}
]
});
const answer3 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id,
max: 1,
time: 1000 * 60 * 15
});
if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] });
return;
}
if (answer3.first().content > 256) {
await user.send({
embeds: [
{
description: "Max character limit is 256.",
color: embedColor
}
]
});
}
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;
const userCheck = await fetch(mojangAPI + answer1_1)
const uuid = userCheck.data.id
// 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;
const newStaffApp = new staffapp({
_id: new mongoose.Types.ObjectId(),
userID: user.id,
uuid: uuid,
})
// 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;
await newStaffApp.save()
await user.deleteDM();
// 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;
const channel = guild.channels.cache.get(staffApplicationsChannel);
await user.send({
embeds: [
{
description:
"If you want to submit your application, type `yes` if not, type `no`",
color: embedColor
}
]
});
await channel.send({
embeds: [{
title: user.username + "#" + user.discriminator + " - Staff Application",
color: embedColor,
thumbnail: {
url: user.avatarURL()
},
fields: [
{
name: rsq1,
value: "```" + answer1_1 + "```"
},
{
name: rsq2,
value: "```" + answer2_1 + "```"
},
{
name: rsq3,
value: "```" + answer3_1 + "```"
},
{
name: rsq4,
value: "```" + answer4_1 + "```"
},
{
name: rsq5,
value: "```" + answer5_1 + "```"
},
{
name: rsq6,
value: "```" + answer6_1 + "```"
}
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;
}
],
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)
)
]
}
);
}
await user.send({
embeds: [
{
description: "Your application has been submitted!",
color: embedColor
}
]
});
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
});
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 + "```"
},
{
name: rsq2,
value: "```" + answer2_1 + "```"
},
{
name: rsq3,
value: "```" + answer3_1 + "```"
},
{
name: rsq4,
value: "```" + answer4_1 + "```"
},
{
name: rsq5,
value: "```" + answer5_1 + "```"
},
{
name: rsq6,
value: "```" + answer6_1 + "```"
}
],
footer: {
iconURL: guild.iconURL(),
text: "ID: " + user.id
}
}
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("staffapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("staffapplicationdeny")
.setLabel("Deny")
.setStyle(ButtonStyle.Danger)
)
]
});
}
}
}
};