Updated application system
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, GuildMember, TextChannel } from "discord.js"
|
||||
import { ButtonBuilder, ButtonStyle, ActionRowBuilder, GuildMember, TextChannel } from "discord.js"
|
||||
import { embedColor, staffApplicationsChannel } from "config/options"
|
||||
import { largeM, ignM } from "config/limitmessages"
|
||||
import questions from "config/questions"
|
||||
@@ -6,9 +6,9 @@ import { guildRole, guildStaff } from "config/roles"
|
||||
import mongoose from "mongoose"
|
||||
import staffapp from "schemas/staffAppSchema"
|
||||
import settings from "schemas/settingsSchema"
|
||||
import { getUUID } from "utils/Hypixel"
|
||||
import { IButton } from "interfaces"
|
||||
import env from "utils/Env"
|
||||
import applicationQuestions from "utils/functions/applicationquestions"
|
||||
|
||||
export = {
|
||||
name: "staffapply",
|
||||
@@ -57,16 +57,6 @@ export = {
|
||||
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: [{
|
||||
@@ -89,18 +79,8 @@ export = {
|
||||
max: 1,
|
||||
time: 1000 * 60
|
||||
})
|
||||
if (input.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (input.first()!.content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (input.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
const confirm1 = await applicationQuestions(input, user, 0, "confirmation")
|
||||
if (!confirm1) return
|
||||
|
||||
// first question
|
||||
await user.send({
|
||||
@@ -113,44 +93,15 @@ export = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer1 = await user.dmChannel!.awaitMessages({
|
||||
const useranswer1 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (answer1.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer1.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer1.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer1.first()!.content.length > 16) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 16.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const uuid = await getUUID(answer1.first()!.content)
|
||||
if (!uuid) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "That is not a valid Minecraft username.\n" +
|
||||
"Application cancelled.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer1_1 = answer1.first()!.content
|
||||
const answer1Obj = await applicationQuestions(useranswer1, user, 16, "ign") as boolean | { answer: string, uuid: string }
|
||||
if (answer1Obj === false || answer1Obj === true) return
|
||||
const answer1 = answer1Obj.answer
|
||||
const uuid = answer1Obj.uuid
|
||||
|
||||
// second question
|
||||
await user.send({
|
||||
@@ -164,33 +115,13 @@ export = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer2 = await user.dmChannel!.awaitMessages({
|
||||
const useranswer2 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer2.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer2.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer2.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer2.first()!.content.length > 64) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 64.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer2_1 = answer2.first()!.content
|
||||
const answer2 = await applicationQuestions(useranswer2, user, 64, "normal")
|
||||
if (!answer2) return
|
||||
|
||||
// third question
|
||||
await user.send({
|
||||
@@ -203,32 +134,13 @@ export = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer3 = await user.dmChannel!.awaitMessages({
|
||||
const useranswer3 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer3.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer3.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer3.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer3.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer3_1 = answer3.first()!.content
|
||||
const answer3 = await applicationQuestions(useranswer3, user, 256, "normal")
|
||||
if (!answer3) return
|
||||
|
||||
// fourth question
|
||||
await user.send({
|
||||
@@ -241,32 +153,13 @@ export = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer4 = await user.dmChannel!.awaitMessages({
|
||||
const useranswer4 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer4.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer4.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer4.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer4.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer4_1 = answer4.first()!.content
|
||||
const answer4 = await applicationQuestions(useranswer4, user, 256, "normal")
|
||||
if (!answer4) return
|
||||
|
||||
// fifth question
|
||||
await user.send({
|
||||
@@ -279,32 +172,13 @@ export = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer5 = await user.dmChannel!.awaitMessages({
|
||||
const useranswer5 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer5.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer5.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer5.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer5.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer5_1 = answer5.first()!.content
|
||||
const answer5 = await applicationQuestions(useranswer5, user, 256, "normal")
|
||||
if (!answer5) return
|
||||
|
||||
// sixth question
|
||||
await user.send({
|
||||
@@ -318,32 +192,13 @@ export = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer6 = await user.dmChannel!.awaitMessages({
|
||||
const useranswer6 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer6.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer6.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer6.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer6.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer6_1 = answer6.first()!.content
|
||||
const answer6 = await applicationQuestions(useranswer6, user, 256, "normal")
|
||||
if (!answer6) return
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
@@ -357,18 +212,8 @@ export = {
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (final.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (final.first()!.content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (final.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
const confirm2 = await applicationQuestions(final, user, 0, "confirmation")
|
||||
if (!confirm2) return
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
@@ -398,27 +243,27 @@ export = {
|
||||
fields: [
|
||||
{
|
||||
name: rq(1),
|
||||
value: "```" + answer1_1 + "```"
|
||||
value: "```" + answer1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(2),
|
||||
value: "```" + answer2_1 + "```"
|
||||
value: "```" + answer2 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(3),
|
||||
value: "```" + answer3_1 + "```"
|
||||
value: "```" + answer3 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(4),
|
||||
value: "```" + answer4_1 + "```"
|
||||
value: "```" + answer4 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(5),
|
||||
value: "```" + answer5_1 + "```"
|
||||
value: "```" + answer5 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(6),
|
||||
value: "```" + answer6_1 + "```"
|
||||
value: "```" + answer6 + "```"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
|
||||
Reference in New Issue
Block a user