From 000a45b4db341c02dd69eb455752d247329cade2 Mon Sep 17 00:00:00 2001 From: Taken Date: Tue, 28 Mar 2023 00:11:24 +0200 Subject: [PATCH] Finalizing staff applicaiotns --- config/questions.json | 22 +++++++-------- events/buttons/staffapplicationaccept.js | 9 ++---- events/buttons/staffapply.js | 35 +++++++++++++----------- events/modals/staffdenyreasonbox.js | 23 +++++++++++++++- 4 files changed, 55 insertions(+), 34 deletions(-) diff --git a/config/questions.json b/config/questions.json index 0bc9696..d3be89a 100644 --- a/config/questions.json +++ b/config/questions.json @@ -16,15 +16,15 @@ "rq7": "How did you find about us?", "rq8": "What is your time zone?", "sq1": "What is your IGN?", - "sq2": "", - "sq3": "", - "sq4": "", - "sq5": "", - "sq6": "", - "rsq1": "", - "rsq2": "", - "rsq3": "", - "rsq4": "", - "rsq5": "", - "rsq6": "" + "sq2": "How long have you been in the guild for?", + "sq3": "Have you been guild muted for any reason? (This includes mutes for staff disrespect, arguing with guild members, toxicity...)", + "sq4": "Are you an active guild member? (Keep in mind we will surely check your GEXP)", + "sq5": "Do you have any experience as a staff member (guild moderator) at all?", + "sq6": "Why should we choose you as a Guild Moderator? (Tell us what would you do for the guild, how are you gonna help us grow the community, how many hours per day are you willing to spend doing the stuff as moderator for the guild etc..", + "rsq1": "What is your IGN?", + "rsq2": "How long have you been in the guild for?", + "rsq3": "Have you been guild muted for any reason?", + "rsq4": "Are you an active guild member?", + "rsq5": "Do you have any experience as a staff member (guild moderator) at all?", + "rsq6": "Why should we choose you as a Guild Moderator?" } \ No newline at end of file diff --git a/events/buttons/staffapplicationaccept.js b/events/buttons/staffapplicationaccept.js index a8cc829..99babfc 100644 --- a/events/buttons/staffapplicationaccept.js +++ b/events/buttons/staffapplicationaccept.js @@ -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() diff --git a/events/buttons/staffapply.js b/events/buttons/staffapply.js index 6bee3a5..85ba3bb 100644 --- a/events/buttons/staffapply.js +++ b/events/buttons/staffapply.js @@ -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") diff --git a/events/modals/staffdenyreasonbox.js b/events/modals/staffdenyreasonbox.js index 814f747..6c94df6 100644 --- a/events/modals/staffdenyreasonbox.js +++ b/events/modals/staffdenyreasonbox.js @@ -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",