Merge branch 'dev' into 'main'
Added waitinglist update to app accept See merge request illegitimate/illegitimate-bot!156
This commit is contained in:
@@ -10,5 +10,7 @@
|
||||
"botLogChannel": "1174403585149243472",
|
||||
"guildLogChannel": "1183733282534326322",
|
||||
"errorLogChannel": "1191051275442339951",
|
||||
"waitingListChannel": "1145773618291298384",
|
||||
"waitingListMessage": "1146027645415473193",
|
||||
"instructionsgif": "https://cdn.discordapp.com/attachments/838716950723952640/1188211176300089384/4DMu513uNxbM.gif?ex=6599b2e4&is=65873de4&hm=e727c7a39aacbc47d6a5453f4b5f792a45679983c30d662cd258a311381b6df0&"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
import { ActionRowBuilder, ButtonStyle, ButtonBuilder } from "discord.js"
|
||||
import { color } from "../../../config/options.json"
|
||||
import {
|
||||
ActionRowBuilder,
|
||||
ButtonStyle,
|
||||
ButtonBuilder,
|
||||
GuildTextBasedChannel,
|
||||
} from "discord.js"
|
||||
import {
|
||||
color,
|
||||
waitingListChannel,
|
||||
waitingListMessage,
|
||||
hypixelGuildID,
|
||||
} from "../../../config/options.json"
|
||||
import mongoose from "mongoose"
|
||||
import guildapp from "../../schemas/guildAppSchema"
|
||||
import waitingList from "../../schemas/waitinglistSchema"
|
||||
import { waitingListRole } from "../../../config/roles.json"
|
||||
import { Button } from "../../interfaces"
|
||||
import { getGuild } from "../../utils/Hypixel"
|
||||
|
||||
export = {
|
||||
name: "guildapplicationaccept",
|
||||
@@ -77,6 +88,53 @@ export = {
|
||||
await applicant.roles.add(waitingListRole)
|
||||
await guildapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
// update waiting list
|
||||
const channel = guild.channels.cache.get(
|
||||
waitingListChannel,
|
||||
) as GuildTextBasedChannel
|
||||
const wlmessage = await channel!.messages.fetch(waitingListMessage)
|
||||
|
||||
const wlembed = wlmessage.embeds[0]
|
||||
const accepted = await waitingList.find()
|
||||
|
||||
for (let i = 0; i < accepted.length; i++) {
|
||||
const uuid = accepted[i].uuid
|
||||
const guild = await getGuild(uuid)
|
||||
|
||||
if (guild && guild._id === hypixelGuildID) {
|
||||
await waitingList.findOneAndDelete({ uuid: uuid })
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
const fields: { name: string; value: string }[] = []
|
||||
|
||||
for (let i = 0; i < accepted.length; i++) {
|
||||
const timestamp = Math.floor(accepted[i].timestamp / 1000)
|
||||
|
||||
fields.push({
|
||||
name: `${i + 1}. ${accepted[i].IGN}`,
|
||||
value: `TS: <t:${timestamp}:R>`,
|
||||
})
|
||||
}
|
||||
|
||||
await wlmessage.edit({
|
||||
embeds: [
|
||||
{
|
||||
title: wlembed.title!,
|
||||
description: wlembed.description!,
|
||||
color: wlembed.color!,
|
||||
footer: {
|
||||
text: "Last updated by " + user.username,
|
||||
icon_url: user.avatarURL()!,
|
||||
},
|
||||
thumbnail: wlembed.thumbnail!,
|
||||
fields: fields,
|
||||
timestamp: new Date().toISOString(),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user