Removed unused
This commit is contained in:
@@ -46,18 +46,6 @@ export default {
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName("sendverfiymessage")
|
||||
.setDescription("Send the verfiy message to a channel.")
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription("The channel to send the verfiy message to.")
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName("sendwaitinglistmessage")
|
||||
@@ -118,14 +106,6 @@ export default {
|
||||
emoji = "✅"
|
||||
}
|
||||
|
||||
if (subcommand === "sendverfiymessage") {
|
||||
title = "Verification"
|
||||
description = "You can verify by clicking the button below."
|
||||
customId = "verify"
|
||||
label = "Verify"
|
||||
emoji = "✅"
|
||||
}
|
||||
|
||||
if (subcommand === "sendwaitinglistmessage") {
|
||||
title = "Waiting List"
|
||||
description = "The people on the waiting list"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
|
||||
import { IButton } from "~/typings"
|
||||
|
||||
export default {
|
||||
name: "verify",
|
||||
description: "Configure the bot.",
|
||||
|
||||
async execute({ interaction }) {
|
||||
const modal = new ModalBuilder()
|
||||
.setTitle("Verification")
|
||||
.setCustomId("verifybox")
|
||||
.setComponents(
|
||||
new ActionRowBuilder<TextInputBuilder>().setComponents(
|
||||
new TextInputBuilder()
|
||||
.setLabel("IGN")
|
||||
.setCustomId("verifyign")
|
||||
.setStyle(TextInputStyle.Short)
|
||||
.setPlaceholder("Enter your ign.")
|
||||
.setRequired(true)
|
||||
.setMinLength(3)
|
||||
.setMaxLength(16)
|
||||
)
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
}
|
||||
} as IButton
|
||||
@@ -1,144 +0,0 @@
|
||||
import { GuildMember, MessageFlags } from "discord.js"
|
||||
import { addVerify, getVerify } from "src/drizzle/functions"
|
||||
import { devMessage, embedColor, hypixelGuildID } from "~/config/options"
|
||||
import { IModal } from "~/typings"
|
||||
import getGuildRank from "~/utils/Functions/guildrank"
|
||||
import roleManage from "~/utils/Functions/rolesmanage"
|
||||
import { getGuild, getHeadURL, getPlayer, getUUID } from "~/utils/Hypixel"
|
||||
|
||||
export default {
|
||||
name: "verifybox",
|
||||
description: "Verify box.",
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral })
|
||||
|
||||
const user = interaction.member as GuildMember
|
||||
const ign = interaction.fields.fields.get("verifyign")!.value
|
||||
const verifyData = await getVerify({ userID: user.id })
|
||||
if (verifyData) {
|
||||
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const uuid = await getUUID(ign)
|
||||
if (!uuid) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player does not exist.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your player data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const head = getHeadURL(ign)
|
||||
const player = await getPlayer(uuid)
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const username = user.user.username
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Checking your Discord tag...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const linkedDiscord = player?.socialMedia?.links?.DISCORD
|
||||
if (!linkedDiscord) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> There is no Discord account linked to `" + player.displayname + "`.\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (linkedDiscord !== username) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> The Discord account linked to `" +
|
||||
player.displayname + "` is currently `" + linkedDiscord + "`\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
let guildID: string | null
|
||||
if (!guild) {
|
||||
guildID = null
|
||||
} else {
|
||||
guildID = guild._id
|
||||
}
|
||||
|
||||
if (guildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(member => member.uuid === player.uuid)!.rank
|
||||
|
||||
const rank = getGuildRank(guildRank)
|
||||
if (rank) {
|
||||
await user.roles.add(rank.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "Verification")
|
||||
await user.setNickname(player.displayname!, "Verification").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await addVerify({
|
||||
userID: user.id,
|
||||
uuid: uuid
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "You have successfully verified `" + username + "` with the account `" + player.displayname + "`.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as IModal
|
||||
Reference in New Issue
Block a user