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

View File

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

View File

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

View File

@@ -1,11 +1,4 @@
import {
ButtonBuilder,
ButtonStyle,
ActionRowBuilder,
EmbedBuilder,
GuildMember,
TextChannel
} from "discord.js"
import { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, GuildMember, TextChannel } from "discord.js"
import { color } from "config/options.json"
import { largeM, smallM, ignM } from "config/limitmessages.json"
import { applicationsChannel } from "config/options.json"
@@ -21,6 +14,7 @@ export = {
description: "Guild application button.",
async execute(interaction) {
await interaction.deferReply({ ephemeral: true })
const user = interaction.member as GuildMember
const guild = interaction.guild!
const embedColor = Number(color.replace("#", "0x"))
@@ -35,22 +29,15 @@ export = {
return guildQuestions[n - 1].r
}
if (interaction.customId === "guildapply") {
await interaction.deferReply({ ephemeral: true })
if (userRoles.includes(guildRole)) {
await interaction.editReply(
"You are already a member of the guild."
)
await interaction.editReply("You are already a member of the guild.")
return
}
const application = await guildapp.findOne({ userID: user.user.id })
if (application) {
await interaction.editReply(
"You already have an application in progress."
)
await interaction.editReply("You already have an application in progress.")
return
}
@@ -61,23 +48,18 @@ export = {
.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."
)
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
.setColor(embedColor)
try {
await user.send({
embeds: [
{
embeds: [{
title: "Guild Application",
description:
"If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" +
description: "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\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("Please enable your DMs.")
@@ -106,20 +88,14 @@ export = {
// first question
await user.send({
embeds: [
{
embeds: [{
title: "**Question 1**",
description:
qu(1) +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
ignM +
"`",
description: qu(1) + "\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.user.id,
@@ -140,26 +116,21 @@ export = {
}
if (answer1.first()!.content.length > 16) {
await user.send({
embeds: [
{
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" +
embeds: [{
description: "That is not a valid Minecraft username.\n" +
"Application cancelled.",
color: embedColor
}
]
}]
})
return
}
@@ -167,19 +138,14 @@ export = {
// second question
await user.send({
embeds: [
{
embeds: [{
title: "**Question 2**",
description:
qu(2) +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n" +
"`(8 characters max)`",
description: qu(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(8 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.user.id,
@@ -200,12 +166,10 @@ export = {
}
if (answer2.first()!.content.length > 8) {
await user.send({
embeds: [
{
embeds: [{
description: "Max character limit is 8.",
color: embedColor
}
]
}]
})
return
}
@@ -213,20 +177,14 @@ export = {
// third question
await user.send({
embeds: [
{
embeds: [{
title: "**Question 3**",
description:
qu(3) +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
smallM +
"`",
description: qu(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
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.user.id,
@@ -247,33 +205,25 @@ export = {
}
if (answer3.first()!.content.length > 128) {
await user.send({
embeds: [
{
embeds: [{
description: "Max character limit is 128.",
color: embedColor
}
]
}]
})
}
const answer3_1 = answer3.first()!.content
// fourth question
await user.send({
embeds: [
{
embeds: [{
title: "**Question 4**",
description:
qu(4) +
"\n\nPlease type your answer below or type `cancel` to cancel your application." +
" `(We expect a longer answer.)`\n`" +
largeM +
"`",
description: qu(4) + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
" `(We expect a longer answer.)`\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.user.id,
@@ -294,32 +244,24 @@ export = {
}
if (answer4.first()!.content.length > 256) {
await user.send({
embeds: [
{
embeds: [{
description: "Max character limit is 256.",
color: embedColor
}
]
}]
})
}
const answer4_1 = answer4.first()!.content
// fifth question
await user.send({
embeds: [
{
embeds: [{
title: "**Question 5**",
description:
qu(5) +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
smallM +
"`",
description: qu(5) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
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.user.id,
@@ -340,32 +282,24 @@ export = {
}
if (answer5.first()!.content.length > 128) {
await user.send({
embeds: [
{
embeds: [{
description: "Max character limit is 128.",
color: embedColor
}
]
}]
})
}
const answer5_1 = answer5.first()!.content
// sixth question
await user.send({
embeds: [
{
embeds: [{
title: "**Question 6**",
description:
qu(6) +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
largeM +
"`",
description: qu(6) + "\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 answer6 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id,
@@ -386,32 +320,24 @@ export = {
}
if (answer6.first()!.content.length > 256) {
await user.send({
embeds: [
{
embeds: [{
description: "Max character limit is 256.",
color: embedColor
}
]
}]
})
}
const answer6_1 = answer6.first()!.content
// seventh question
await user.send({
embeds: [
{
embeds: [{
title: "**Question 7**",
description:
qu(7) +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
smallM +
"`",
description: qu(7) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
color: embedColor,
footer: {
text: "You have 15 minutes to respond to this message."
}
}
]
}]
})
const answer7 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id,
@@ -432,31 +358,24 @@ export = {
}
if (answer7.first()!.content.length > 128) {
await user.send({
embeds: [
{
embeds: [{
description: "Max character limit is 128.",
color: embedColor
}
]
}]
})
}
const answer7_1 = answer7!.first()!.content
// eighth question
await user.send({
embeds: [
{
embeds: [{
title: "**Question 8**",
description:
qu(8) +
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n" +
"`(64 characters max)`",
description: qu(8) + "\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 answer8 = await user.dmChannel!.awaitMessages({
filter: m => m.author.id === user.user.id,
@@ -477,24 +396,19 @@ export = {
}
if (answer8.first()!.content.length > 64) {
await user.send({
embeds: [
{
embeds: [{
description: "Max character limit is 64.",
color: embedColor
}
]
}]
})
}
const answer8_1 = answer8.first()!.content
await user.send({
embeds: [
{
description:
"If you want to submit your application, type `yes` if not, type `no`",
embeds: [{
description: "If you want to submit your application, type `yes` if not, type `no`",
color: embedColor
}
]
}]
})
const final = await user.dmChannel!.awaitMessages({
@@ -516,12 +430,10 @@ export = {
}
await user.send({
embeds: [
{
embeds: [{
description: "Your application has been submitted!",
color: embedColor
}
]
}]
})
const newGuildApp = new guildapp({
@@ -532,17 +444,10 @@ export = {
await newGuildApp.save()
const channel = guild.channels.cache.get(
applicationsChannel
) as TextChannel
const channel = guild.channels.cache.get(applicationsChannel) as TextChannel
await channel.send({
embeds: [
{
title:
user.user.username +
"#" +
user.user.discriminator +
" - Guild Application",
embeds: [{
title: user.user.username + "#" + user.user.discriminator + " - Guild Application",
color: embedColor,
thumbnail: {
url: user.avatarURL() || ""
@@ -585,8 +490,7 @@ export = {
icon_url: guild.iconURL() || "",
text: "ID: " + user.user.id
}
}
],
}],
components: [
new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
@@ -605,5 +509,4 @@ export = {
]
})
}
}
} as Button

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -37,8 +37,7 @@ export = {
}
await message.edit({
embeds: [
{
embeds: [{
title: embed.title!,
description: embed.description!,
color: embed.color!,
@@ -49,8 +48,7 @@ export = {
thumbnail: embed.thumbnail!,
fields: fields,
timestamp: new Date().toISOString()
}
]
}]
})
await interaction.editReply("Updated the waiting list")