Fixed more formatting

This commit is contained in:
2024-01-19 18:40:45 +01:00
parent 0a315b18ed
commit ee217d5f64
15 changed files with 349 additions and 633 deletions

View File

@@ -1,9 +1,4 @@
import {
SlashCommandBuilder,
PermissionFlagsBits,
GuildMember,
userMention,
} from "discord.js"
import { SlashCommandBuilder, PermissionFlagsBits, GuildMember, userMention } from "discord.js"
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
import { color, hypixelGuildID, devMessage } from "config/options.json"
import verify from "schemas/verifySchema"
@@ -22,10 +17,14 @@ export = {
.setName("forceverify")
.setDescription("Force verify a user.")
.addUserOption(option =>
option.setName("user").setDescription("The user to force verify."),
option
.setName("user")
.setDescription("The user to force verify.")
)
.addStringOption(option =>
option.setName("ign").setDescription("The user's in-game name."),
option
.setName("ign")
.setDescription("The user's in-game name.")
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
@@ -45,9 +44,8 @@ export = {
}
if (!user) {
interaction.editReply(
"Please provide a user to force verify.\nThis can also mean the user is not in the server.",
)
interaction.editReply("Please provide a user to force verify.\n" +
"This can also mean the user is not in the server.")
return
}
@@ -71,58 +69,46 @@ export = {
}
await interaction.editReply({
embeds: [
{
description: "Fetching their uuid...",
color: embedColor,
},
],
embeds: [{
description: "Fetching their uuid...",
color: embedColor
}]
})
const uuid = await getUUID(ign)
if (!uuid) {
interaction.editReply({
embeds: [
{
description:
"<a:questionmark_pink:1130206038008803488> That player doesn't exist.",
color: embedColor,
},
],
embeds: [{
description: "<a:questionmark_pink:1130206038008803488> That player doesn't exist.",
color: embedColor
}]
})
return
}
await interaction.editReply({
embeds: [
{
description: "Fetching their player data...",
color: embedColor,
},
],
embeds: [{
description: "Fetching their player data...",
color: embedColor
}]
})
const player = await getPlayer(uuid)
if (!player) {
interaction.editReply({
embeds: [
{
description:
"<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
color: embedColor,
},
],
embeds: [{
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
color: embedColor
}]
})
return
}
await interaction.editReply({
embeds: [
{
description: "Fetching their guild data...",
color: embedColor,
},
],
embeds: [{
description: "Fetching their guild data...",
color: embedColor
}]
})
const guild = await getGuild(uuid)
@@ -136,119 +122,87 @@ export = {
const head = await getHeadURL(ign)
if (responseGuildID === hypixelGuildID) {
const GuildMembers = guild!.members
const guildRank = GuildMembers.find(
member => member.uuid === player.uuid,
)!.rank
const guildRank = GuildMembers.find(member => member.uuid === player.uuid)!.rank
if (guildRank === "Guild Master") {
const roles = roleManage("gm")
await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
}
if (guildRank === "Manager") {
const roles = roleManage("manager")
await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
}
if (guildRank === "Moderator") {
const roles = roleManage("moderator")
await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
}
if (guildRank === "Beast") {
const roles = roleManage("beast")
await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
}
if (guildRank === "Elite") {
const roles = roleManage("elite")
await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
}
if (guildRank === "Member") {
const roles = roleManage("member")
await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
}
}
await user.roles.add(
roleManage("default").rolesToAdd,
"User was force verified by " + modName,
)
await user.roles.add( roleManage("default").rolesToAdd, "User was force verified by " + modName)
const newVerify = new verify({
_id: new mongoose.Types.ObjectId(),
userID: user.id,
uuid: uuid,
uuid: uuid
})
await newVerify.save()
await logToChannel("mod", {
embeds: [
{
author: {
name: modName,
icon_url: mod.avatarURL() || undefined,
},
title: "Force Verified",
description: `
embeds: [{
author: {
name: modName,
icon_url: mod.avatarURL() || undefined
},
title: "Force Verified",
description: `
**User:** ${userMention(user.id)}
**Mod:** ${userMention(mod.id)}
**IGN:** \`${player.displayname}\`
**UUID:** \`${uuid}\`
`,
color: embedColor,
thumbnail: {
url: mod.avatarURL() || "",
},
footer: {
icon_url: user.user.avatarURL() || undefined,
text: "ID: " + user.user.id,
},
timestamp: new Date().toISOString(),
color: embedColor,
thumbnail: {
url: mod.avatarURL() || ""
},
],
footer: {
icon_url: user.user.avatarURL() || undefined,
text: "ID: " + user.user.id
},
timestamp: new Date().toISOString()
}]
})
await interaction.editReply({
embeds: [
{
title: interaction.guild!.name,
description:
"You have successfully force verified `" +
username +
"` with the account `" +
player.displayname +
"`.",
color: embedColor,
thumbnail: {
url: head!,
},
footer: {
icon_url: interaction.guild!.iconURL() || undefined,
text: interaction.guild!.name + " | " + devMessage,
},
embeds: [{
title: interaction.guild!.name,
description: "You have successfully force 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 Command