Fixed formatting on button files

This commit is contained in:
2024-01-20 20:43:12 +01:00
parent 631581574c
commit 5ce69eced3
10 changed files with 802 additions and 1162 deletions

View File

@@ -1,22 +1,7 @@
import { color, devMessage } from "config/options.json" import { color, devMessage } from "config/options.json"
import guildapp from "schemas/guildAppSchema" import guildapp from "schemas/guildAppSchema"
import { import { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } from "config/reqs.json"
bwfkdr, import { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
bwstars,
bwwins,
swstars,
swkdr,
duelswins,
duelswlr
} from "config/reqs.json"
import {
hypixelLevel,
bedwarsLevel,
skywarsLevel,
getPlayer,
getGuild,
getHeadURL
} from "utils/Hypixel"
import { Button } from "interfaces" import { Button } from "interfaces"
export = { export = {
@@ -36,13 +21,10 @@ export = {
const player = await getPlayer(uuid) const player = await getPlayer(uuid)
if (!player) { if (!player) {
interaction.editReply({ interaction.editReply({
embeds: [ embeds: [{
{ description: "That player hasn't played Hypixel before.",
description: color: embedColor
"That player hasn't played Hypixel before.", }]
color: embedColor
}
]
}) })
return return
} }
@@ -97,149 +79,102 @@ export = {
}) })
} else { } else {
if (player.stats.Bedwars) { if (player.stats.Bedwars) {
const hsbwexp = player.stats?.Bedwars?.Experience || 0 const hsbwexp = player.stats.Bedwars?.Experience || 0
const hsbwfk = player.stats.Bedwars?.final_kills_bedwars || 0
const hsbwfd = player.stats.Bedwars?.final_deaths_bedwars || 0
const hsbwwins = player.stats.Bedwars?.wins_bedwars || 0
const hsbwstars = bedwarsLevel(hsbwexp) const hsbwstars = bedwarsLevel(hsbwexp)
const hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
const hsbwfkdr = hsbwfk / hsbwfd || 0 const hsbwfkdr = hsbwfk / hsbwfd || 0
const hsbwwins = player.stats?.Bedwars?.wins_bedwars || 0
let bwtitle = "" let bwtitle = ""
if ( if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
hsbwstars < bwstars || bwtitle = "<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
hsbwfkdr < bwfkdr ||
hsbwwins < bwwins
) {
bwtitle =
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
} else { } else {
bwtitle = bwtitle = "<a:check_a:1087808632172847134> This player meets the BedWars requirements."
"<a:check_a:1087808632172847134> This player meets the BedWars requirements."
} }
statsFields.push({ statsFields.push({
name: bwtitle, name: bwtitle,
value: value: "**➺ Stars:** `" + hsbwstars.toFixed(2).toString() +
"**➺ Stars:** `" + " / " + bwstars.toString() + "`\n" +
hsbwstars.toFixed(2).toString() + "**➺ FKDR:** `" + hsbwfkdr.toFixed(2).toString() +
" / " + " / " + bwfkdr.toString() + "`\n" +
bwstars.toString() + "**➺ Wins:** `" + hsbwwins.toString() +
"`\n" + " / " + bwwins.toString() + "`"
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " +
bwfkdr.toString() +
"`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() +
" / " +
bwwins.toString() +
"`"
}) })
} }
if (player.stats.SkyWars) { if (player.stats.SkyWars) {
const hsswexp = player.stats?.SkyWars?.skywars_experience || 0 const hsswexp = player.stats.SkyWars?.skywars_experience || 0
const hsswkills = player.stats.SkyWars?.kills || 0
const hsswdeaths = player.stats.SkyWars?.deaths || 0
const hsswwins = player.stats.SkyWars?.wins || 0
const hsswstars = skywarsLevel(hsswexp) const hsswstars = skywarsLevel(hsswexp)
const hsswkills = player.stats?.SkyWars?.kills || 0
const hsswdeaths = player.stats?.SkyWars?.deaths || 0
const hsswkd = hsswkills / hsswdeaths const hsswkd = hsswkills / hsswdeaths
const hsswwins = player.stats?.SkyWars?.wins || 0
let swtitle = "" let swtitle = ""
if (hsswstars < swstars || hsswkd < swkdr) { if (hsswstars < swstars || hsswkd < swkdr) {
swtitle = swtitle = "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
"<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
} else { } else {
swtitle = swtitle = "<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
"<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
} }
statsFields.push({ statsFields.push({
name: swtitle, name: swtitle,
value: value: "**➺ Stars:** `" + hsswstars.toFixed(2).toString() +
"**➺ Stars:** `" + " / " + swstars.toString() + "`\n" +
hsswstars.toFixed(2).toString() + "**➺ KDR:** `" + hsswkd.toFixed(2).toString() +
" / " + " / " + swkdr.toString() + "`\n" +
swstars.toString() + "**➺ Wins:** `" + hsswwins.toString() + "`"
"`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() +
" / " +
swkdr.toString() +
"`\n" +
"**➺ Wins:** `" +
hsswwins.toString() +
"`"
}) })
} }
if (player.stats.Duels) { if (player.stats.Duels) {
const hsduelskills = player.stats?.Duels?.kills || 0 const hsduelskills = player.stats.Duels?.kills || 0
const hsduelsdeaths = player.stats?.Duels?.deaths || 0 const hsduelsdeaths = player.stats.Duels?.deaths || 0
const hsduelswins = player.stats.Duels?.wins || 0
const hsduelslosses = player.stats.Duels?.losses || 0
const hsduelskd = hsduelskills / hsduelsdeaths const hsduelskd = hsduelskills / hsduelsdeaths
const hsduelswins = player.stats?.Duels?.wins || 0
const hsduelslosses = player.stats?.Duels?.losses || 0
const hsduelswlr = hsduelswins / hsduelslosses const hsduelswlr = hsduelswins / hsduelslosses
let duelstitle = "" let duelstitle = ""
if (hsduelswins < duelswins || hsduelswlr < duelswlr) { if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
duelstitle = duelstitle = "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
"<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
} else { } else {
duelstitle = duelstitle = "<a:check_a:1087808632172847134> This player meets the Duels requirements."
"<a:check_a:1087808632172847134> This player meets the Duels requirements."
} }
statsFields.push({ statsFields.push({
name: duelstitle, name: duelstitle,
value: value: "**➺ Wins:** `" + hsduelswins.toString() +
"**➺ Wins:** `" + " / " + duelswins.toString() + "`\n" +
hsduelswins.toString() + "**➺ WLR:** `" + hsduelswlr.toFixed(2).toString() +
" / " + " / " + duelswlr.toString() + "`\n" +
duelswins.toString() + "**➺ KDR:** `" + hsduelskd.toFixed(2).toString() + "`"
"`\n" +
"**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() +
" / " +
duelswlr.toString() +
"`\n" +
"**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() +
"`"
}) })
} }
} }
// network level // network level
const hypixelExp = player.networkExp || 0 const hypixelExp = player?.networkExp || 0
const level = hypixelLevel(hypixelExp) const level = hypixelLevel(hypixelExp)
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [{
{ title: rank + player.displayname + guildTag,
title: rank + player.displayname + guildTag, description: "**Network Level:** `" + level.toFixed(2).toString() + "`\n" +
description: "**Current Guild:** `" + guildName + "`\n" +
"**Network Level:** `" + "**Guild Rank:** `" + guildRank + "`",
level.toFixed(2).toString() + color: embedColor,
"`\n" + thumbnail: {
"**Current Guild:** `" + url: head!
guildName + },
"`\n" + footer: {
"**Guild Rank:** `" + text: interaction.guild!.name + " | " + devMessage,
guildRank + icon_url: interaction.guild!.iconURL() || undefined
"`", },
color: embedColor, fields: statsFields
thumbnail: { }]
url: head!
},
footer: {
text: interaction.guild!.name + " | " + devMessage,
icon_url: interaction.guild!.iconURL() || undefined
},
fields: statsFields
}
]
}) })
} }
} as Button } as Button

