Finalizing staff applicaiotns

This commit is contained in:
2023-03-28 00:11:24 +02:00
parent bad91ae786
commit 000a45b4db
4 changed files with 55 additions and 34 deletions

View File

@@ -20,6 +20,7 @@ module.exports = {
const applicantId = embed.footer.text.split(" ")[1]
const applicant = await guild.members.fetch(applicantId)
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator;
await applicant.send({
embeds: [{
@@ -35,9 +36,7 @@ module.exports = {
.setCustomId("staffapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary)
.setDisabled(true)
),
new ActionRowBuilder().addComponents(
.setDisabled(true),
new ButtonBuilder()
.setCustomId("staffapplicationdeny")
.setLabel("Deny")
@@ -52,9 +51,7 @@ module.exports = {
await interaction.reply({
embeds: [{
title: applicantUsername + " - Staff Application.",
description: "Application accepted by <@" + user.id + ">.\n\n" +
"Press the button below to delete this channel.\n" +
"**When the user was given their role**",
description: "Application accepted by <@" + user.id + ">.",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()

View File

@@ -144,7 +144,7 @@ module.exports = {
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" + "`(8 characters max)`",
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."
@@ -160,10 +160,10 @@ module.exports = {
await user.send({ embeds: [attachments] });
return
}
if (answer2.first().content > 8) {
if (answer2.first().content > 64) {
await user.send({
embeds: [{
description: "Max character limit is 8.",
description: "Max character limit is 64.",
color: embedColor
}]
})
@@ -183,7 +183,7 @@ module.exports = {
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`" + smallM + "`",
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."
@@ -199,10 +199,10 @@ module.exports = {
await user.send({ embeds: [attachments] });
return
}
if (answer3.first().content > 128) {
if (answer3.first().content > 256) {
await user.send({
embeds: [{
description: "Max character limit is 128.",
description: "Max character limit is 256.",
color: embedColor
}]
})
@@ -221,8 +221,7 @@ module.exports = {
const question4 = await user.send({
embeds: [{
title : "**Question 4**",
description: sq4 + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
" `(We expect a longer answer.)`\n`" + largeM + "`",
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."
@@ -260,7 +259,7 @@ module.exports = {
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`" + smallM + "`",
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."
@@ -276,10 +275,10 @@ module.exports = {
await user.send({ embeds: [attachments] });
return
}
if (answer5.first().content > 128) {
if (answer5.first().content > 256) {
await user.send({
embeds: [{
description: "Max character limit is 128.",
description: "Max character limit is 256.",
color: embedColor
}]
})
@@ -298,7 +297,8 @@ module.exports = {
const question6 = await user.send({
embeds: [{
title : "**Question 6**",
description: sq6 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
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."
@@ -364,11 +364,16 @@ module.exports = {
}]
})
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,
})
newStaffApp.save()
await newStaffApp.save()
await user.deleteDM();
const channel = guild.channels.cache.get(staffApplicationsChannel);
@@ -417,9 +422,7 @@ module.exports = {
new ButtonBuilder()
.setCustomId("staffapplicationaccept")
.setLabel("Accept")
.setStyle(ButtonStyle.Primary)
),
new ActionRowBuilder().addComponents(
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("staffapplicationdeny")
.setLabel("Deny")

View File

@@ -1,5 +1,7 @@
const { InteractionType, EmbedBuilder } = require('discord.js');
const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const { color } = require('../../config/options.json');
const mongoose = require('mongoose');
const staffapp = require('../../schemas/staffAppSchema.js');
const fs = require('fs');
const path = require('path');
@@ -25,6 +27,23 @@ module.exports = {
const applicantId = embed.footer.text.split(" ")[1]
const applicant = await guild.members.fetch(applicantId)
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),
)
]
});
const dmMessage = new EmbedBuilder()
.setDescription("Your application for the Illegitimate guild staff has been denied\n" +
"**Reason:** `" + reason + "`")
@@ -32,6 +51,8 @@ module.exports = {
await applicant.send({ embeds: [dmMessage] });
await staffapp.findOneAndDelete({ userID: applicantId });
await interaction.editReply({
embeds: [{
title: "Application Denied",