Updated guild application accept
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, TextChannel } from "discord.js"
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, TextChannel } from "discord.js"
|
||||||
import { getGuildApp, removeVerify } from "src/drizzle/functions"
|
import { getGuildApp, removeGuildApp } from "src/drizzle/functions"
|
||||||
import { addWaitingList, getWaitingLists, removeWaitingList } from "src/drizzle/functions"
|
import { addWaitingList, getWaitingLists, removeWaitingList } from "src/drizzle/functions"
|
||||||
import { embedColor, hypixelGuildID, waitingListChannel, waitingListMessage } from "~/config/options"
|
import { embedColor, hypixelGuildID, waitingListChannel, waitingListMessage } from "~/config/options"
|
||||||
import { waitingListRole } from "~/config/roles"
|
import { waitingListRole } from "~/config/roles"
|
||||||
@@ -21,8 +21,8 @@ export default {
|
|||||||
const embed = message.embeds[0]
|
const embed = message.embeds[0]
|
||||||
const applicantId = embed.footer!.text.split(" ")[1]
|
const applicantId = embed.footer!.text.split(" ")[1]
|
||||||
|
|
||||||
const applicant = await guild.members.fetch(applicantId)
|
const [, applicant] = await tryCatch(guild.members.fetch(applicantId))
|
||||||
const applicantUsername = applicant.user.username
|
const applicantUsername = applicant?.user.username
|
||||||
|
|
||||||
await message.edit({
|
await message.edit({
|
||||||
components: [
|
components: [
|
||||||
@@ -46,6 +46,17 @@ export default {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!applicant) {
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "Aplication has left the server and cannot be notified.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
await removeGuildApp({ userID: applicantId })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
await applicant.send({
|
await applicant.send({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
description: "Your application for the Illegitimate guild has been accepted.\n\n" +
|
description: "Your application for the Illegitimate guild has been accepted.\n\n" +
|
||||||
@@ -64,8 +75,8 @@ export default {
|
|||||||
timestamp: time
|
timestamp: time
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await removeGuildApp({ userID: applicantId, uuid: applicantUUID })
|
||||||
await applicant.roles.add(waitingListRole)
|
await applicant.roles.add(waitingListRole)
|
||||||
await removeVerify({ userID: applicantId })
|
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
Reference in New Issue
Block a user