View File

@@ -1,15 +1,5 @@
import { import { ActionRowBuilder, ButtonStyle, ButtonBuilder, TextChannel } from "discord.js"
ActionRowBuilder, import { color, waitingListChannel, waitingListMessage, hypixelGuildID } from "config/options.json"
ButtonStyle,
ButtonBuilder,
TextChannel
} from "discord.js"
import {
color,
waitingListChannel,
waitingListMessage,
hypixelGuildID
} from "config/options.json"
import colorLog from "utils/functions/colors" import colorLog from "utils/functions/colors"
import mongoose from "mongoose" import mongoose from "mongoose"
import guildapp from "schemas/guildAppSchema" import guildapp from "schemas/guildAppSchema"
@@ -35,8 +25,7 @@ export = {
const applicantIGN = embed.fields[0].value.replaceAll("`", "") const applicantIGN = embed.fields[0].value.replaceAll("`", "")
const applicant = await guild.members.fetch(applicantId) const applicant = await guild.members.fetch(applicantId)
const applicantUsername = const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
applicant.user.username + "#" + applicant.user.discriminator
await message.edit({ await message.edit({
components: [ components: [
@@ -61,14 +50,11 @@ export = {
}) })
await applicant.send({ await applicant.send({
embeds: [ embeds: [{
{ description: "Your application for the Illegitimate guild has been accepted.\n\n" +
description: "Make sure to leave your current guild so that we can invite you.",
"Your application for the Illegitimate guild has been accepted.\n\n" + color: embedColor
"Make sure to leave your current guild so that we can invite you.", }]
color: embedColor
}
]
}) })
const applicantEntry = await guildapp.findOne({ userID: applicantId }) const applicantEntry = await guildapp.findOne({ userID: applicantId })
@@ -89,28 +75,23 @@ export = {
await guildapp.findOneAndDelete({ userID: applicantId }) await guildapp.findOneAndDelete({ userID: applicantId })
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [{
{ title: applicantUsername + " - Guild Application",
title: applicantUsername + " - Guild Application", description: "Application has been accepted by <@" + user.id + ">.",
description: color: embedColor,
"Application has been accepted by <@" + user.id + ">.", thumbnail: {
color: embedColor, url: applicant.avatarURL() || ""
thumbnail: { },
url: applicant.avatarURL() || "" footer: {
}, icon_url: guild.iconURL() || undefined,
footer: { text: "ID: " + applicant.id
icon_url: guild.iconURL() || undefined,
text: "ID: " + applicant.id
}
} }
] }]
}) })
if (process.env.NODE_ENV === "dev") return if (process.env.NODE_ENV === "dev") return
try { try {
const channel = guild.channels.cache.get( const channel = guild.channels.cache.get(waitingListChannel) as TextChannel
waitingListChannel
) as TextChannel
const wlmessage = await channel!.messages.fetch(waitingListMessage) const wlmessage = await channel!.messages.fetch(waitingListMessage)
const wlembed = wlmessage.embeds[0] const wlembed = wlmessage.embeds[0]
@@ -138,20 +119,18 @@ export = {
} }
await wlmessage.edit({ await wlmessage.edit({
embeds: [ embeds: [{
{ title: wlembed.title!,
title: wlembed.title!, description: wlembed.description!,
description: wlembed.description!, color: wlembed.color!,
color: wlembed.color!, footer: {
footer: { text: "Last updated by " + user.username,
text: "Last updated by " + user.username, icon_url: user.avatarURL() || undefined
icon_url: user.avatarURL() || undefined },
}, thumbnail: wlembed.thumbnail!,
thumbnail: wlembed.thumbnail!, fields: fields,
fields: fields, timestamp: new Date().toISOString()
timestamp: new Date().toISOString() }]
}
]
}) })
} catch (err) { } catch (err) {
console.log( console.log(

View File

@@ -1,9 +1,4 @@
import { import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
ModalBuilder,
ActionRowBuilder,
TextInputBuilder,
TextInputStyle
} from "discord.js"
import { Button } from "interfaces" import { Button } from "interfaces"
export = { export = {
@@ -20,9 +15,7 @@ export = {
.setLabel("Deny Reason") .setLabel("Deny Reason")
.setCustomId("denyreason") .setCustomId("denyreason")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setPlaceholder( .setPlaceholder("Enter a reason for denying the application")
"Enter a reason for denying the application"
)
.setRequired(false) .setRequired(false)
) )
) )

File diff suppressed because it is too large Load Diff

View File

@@ -1,35 +1,13 @@
import { import { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder, GuildMember, TextChannel } from "discord.js"
ButtonBuilder, import { gm, manager, moderator, beast, member, guildStaff, guildRole } from "config/roles.json"
ActionRowBuilder,
ButtonStyle,
EmbedBuilder,
GuildMember,
TextChannel
} from "discord.js"
import {
gm,
manager,
moderator,
beast,
member,
guildStaff,
guildRole
} from "config/roles.json"
import { ignM, smallM, largeM } from "config/limitmessages.json" import { ignM, smallM, largeM } from "config/limitmessages.json"
import { inactivity } from "config/questions.json" import { inactivity } from "config/questions.json"
import { color, inactivityLogChannel } from "config/options.json" import { color, inactivityLogChannel } from "config/options.json"
import { Button } from "interfaces" import { Button } from "interfaces"
const guildRoles = [ import { getIGN } from "utils/Hypixel"
gm, const guildRoles = [gm, manager, moderator, beast, member, guildStaff, guildRole]
manager,
moderator,
beast,
member,
guildStaff,
guildRole
]
module.exports = { export = {
name: "guildinactivitylog", name: "guildinactivitylog",
description: "Configure the bot.", description: "Configure the bot.",
@@ -38,7 +16,6 @@ module.exports = {
const user = interaction.member as GuildMember const user = interaction.member as GuildMember
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
const userRoles = user.roles.cache const userRoles = user.roles.cache
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"
if (!userRoles.some(role => guildRoles.includes(role.id))) { if (!userRoles.some(role => guildRoles.includes(role.id))) {
return await interaction.reply({ return await interaction.reply({
@@ -62,25 +39,20 @@ module.exports = {
.setDescription("You have cancelled your application.") .setDescription("You have cancelled your application.")
.setColor(embedColor) .setColor(embedColor)
const attachments = new EmbedBuilder() const attachments = new EmbedBuilder()
.setDescription( .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
"You have uploaded an attachment. Please do not upload images, videos, or GIFS."
)
.setColor(embedColor) .setColor(embedColor)
try { try {
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "Guild Inactivity Log",
title: "Guild Inactivity Log", description: "Please answer the following questions to submit an inactivity log for the guild.\n" +
description: "If you wish to cancel your form, please press type `cancel` at any time.\n" +
"Please answer the following questions to submit an inactivity log for the guild.\n" + "If you wish to proceed with your form, please type `yes`.\n\n" +
"If you wish to cancel your form, please press type `cancel` at any time.\n" + "**Do not upload images, videos, or GIFS.**\n" +
"If you wish to proceed with your form, please type `yes`.\n\n" + "You have a minute to respond to this message.",
"**Do not upload images, videos, or GIFS.**\n" + color: embedColor
"You have a minute to respond to this message.", }]
color: embedColor
}
]
}) })
} catch (error) { } catch (error) {
return await interaction.reply({ return await interaction.reply({
@@ -113,20 +85,14 @@ module.exports = {
} }
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 1**",
title: "**Question 1**", description: sq(1) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
description: color: embedColor,
sq(1) + footer: {
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + text: "You have 5 minutes to respond to this message."
ignM +
"`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message."
}
} }
] }]
}) })
const answer1 = await user.dmChannel!.awaitMessages({ const answer1 = await user.dmChannel!.awaitMessages({
@@ -140,27 +106,10 @@ module.exports = {
} }
if (answer1.first()!.content.length > 16) { if (answer1.first()!.content.length > 16) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 16.",
description: "Max character limit is 16.", color: embedColor
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 return
} }
@@ -172,23 +121,27 @@ module.exports = {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (await getIGN(answer1.first()!.content)) {
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 answer1_1 = answer1.first()!.content
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 2**",
title: "**Question 2**", description: sq(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
description: color: embedColor,
sq(2) + footer: {
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + text: "You have 5 minutes to respond to this message."
smallM +
"`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message."
}
} }
] }]
}) })
const answer2 = await user.dmChannel!.awaitMessages({ const answer2 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -201,12 +154,10 @@ module.exports = {
} }
if (answer2.first()!.content.length > 128) { if (answer2.first()!.content.length > 128) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 128.",
description: "Max character limit is 128.", color: embedColor
color: embedColor }]
}
]
}) })
return return
} }
@@ -221,20 +172,14 @@ module.exports = {
const answer2_1 = answer1.first()!.content const answer2_1 = answer1.first()!.content
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 3**",
title: "**Question 3**", description: sq(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
description: color: embedColor,
sq(3) + footer: {
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + text: "You have 15 minutes to respond to this message."
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
} }
] }]
}) })
const answer3 = await user.dmChannel!.awaitMessages({ const answer3 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -247,12 +192,10 @@ module.exports = {
} }
if (answer3.first()!.content.length > 256) { if (answer3.first()!.content.length > 256) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 256",
description: "Max character limit is 256", color: embedColor
color: embedColor }]
}
]
}) })
return return
} }
@@ -267,13 +210,10 @@ module.exports = {
const answer3_1 = answer1.first()!.content const answer3_1 = answer1.first()!.content
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "If you want to submit your application, type `yes` if not, type `no`",
description: color: embedColor
"If you want to submit your application, type `yes` if not, type `no`", }]
color: embedColor
}
]
}) })
const final = await user.dmChannel!.awaitMessages({ const final = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -294,50 +234,40 @@ module.exports = {
} }
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Your application has been submitted!",
description: "Your application has been submitted!", color: embedColor
color: embedColor }]
}
]
}) })
const appChannel = guild.channels.cache.get( const appChannel = guild.channels.cache.get(inactivityLogChannel) as TextChannel
inactivityLogChannel
) as TextChannel
await appChannel.send({ await appChannel.send({
embeds: [ embeds: [{
{ title: user.user.username + "#" + user.user.discriminator + " - Inactivity Application",
title: color: embedColor,
user.user.username + thumbnail: {
"#" + url: user.avatarURL() || ""
user.user.discriminator + },
" - Inactivity Application", fields: [
color: embedColor, {
thumbnail: { name: rq(1),
url: user.avatarURL() || "" value: "`" + answer1_1 + "`"
}, },
fields: [ {
{ name: rq(2),
name: rq(1), value: "`" + answer2_1 + "`"
value: "`" + answer1_1 + "`" },
}, {
{ name: rq(3),
name: rq(2), value: "`" + answer3_1 + "`"
value: "`" + answer2_1 + "`"
},
{
name: rq(3),
value: "`" + answer3_1 + "`"
}
],
footer: {
icon_url: user.avatarURL() || undefined,
text: "ID: " + user.user.id
} }
],
footer: {
icon_url: user.avatarURL() || undefined,
text: "ID: " + user.user.id
} }
], }],
components: [ components: [
new ActionRowBuilder<ButtonBuilder>().addComponents( new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder() new ButtonBuilder()

View File

@@ -19,17 +19,13 @@ export = {
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 = const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
applicant.user.username + "#" + applicant.user.discriminator
await applicant.send({ await applicant.send({
embeds: [ embeds: [{
{ description: "Your application for the Illegitimate staff team has been accepted.",
description: color: embedColor
"Your application for the Illegitimate staff team has been accepted.", }]
color: embedColor
}
]
}) })
await message.edit({ await message.edit({
@@ -52,20 +48,18 @@ export = {
await staffapp.findOneAndDelete({ userID: applicantId }) await staffapp.findOneAndDelete({ userID: applicantId })
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [{
{ title: applicantUsername + " - Staff Application.",
title: applicantUsername + " - Staff Application.", description: "Application accepted by <@" + user.id + ">.",
description: "Application accepted by <@" + user.id + ">.", color: embedColor,
color: embedColor, thumbnail: {
thumbnail: { url: applicant.avatarURL() || ""
url: applicant.avatarURL() || "" },
}, footer: {
footer: { icon_url: guild.iconURL() || undefined,
icon_url: guild.iconURL() || undefined, text: "ID: " + applicantId
text: "ID: " + applicantId
}
} }
] }]
}) })
} }
} as Button } as Button

View File

@@ -1,9 +1,4 @@
import { import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
ModalBuilder,
ActionRowBuilder,
TextInputBuilder,
TextInputStyle
} from "discord.js"
import { Button } from "interfaces" import { Button } from "interfaces"
export = { export = {
@@ -20,9 +15,7 @@ export = {
.setLabel("Deny Reason") .setLabel("Deny Reason")
.setCustomId("staffdenyreason") .setCustomId("staffdenyreason")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setPlaceholder( .setPlaceholder( "Enter a reason for denying the application")
"Enter a reason for denying the application"
)
.setRequired(false) .setRequired(false)
) )
) )

View File

@@ -1,11 +1,4 @@
import { import { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, GuildMember, TextChannel } from "discord.js"
ButtonBuilder,
ButtonStyle,
ActionRowBuilder,
EmbedBuilder,
GuildMember,
TextChannel
} from "discord.js"
import { color, staffApplicationsChannel } from "config/options.json" import { color, staffApplicationsChannel } from "config/options.json"
import { largeM, ignM } from "config/limitmessages.json" import { largeM, ignM } from "config/limitmessages.json"
import questions from "config/questions.json" import questions from "config/questions.json"
@@ -43,17 +36,13 @@ export = {
if (user.user.id !== env.prod.dev) { if (user.user.id !== env.prod.dev) {
if (status === "0") { if (status === "0") {
await interaction.editReply( await interaction.editReply("Staff applications are currently closed.")
"Staff applications are currently closed."
)
return return
} }
} }
if (!userRoles.has(guildRole)) { if (!userRoles.has(guildRole)) {
await interaction.editReply( await interaction.editReply("You must be a member of the guild to apply for staff.")
"You must be a member of the guild to apply for staff."
)
return return
} }
@@ -65,9 +54,7 @@ export = {
const application = await staffapp.findOne({ userID: user.user.id }) const application = await staffapp.findOne({ userID: user.user.id })
if (application) { if (application) {
await interaction.editReply( await interaction.editReply("You already have an application in progress.")
"You already have an application in progress."
)
return return
} }
@@ -78,23 +65,18 @@ export = {
.setDescription("You have cancelled your application.") .setDescription("You have cancelled your application.")
.setColor(embedColor) .setColor(embedColor)
const attachments = new EmbedBuilder() const attachments = new EmbedBuilder()
.setDescription( .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
"You have uploaded an attachment. Please do not upload images, videos, or GIFS."
)
.setColor(embedColor) .setColor(embedColor)
try { try {
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "Staff Application",
title: "Staff Application", description: "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" +
description: "**Do not upload images, videos, or GIFS.**\n" +
"If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" + "You have a minute to respond to this message.",
"**Do not upload images, videos, or GIFS.**\n" + color: embedColor
"You have a minute to respond to this message.", }]
color: embedColor
}
]
}) })
} catch (error) { } catch (error) {
await interaction.editReply("Please enable your DMs.") await interaction.editReply("Please enable your DMs.")
@@ -123,20 +105,14 @@ export = {
// first question // first question
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 1**",
title: "**Question 1**", description: sq(1) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
description: color: embedColor,
sq(1) + footer: {
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + text: "You have 5 minutes to respond to this message."
ignM +
"`",
color: embedColor,
footer: {
text: "You have 5 minutes to respond to this message."
}
} }
] }]
}) })
const answer1 = await user.dmChannel!.awaitMessages({ const answer1 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -157,26 +133,21 @@ export = {
} }
if (answer1.first()!.content.length > 16) { if (answer1.first()!.content.length > 16) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 16.",
description: "Max character limit is 16.", color: embedColor
color: embedColor }]
}
]
}) })
return return
} }
const uuid = await getUUID(answer1.first()!.content) const uuid = await getUUID(answer1.first()!.content)
if (!uuid) { if (!uuid) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "That is not a valid Minecraft username.\n" +
description: "Application cancelled.",
"That is not a valid Minecraft username.\n" + color: embedColor
"Application cancelled.", }]
color: embedColor
}
]
}) })
return return
} }
@@ -184,19 +155,15 @@ export = {
// second question // second question
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 2**",
title: "**Question 2**", description: sq(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" +
description: "`(64 characters max)`",
sq(2) + color: embedColor,
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + footer: {
"`(64 characters max)`", text: "You have 15 minutes to respond to this message."
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
} }
] }]
}) })
const answer2 = await user.dmChannel!.awaitMessages({ const answer2 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -217,12 +184,10 @@ export = {
} }
if (answer2.first()!.content.length > 64) { if (answer2.first()!.content.length > 64) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 64.",
description: "Max character limit is 64.", color: embedColor
color: embedColor }]
}
]
}) })
return return
} }
@@ -230,20 +195,14 @@ export = {
// third question // third question
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 3**",
title: "**Question 3**", description: sq(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
description: color: embedColor,
sq(3) + footer: {
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + text: "You have 15 minutes to respond to this message."
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
} }
] }]
}) })
const answer3 = await user.dmChannel!.awaitMessages({ const answer3 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -264,32 +223,24 @@ export = {
} }
if (answer3.first()!.content.length > 256) { if (answer3.first()!.content.length > 256) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 256.",
description: "Max character limit is 256.", color: embedColor
color: embedColor }]
}
]
}) })
} }
const answer3_1 = answer3.first()!.content const answer3_1 = answer3.first()!.content
// fourth question // fourth question
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 4**",
title: "**Question 4**", description: sq(4) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
description: color: embedColor,
sq(4) + footer: {
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + text: "You have 15 minutes to respond to this message."
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
} }
] }]
}) })
const answer4 = await user.dmChannel!.awaitMessages({ const answer4 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -310,32 +261,24 @@ export = {
} }
if (answer4.first()!.content.length > 256) { if (answer4.first()!.content.length > 256) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 256.",
description: "Max character limit is 256.", color: embedColor
color: embedColor }]
}
]
}) })
} }
const answer4_1 = answer4.first()!.content const answer4_1 = answer4.first()!.content
// fifth question // fifth question
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 5**",
title: "**Question 5**", description: sq(5) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
description: color: embedColor,
sq(5) + footer: {
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + text: "You have 15 minutes to respond to this message."
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
} }
] }]
}) })
const answer5 = await user.dmChannel!.awaitMessages({ const answer5 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -356,33 +299,25 @@ export = {
} }
if (answer5.first()!.content.length > 256) { if (answer5.first()!.content.length > 256) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 256.",
description: "Max character limit is 256.", color: embedColor
color: embedColor }]
}
]
}) })
} }
const answer5_1 = answer5.first()!.content const answer5_1 = answer5.first()!.content
// sixth question // sixth question
await user.send({ await user.send({
embeds: [ embeds: [{
{ title: "**Question 6**",
title: "**Question 6**", description: sq(6) + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
description: "`(We expect a longer answer here)`\n`" + largeM + "`",
sq(6) + color: embedColor,
"\n\nPlease type your answer below or type `cancel` to cancel your application." + footer: {
"`(We expect a longer answer here)`\n`" + text: "You have 15 minutes to respond to this message."
largeM +
"`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
} }
] }]
}) })
const answer6 = await user.dmChannel!.awaitMessages({ const answer6 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id, filter: m => m.author.id === user.user.id,
@@ -403,24 +338,19 @@ export = {
} }
if (answer6.first()!.content.length > 256) { if (answer6.first()!.content.length > 256) {
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Max character limit is 256.",
description: "Max character limit is 256.", color: embedColor
color: embedColor }]
}
]
}) })
} }
const answer6_1 = answer6.first()!.content const answer6_1 = answer6.first()!.content
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "If you want to submit your application, type `yes` if not, type `no`",
description: color: embedColor
"If you want to submit your application, type `yes` if not, type `no`", }]
color: embedColor
}
]
}) })
const final = await user.dmChannel!.awaitMessages({ const final = await user.dmChannel!.awaitMessages({
@@ -442,12 +372,10 @@ export = {
} }
await user.send({ await user.send({
embeds: [ embeds: [{
{ description: "Your application has been submitted!",
description: "Your application has been submitted!", color: embedColor
color: embedColor }]
}
]
}) })
const newStaffApp = new staffapp({ const newStaffApp = new staffapp({
@@ -459,54 +387,46 @@ export = {
await newStaffApp.save() await newStaffApp.save()
await user.deleteDM() await user.deleteDM()
const channel = guild.channels.cache.get( const channel = guild.channels.cache.get(staffApplicationsChannel) as TextChannel
staffApplicationsChannel
) as TextChannel
await channel.send({ await channel.send({
embeds: [ embeds: [{
{ title: user.user.username + "#" + user.user.discriminator + " - Staff Application",
title: color: embedColor,
user.user.username + thumbnail: {
"#" + url: user.avatarURL() || ""
user.user.discriminator + },
" - Staff Application", fields: [
color: embedColor, {
thumbnail: { name: rq(1),
url: user.avatarURL() || "" value: "```" + answer1_1 + "```"
}, },
fields: [ {
{ name: rq(2),
name: rq(1), value: "```" + answer2_1 + "```"
value: "```" + answer1_1 + "```" },
}, {
{ name: rq(3),
name: rq(2), value: "```" + answer3_1 + "```"
value: "```" + answer2_1 + "```" },
}, {
{ name: rq(4),
name: rq(3), value: "```" + answer4_1 + "```"
value: "```" + answer3_1 + "```" },
}, {
{ name: rq(5),
name: rq(4), value: "```" + answer5_1 + "```"
value: "```" + answer4_1 + "```" },
}, {
{ name: rq(6),
name: rq(5), value: "```" + answer6_1 + "```"
value: "```" + answer5_1 + "```"
},
{
name: rq(6),
value: "```" + answer6_1 + "```"
}
],
footer: {
icon_url: guild.iconURL() || undefined,
text: "ID: " + user.user.id
} }
],
footer: {
icon_url: guild.iconURL() || undefined,
text: "ID: " + user.user.id
} }
], }],
components: [ components: [
new ActionRowBuilder<ButtonBuilder>().addComponents( new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder() new ButtonBuilder()

View File

@@ -1,9 +1,4 @@
import { import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
ModalBuilder,
ActionRowBuilder,
TextInputBuilder,
TextInputStyle
} from "discord.js"
import { Button } from "interfaces" import { Button } from "interfaces"
export = { export = {

View File

@@ -37,20 +37,18 @@ export = {
} }
await message.edit({ await message.edit({
embeds: [ embeds: [{
{ title: embed.title!,
title: embed.title!, description: embed.description!,
description: embed.description!, color: embed.color!,
color: embed.color!, footer: {
footer: { text: "Last updated by " + user.username,
text: "Last updated by " + user.username, icon_url: user.avatarURL() || undefined
icon_url: user.avatarURL() || undefined },
}, thumbnail: embed.thumbnail!,
thumbnail: embed.thumbnail!, fields: fields,
fields: fields, timestamp: new Date().toISOString()
timestamp: new Date().toISOString() }]
}
]
}) })
await interaction.editReply("Updated the waiting list") await interaction.editReply("Updated the waiting list")