diff --git a/src/commands/forceupdate.ts b/src/commands/forceupdate.ts index f97d71f..f993fd9 100644 --- a/src/commands/forceupdate.ts +++ b/src/commands/forceupdate.ts @@ -151,11 +151,7 @@ export = { replyRank = "Member" } - // FIXME: need to check if user is on waiting list - if (user.roles.cache.has(waitingListRole)) { - await user.roles.remove(waitingListRole, "User was force updated.") - } - + await user.roles.remove(waitingListRole, "User was force updated.") await user.setNickname(ign, "User was force updated.").catch(() => { // Do nothing }) @@ -164,7 +160,7 @@ export = { embeds: [{ description: ` ${usermentioned} was given the \`${replyRank}\` role. - + IGN: \`${ign}\` `, color: embedColor, diff --git a/src/commands/remove.ts b/src/commands/remove.ts index 4767d8b..abc8ab0 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -1,13 +1,14 @@ -import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js" import { embedColor, devMessage } from "config/options" import waitinglistSchema from "schemas/waitinglistSchema" import { ICommand } from "interfaces" import logToChannel from "utils/functions/logtochannel" +import { waitingListRole } from "config/roles" export = { name: "remove", description: "Remove a person on the waiting list.", - false: true, + dev: false, public: false, data: new SlashCommandBuilder() @@ -31,22 +32,23 @@ export = { async execute(interaction) { await interaction.deferReply() - const user = interaction.options.getUser("user")! + const member = interaction.options.getMember("user") as GuildMember const reason = interaction.options.getString("reason") ?? "No reason provided." const mod = interaction.user! - const waitinglist = await waitinglistSchema.findOne({ userID: user.id }) + const waitinglist = await waitinglistSchema.findOne({ userID: member.user.id }) if (!waitinglist) { await interaction.editReply({ embeds: [{ - description: userMention(user.id) + " is not on the waiting list.", + description: userMention(member.user.id) + " is not on the waiting list.", color: embedColor }] }) return } - await waitinglistSchema.findOneAndDelete({ userID: user.id }) + await waitinglistSchema.findOneAndDelete({ userID: member.user.id }) + await member.roles.remove(waitingListRole, "Removed from waiting list.") await logToChannel("mod", { embeds: [{ @@ -56,7 +58,7 @@ export = { }, title: "Waiting List - Remove User", description: ` - **User:** ${userMention(user.id)} + **User:** ${userMention(member.user.id)} **Reason:** ${reason} **Mod:** ${userMention(mod.id)} `, @@ -65,8 +67,8 @@ export = { url: mod.avatarURL() || "" }, footer: { - icon_url: user.avatarURL() || undefined, - text: "ID: " + user.id + icon_url: member.avatarURL() || undefined, + text: "ID: " + member.user.id }, timestamp: new Date().toISOString() }] @@ -75,7 +77,7 @@ export = { await interaction.editReply({ embeds: [{ title: "Waiting List - Remove User", - description: "**User:** " + userMention(user.id) + "\n" + + description: "**User:** " + userMention(member.user.id) + "\n" + "**Reason:** `" + reason + "`", color: embedColor, footer: { diff --git a/src/commands/update.ts b/src/commands/update.ts index 6f42428..32ceb8f 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -134,10 +134,7 @@ export = { replyRank = "Member" } - // FIXME: need to check if user is on waiting list - if (user.roles.cache.has(waitingListRole)) { - await user.roles.remove(waitingListRole, "User used the update command") - } + await user.roles.remove(waitingListRole, "User used the update command") await user.setNickname(ign, "Verification").catch(() => { // Do nothing diff --git a/src/components/buttons/guildapplicationaccept.ts b/src/components/buttons/guildapplicationaccept.ts index b8b05ed..31c7718 100644 --- a/src/components/buttons/guildapplicationaccept.ts +++ b/src/components/buttons/guildapplicationaccept.ts @@ -6,7 +6,7 @@ import guildapp from "schemas/guildAppSchema" import waitingList from "schemas/waitinglistSchema" import { waitingListRole } from "config/roles" import { IButton } from "interfaces" -import { getGuild } from "utils/Hypixel" +import { getGuild, getIGN } from "utils/Hypixel" export = { name: "guildapplicationaccept", @@ -20,7 +20,6 @@ export = { const message = interaction.message const embed = message.embeds[0] const applicantId = embed.footer!.text.split(" ")[1] - const applicantIGN = embed.fields[0].value.replaceAll("`", "") const applicant = await guild.members.fetch(applicantId) const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator @@ -63,7 +62,6 @@ export = { _id: new mongoose.Types.ObjectId(), userID: applicantId, uuid: applicantUUID, - IGN: applicantIGN, timestamp: time }) @@ -108,10 +106,11 @@ export = { const fields: { name: string; value: string }[] = [] for (let i = 0; i < accepted.length; i++) { + const ign = await getIGN(accepted[i].uuid) const timestamp = Math.floor(accepted[i].timestamp / 1000) fields.push({ - name: `${i + 1}. ${accepted[i].IGN}`, + name: `${i + 1}. ${ign}`, value: `TS: ` }) } diff --git a/src/components/buttons/waitingListUpdate.ts b/src/components/buttons/waitingListUpdate.ts index 85d5aeb..65f6e47 100644 --- a/src/components/buttons/waitingListUpdate.ts +++ b/src/components/buttons/waitingListUpdate.ts @@ -1,5 +1,5 @@ import waitinglist from "schemas/waitinglistSchema" -import { getGuild } from "utils/Hypixel" +import { getGuild, getIGN } from "utils/Hypixel" import { hypixelGuildID } from "config/options" import { IButton } from "interfaces" @@ -28,10 +28,11 @@ export = { const fields = [] for (let i = 0; i < accepted.length; i++) { + const ign = await getIGN(accepted[i].uuid) const timestamp = Math.floor(accepted[i].timestamp / 1000) fields.push({ - name: `${i + 1}. ${accepted[i].IGN}`, + name: `${i + 1}. ${ign}`, value: `TS: ` }) } diff --git a/src/schemas/waitinglistSchema.ts b/src/schemas/waitinglistSchema.ts index bc0a857..10eea6e 100644 --- a/src/schemas/waitinglistSchema.ts +++ b/src/schemas/waitinglistSchema.ts @@ -4,7 +4,6 @@ const waitinglistSchema = new Schema({ _id: Schema.Types.ObjectId, userID: { type: String, required: true }, uuid: { type: String, required: true }, - IGN: { type: String, required: true }, timestamp: { type: Number, required: true } })