Merge branch 'dev' into 'main'
Dev See merge request illegitimate/illegitimate-bot!251
This commit is contained in:
@@ -1,64 +1,64 @@
|
||||
import { SlashCommandBuilder, PermissionFlagsBits } from "discord.js"
|
||||
import { embedColor } from "config/options"
|
||||
import { ICommand } from "interfaces"
|
||||
import settings from "schemas/settingsTag"
|
||||
|
||||
export = {
|
||||
name: "config",
|
||||
description: "Configure the bot",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("config")
|
||||
.setDescription("Configure the bot")
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("setting")
|
||||
.setDescription("The setting to configure")
|
||||
.setChoices({
|
||||
name: "Staff Application status",
|
||||
value: "staffAppStatus"
|
||||
})
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("value")
|
||||
.setDescription("The value to set")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const setting = interaction.options.getString("setting")!
|
||||
const value = interaction.options.getString("value")!
|
||||
const settingsData = await settings.findOne({ where: { name: setting } })
|
||||
|
||||
if (!settingsData) {
|
||||
await settings.create({
|
||||
name: setting,
|
||||
value: value
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Successfully created `" + setting + "` with value `" + value + "`.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await settingsData.destroy()
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Successfully updated `" + setting + "` to value `" + value + "`.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as ICommand
|
||||
import { SlashCommandBuilder, PermissionFlagsBits } from "discord.js"
|
||||
import { embedColor } from "config/options"
|
||||
import { ICommand } from "interfaces"
|
||||
import settings from "schemas/settingsTag"
|
||||
|
||||
export = {
|
||||
name: "config",
|
||||
description: "Configure the bot",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("config")
|
||||
.setDescription("Configure the bot")
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("setting")
|
||||
.setDescription("The setting to configure")
|
||||
.setChoices({
|
||||
name: "Staff Application status",
|
||||
value: "staffAppStatus"
|
||||
})
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("value")
|
||||
.setDescription("The value to set")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const setting = interaction.options.getString("setting")!
|
||||
const value = interaction.options.getString("value")!
|
||||
const settingsData = await settings.findOne({ where: { name: setting } })
|
||||
|
||||
if (!settingsData) {
|
||||
await settings.create({
|
||||
name: setting,
|
||||
value: value
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Successfully created `" + setting + "` with value `" + value + "`.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await settingsData.destroy()
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Successfully updated `" + setting + "` to value `" + value + "`.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -1,80 +1,80 @@
|
||||
import { devMessage, embedColor } from "config/options"
|
||||
import { PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
|
||||
import { ICommand } from "interfaces"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { getHeadURL, getIGN, getUUID } from "utils/Hypixel"
|
||||
|
||||
export = {
|
||||
name: "find",
|
||||
description: "Find a person by the ign",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("find")
|
||||
.setDescription("Find a person by the ign")
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("The ign to lookup.")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const ign = interaction.options.getString("ign")!
|
||||
const uuid = await getUUID(ign)
|
||||
if (!uuid) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "No minecraft account found with the ign " + ign,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const verifyData = await verify.findOne({ where: { uuid: uuid } })
|
||||
if (!verifyData) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "No user found with the ign " + ign,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const user = await interaction.guild?.members.fetch(verifyData.userID)
|
||||
if (!user) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "User is not in the server.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const head = await getHeadURL(ign)
|
||||
const formattedIgn = await getIGN(uuid)
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "**User:** " + userMention(user.user.id) +
|
||||
"\n**IGN:** " + formattedIgn,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
import { devMessage, embedColor } from "config/options"
|
||||
import { PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
|
||||
import { ICommand } from "interfaces"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { getHeadURL, getIGN, getUUID } from "utils/Hypixel"
|
||||
|
||||
export = {
|
||||
name: "find",
|
||||
description: "Find a person by the ign",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("find")
|
||||
.setDescription("Find a person by the ign")
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("The ign to lookup.")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const ign = interaction.options.getString("ign")!
|
||||
const uuid = await getUUID(ign)
|
||||
if (!uuid) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "No minecraft account found with the ign " + ign,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const verifyData = await verify.findOne({ where: { uuid: uuid } })
|
||||
if (!verifyData) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "No user found with the ign " + ign,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const user = await interaction.guild?.members.fetch(verifyData.userID)
|
||||
if (!user) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "User is not in the server.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const head = await getHeadURL(ign)
|
||||
const formattedIgn = await getIGN(uuid)
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "**User:** " + userMention(user.user.id) +
|
||||
"\n**IGN:** " + formattedIgn,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -1,90 +1,90 @@
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { embedColor, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { ICommand } from "interfaces"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
import { getIGN } from "utils/Hypixel"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "forceunverify",
|
||||
description: "Force unverify a user",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("forceunverify")
|
||||
.setDescription("Force unverify a user")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force unverify")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
|
||||
async execute({ interaction }) {
|
||||
const member = interaction.options.getMember("user") as GuildMember
|
||||
const verifiedUser = await verify.findOne({ where: { userID: member.user.id } })
|
||||
const mod = interaction.user
|
||||
|
||||
if (!verifiedUser) {
|
||||
interaction.reply({
|
||||
embeds: [{
|
||||
description: "This user is not verified",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const uuid = verifiedUser.uuid
|
||||
const ign = await getIGN(uuid)
|
||||
await verifiedUser.destroy()
|
||||
await member.roles.remove(
|
||||
roleManage("all").rolesToRemove,
|
||||
"User force unverified by " + interaction.user.username
|
||||
)
|
||||
await member.setNickname(null, "User force unverified by " + interaction.user.username).catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [{
|
||||
title: "Force Unverified",
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
description: removeIndents(`
|
||||
**User:** ${userMention(member.user.id)}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
**IGN:** \`${ign}\`
|
||||
**UUID:** \`${uuid}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || ""
|
||||
},
|
||||
footer: {
|
||||
icon_url: member.user.avatarURL() || undefined,
|
||||
text: "ID: " + member.user.id
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "Successfully unverified " + userMention(member.user.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { embedColor, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { ICommand } from "interfaces"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
import { getIGN } from "utils/Hypixel"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "forceunverify",
|
||||
description: "Force unverify a user",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("forceunverify")
|
||||
.setDescription("Force unverify a user")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force unverify")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
|
||||
async execute({ interaction }) {
|
||||
const member = interaction.options.getMember("user") as GuildMember
|
||||
const verifiedUser = await verify.findOne({ where: { userID: member.user.id } })
|
||||
const mod = interaction.user
|
||||
|
||||
if (!verifiedUser) {
|
||||
interaction.reply({
|
||||
embeds: [{
|
||||
description: "This user is not verified",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const uuid = verifiedUser.uuid
|
||||
const ign = await getIGN(uuid)
|
||||
await verifiedUser.destroy()
|
||||
await member.roles.remove(
|
||||
roleManage("all").rolesToRemove,
|
||||
"User force unverified by " + interaction.user.username
|
||||
)
|
||||
await member.setNickname(null, "User force unverified by " + interaction.user.username).catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [{
|
||||
title: "Force Unverified",
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
description: removeIndents(`
|
||||
**User:** ${userMention(member.user.id)}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
**IGN:** \`${ign}\`
|
||||
**UUID:** \`${uuid}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || ""
|
||||
},
|
||||
footer: {
|
||||
icon_url: member.user.avatarURL() || undefined,
|
||||
text: "ID: " + member.user.id
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "Successfully unverified " + userMention(member.user.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -1,179 +1,179 @@
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel"
|
||||
import { hypixelGuildID, embedColor, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { ICommand } from "interfaces"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { waitingListRole } from "config/roles"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "forceupdate",
|
||||
description: "Force update the user",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("forceupdate")
|
||||
.setDescription("Force update the user")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force update")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.options.getMember("user") as GuildMember
|
||||
const usermentioned = userMention(user.user.id)
|
||||
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||
|
||||
if (!verifyData) {
|
||||
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "User is not verified.\n\n" + "Updating username to `Username (X)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching ign...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const ign = (await getIGN(verifyData.uuid)) as string
|
||||
const head = await getHeadURL(ign)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(verifyData.uuid)
|
||||
|
||||
let responseGuildID: string | null
|
||||
if (!guild) {
|
||||
responseGuildID = null
|
||||
} else {
|
||||
responseGuildID = guild._id
|
||||
}
|
||||
|
||||
if (responseGuildID !== hypixelGuildID) {
|
||||
const roles = roleManage("default")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
await user.setNickname(ign, "User was force updated.").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: removeIndents(`
|
||||
${usermentioned} was given the \`Default Member\` role.
|
||||
|
||||
IGN: \`${ign}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (responseGuildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid)!.rank
|
||||
let replyRank: string | null = null
|
||||
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "User was force updated.")
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Guild Master"
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Manager"
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Moderator"
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Beast"
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Elite"
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Member"
|
||||
}
|
||||
|
||||
await user.roles.remove(waitingListRole, "User was force updated.")
|
||||
await user.setNickname(ign, "User was force updated.").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: removeIndents(`
|
||||
${usermentioned} was given the \`${replyRank}\` role.
|
||||
|
||||
IGN: \`${ign}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as ICommand
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel"
|
||||
import { hypixelGuildID, embedColor, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { ICommand } from "interfaces"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { waitingListRole } from "config/roles"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "forceupdate",
|
||||
description: "Force update the user",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("forceupdate")
|
||||
.setDescription("Force update the user")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force update")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.options.getMember("user") as GuildMember
|
||||
const usermentioned = userMention(user.user.id)
|
||||
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||
|
||||
if (!verifyData) {
|
||||
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "User is not verified.\n\n" + "Updating username to `Username (X)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching ign...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const ign = (await getIGN(verifyData.uuid)) as string
|
||||
const head = await getHeadURL(ign)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(verifyData.uuid)
|
||||
|
||||
let responseGuildID: string | null
|
||||
if (!guild) {
|
||||
responseGuildID = null
|
||||
} else {
|
||||
responseGuildID = guild._id
|
||||
}
|
||||
|
||||
if (responseGuildID !== hypixelGuildID) {
|
||||
const roles = roleManage("default")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
await user.setNickname(ign, "User was force updated.").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: removeIndents(`
|
||||
${usermentioned} was given the \`Default Member\` role.
|
||||
|
||||
IGN: \`${ign}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (responseGuildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid)!.rank
|
||||
let replyRank: string | null = null
|
||||
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "User was force updated.")
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Guild Master"
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Manager"
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Moderator"
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Beast"
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Elite"
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Member"
|
||||
}
|
||||
|
||||
await user.roles.remove(waitingListRole, "User was force updated.")
|
||||
await user.setNickname(ign, "User was force updated.").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: removeIndents(`
|
||||
${usermentioned} was given the \`${replyRank}\` role.
|
||||
|
||||
IGN: \`${ign}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -1,207 +1,207 @@
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, GuildMember, userMention } from "discord.js"
|
||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { ICommand } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "forceverify",
|
||||
description: "Force verify a user.",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("forceverify")
|
||||
.setDescription("Force verify a user.")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force verify.")
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("The user's in-game name.")
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.options.getMember("user") as GuildMember
|
||||
const ign = interaction.options.getString("ign")
|
||||
const mod = interaction.user
|
||||
|
||||
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||
if (verifyData) {
|
||||
interaction.editReply("That user is already verified.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
interaction.editReply("Please provide a user to force verify.\n" +
|
||||
"This can also mean the user is not in the server.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!ign) {
|
||||
interaction.editReply("Please provide a player's IGN.")
|
||||
return
|
||||
}
|
||||
|
||||
let username = ""
|
||||
if (user.user.discriminator == "0") {
|
||||
username = user.user.username
|
||||
} else {
|
||||
username = user.user.username + "#" + user.user.discriminator
|
||||
}
|
||||
|
||||
let modName = ""
|
||||
if (mod.discriminator == "0") {
|
||||
modName = mod.username
|
||||
} else {
|
||||
modName = mod.username + "#" + mod.discriminator
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
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
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
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
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching their guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
let responseGuildID: string | null
|
||||
if (!guild) {
|
||||
responseGuildID = null
|
||||
} else {
|
||||
responseGuildID = guild._id
|
||||
}
|
||||
|
||||
const head = await getHeadURL(ign)
|
||||
if (responseGuildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
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)
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
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)
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
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)
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
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.setNickname(player.displayname!, "User was force verified by " + modName).catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await verify.create({
|
||||
userID: user.user.id,
|
||||
uuid: uuid,
|
||||
})
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [{
|
||||
author: {
|
||||
name: modName,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
title: "Force Verified",
|
||||
description: removeIndents(`
|
||||
**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()
|
||||
}]
|
||||
})
|
||||
|
||||
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
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, GuildMember, userMention } from "discord.js"
|
||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { ICommand } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "forceverify",
|
||||
description: "Force verify a user.",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("forceverify")
|
||||
.setDescription("Force verify a user.")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force verify.")
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("The user's in-game name.")
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.options.getMember("user") as GuildMember
|
||||
const ign = interaction.options.getString("ign")
|
||||
const mod = interaction.user
|
||||
|
||||
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||
if (verifyData) {
|
||||
interaction.editReply("That user is already verified.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
interaction.editReply("Please provide a user to force verify.\n" +
|
||||
"This can also mean the user is not in the server.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!ign) {
|
||||
interaction.editReply("Please provide a player's IGN.")
|
||||
return
|
||||
}
|
||||
|
||||
let username = ""
|
||||
if (user.user.discriminator == "0") {
|
||||
username = user.user.username
|
||||
} else {
|
||||
username = user.user.username + "#" + user.user.discriminator
|
||||
}
|
||||
|
||||
let modName = ""
|
||||
if (mod.discriminator == "0") {
|
||||
modName = mod.username
|
||||
} else {
|
||||
modName = mod.username + "#" + mod.discriminator
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
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
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
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
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching their guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
let responseGuildID: string | null
|
||||
if (!guild) {
|
||||
responseGuildID = null
|
||||
} else {
|
||||
responseGuildID = guild._id
|
||||
}
|
||||
|
||||
const head = await getHeadURL(ign)
|
||||
if (responseGuildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
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)
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
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)
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
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)
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
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.setNickname(player.displayname!, "User was force verified by " + modName).catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await verify.create({
|
||||
userID: user.user.id,
|
||||
uuid: uuid,
|
||||
})
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [{
|
||||
author: {
|
||||
name: modName,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
title: "Force Verified",
|
||||
description: removeIndents(`
|
||||
**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()
|
||||
}]
|
||||
})
|
||||
|
||||
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
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { embedColor, devMessage } from "config/options"
|
||||
import waitinglist from "schemas/waitinglistTag"
|
||||
import { ICommand } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
import { waitingListRole } from "config/roles"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "remove",
|
||||
description: "Remove a person on the waiting list.",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("remove")
|
||||
.setDescription("Remove a person on the waiting list.")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to remove.")
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("reason")
|
||||
.setDescription("The reason for removing the user.")
|
||||
.setRequired(false)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const member = interaction.options.getMember("user") as GuildMember
|
||||
const reason = interaction.options.getString("reason") ?? "No reason provided."
|
||||
const mod = interaction.user!
|
||||
const waiting = await waitinglist.findOne({ where: { userID: member.user.id } })
|
||||
|
||||
if (!waitinglist) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " is not on the waiting list.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await waiting?.destroy()
|
||||
await member.roles.remove(waitingListRole, "Removed from waiting list.")
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [{
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
title: "Waiting List - Remove User",
|
||||
description: removeIndents(`
|
||||
**User:** ${userMention(member.user.id)}
|
||||
**Reason:** ${reason}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || ""
|
||||
},
|
||||
footer: {
|
||||
icon_url: member.avatarURL() || undefined,
|
||||
text: "ID: " + member.user.id
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: "Waiting List - Remove User",
|
||||
description: "**User:** " + userMention(member.user.id) + "\n" +
|
||||
"**Reason:** `" + reason + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { embedColor, devMessage } from "config/options"
|
||||
import waitinglist from "schemas/waitinglistTag"
|
||||
import { ICommand } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
import { waitingListRole } from "config/roles"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "remove",
|
||||
description: "Remove a person on the waiting list.",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("remove")
|
||||
.setDescription("Remove a person on the waiting list.")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to remove.")
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("reason")
|
||||
.setDescription("The reason for removing the user.")
|
||||
.setRequired(false)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const member = interaction.options.getMember("user") as GuildMember
|
||||
const reason = interaction.options.getString("reason") ?? "No reason provided."
|
||||
const mod = interaction.user!
|
||||
const waiting = await waitinglist.findOne({ where: { userID: member.user.id } })
|
||||
|
||||
if (!waitinglist) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " is not on the waiting list.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await waiting?.destroy()
|
||||
await member.roles.remove(waitingListRole, "Removed from waiting list.")
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [{
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
title: "Waiting List - Remove User",
|
||||
description: removeIndents(`
|
||||
**User:** ${userMention(member.user.id)}
|
||||
**Reason:** ${reason}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || ""
|
||||
},
|
||||
footer: {
|
||||
icon_url: member.avatarURL() || undefined,
|
||||
text: "ID: " + member.user.id
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: "Waiting List - Remove User",
|
||||
description: "**User:** " + userMention(member.user.id) + "\n" +
|
||||
"**Reason:** `" + reason + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import verify from "schemas/verifyTag"
|
||||
import { embedColor, hypixelGuildID } from "config/options"
|
||||
import color from "utils/functions/colors"
|
||||
import { verifyTick } from "config/roles"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { ChatInputCommandInteraction, GuildMember } from "discord.js"
|
||||
import env from "utils/Env"
|
||||
@@ -60,25 +59,25 @@ export default async function updateAll(interaction: ChatInputCommandInteraction
|
||||
|
||||
if (!memberData) {
|
||||
if (gmember.member.user.bot) {
|
||||
console.log(color(" Skipped bot", "lavender"))
|
||||
console.log(color(` Skipped bot [${gmember.member.user.username}]`, "lavender"))
|
||||
continue
|
||||
}
|
||||
const rolesToremove = roleManage("default").rolesToRemove
|
||||
await gmember.member.roles.remove(rolesToremove, "Updating all discord members")
|
||||
const roles = roleManage("defaultnoverify")
|
||||
await gmember.member.roles.remove(roles.rolesToRemove, "Updating all discord members")
|
||||
await gmember.member.roles.add(roles.rolesToAdd, "Updating all discord members")
|
||||
await gmember.member.setNickname(`${gmember.member.user.username} (X)`, "Updating all discord members").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
console.log(color(`${gmember.member.user.username} [X]`, "lavender"))
|
||||
} else {
|
||||
const uuid = memberData.uuid
|
||||
const ign = await getIGN(uuid)
|
||||
if (!gmember.member.roles.cache.has(verifyTick)) {
|
||||
await gmember.member.roles.add(verifyTick, "Updating all discord members")
|
||||
console.log(color(" Added verified tick to " + gmember.member.user.username, "lavender"))
|
||||
}
|
||||
|
||||
if (!guildMemberIDs.includes(memberData?.uuid || "none")) {
|
||||
const rolesToremove = roleManage("default").rolesToRemove
|
||||
await gmember.member.roles.remove(rolesToremove, "Updating all discord members")
|
||||
if (!guildMemberIDs.includes(memberData?.uuid)) {
|
||||
const roles = roleManage("default")
|
||||
await gmember.member.roles.remove(roles.rolesToRemove, "Updating all discord members")
|
||||
await gmember.member.roles.add(roles.rolesToAdd, "Updating all discord members")
|
||||
console.log(color(`${gmember.member.user.username} [Default]`, "lavender"))
|
||||
} else if (guildMemberIDs.includes(memberData!.uuid)) {
|
||||
const guildMemberRank = hypixelGuildMembers.find(gmember => gmember.uuid === memberData!.uuid)!.rank
|
||||
console.log(color(" Updating roles for " + gmember.member.user.username, "lavender"))
|
||||
|
||||
@@ -1,163 +1,163 @@
|
||||
import { GuildMember, SlashCommandBuilder } from "discord.js"
|
||||
import { getGuild, getIGN, getHeadURL } from "utils/Hypixel"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { ICommand } from "interfaces"
|
||||
import { waitingListRole } from "config/roles"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "update",
|
||||
description: "Update your guild rank.",
|
||||
dev: false,
|
||||
public: true,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("update")
|
||||
.setDescription("Update your discord roles.")
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.member as GuildMember
|
||||
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||
|
||||
if (!verifyData) {
|
||||
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "You are not verified. Please run `/verify` to verify yourself\n\n" + "Updating username to `Username (X)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(verifyData.uuid)
|
||||
let guildID: string | null
|
||||
if (!guild) {
|
||||
guildID = null
|
||||
} else {
|
||||
guildID = guild._id
|
||||
}
|
||||
|
||||
const ign = (await getIGN(verifyData.uuid)) as string
|
||||
const head = await getHeadURL(ign)
|
||||
if (guildID !== hypixelGuildID) {
|
||||
const roles = roleManage("default")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
await user.setNickname(ign, "User used the update command").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: removeIndents(`
|
||||
Updated your roles to \`Default Member\`
|
||||
|
||||
IGN: \`${ign}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (guildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid)!.rank
|
||||
let replyRank: string | null = null
|
||||
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "User used the update command")
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Guild Master"
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Manager"
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Moderator"
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Beast"
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Elite"
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Member"
|
||||
}
|
||||
|
||||
await user.roles.remove(waitingListRole, "User used the update command")
|
||||
|
||||
await user.setNickname(ign, "Verification").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: removeIndents(`
|
||||
Updated your roles to \`${replyRank}\`
|
||||
|
||||
IGN: \`${ign}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as ICommand
|
||||
import { GuildMember, SlashCommandBuilder } from "discord.js"
|
||||
import { getGuild, getIGN, getHeadURL } from "utils/Hypixel"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { ICommand } from "interfaces"
|
||||
import { waitingListRole } from "config/roles"
|
||||
import { removeIndents } from "utils/functions/funcs"
|
||||
|
||||
export = {
|
||||
name: "update",
|
||||
description: "Update your guild rank.",
|
||||
dev: false,
|
||||
public: true,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("update")
|
||||
.setDescription("Update your discord roles.")
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.member as GuildMember
|
||||
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||
|
||||
if (!verifyData) {
|
||||
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "You are not verified. Please run `/verify` to verify yourself\n\n" + "Updating username to `Username (X)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(verifyData.uuid)
|
||||
let guildID: string | null
|
||||
if (!guild) {
|
||||
guildID = null
|
||||
} else {
|
||||
guildID = guild._id
|
||||
}
|
||||
|
||||
const ign = (await getIGN(verifyData.uuid)) as string
|
||||
const head = await getHeadURL(ign)
|
||||
if (guildID !== hypixelGuildID) {
|
||||
const roles = roleManage("default")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
await user.setNickname(ign, "User used the update command").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: removeIndents(`
|
||||
Updated your roles to \`Default Member\`
|
||||
|
||||
IGN: \`${ign}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (guildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid)!.rank
|
||||
let replyRank: string | null = null
|
||||
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "User used the update command")
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Guild Master"
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Manager"
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Moderator"
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Beast"
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Elite"
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Member"
|
||||
}
|
||||
|
||||
await user.roles.remove(waitingListRole, "User used the update command")
|
||||
|
||||
await user.setNickname(ign, "Verification").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: removeIndents(`
|
||||
Updated your roles to \`${replyRank}\`
|
||||
|
||||
IGN: \`${ign}\`
|
||||
`),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -1,200 +1,200 @@
|
||||
import { GuildMember, SlashCommandBuilder } from "discord.js"
|
||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { ICommand } from "interfaces"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { IPlayerData } from "interfaces"
|
||||
import { IGuildData } from "interfaces"
|
||||
|
||||
export = {
|
||||
name: "verify",
|
||||
description: "Verify yourself as a member of the server.",
|
||||
dev: false,
|
||||
public: true,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("verify")
|
||||
.setDescription("Verify yourself as a member of the server.")
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("Your in-game name.")
|
||||
.setMinLength(3)
|
||||
.setMaxLength(16)
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.member! as GuildMember
|
||||
const ign = interaction.options.getString("ign")!
|
||||
|
||||
const verifyData = await verify.findOne({ where: { userID: user.id } })
|
||||
if (verifyData) {
|
||||
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!ign) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> Please provide your in-game name.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
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 = await getHeadURL(ign)
|
||||
const player = (await getPlayer(uuid)) as IPlayerData
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let username = ""
|
||||
if (user.user.discriminator === "0") {
|
||||
username = user.user.username
|
||||
} else {
|
||||
username = user.user.username + "#" + user.user.discriminator
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Checking your Discord tag...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const linkedDiscord = player?.socialMedia?.links?.DISCORD || null
|
||||
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)) as IGuildData | null
|
||||
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
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
}
|
||||
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "Verification")
|
||||
await user.setNickname(player.displayname!, "Verification").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await verify.create({
|
||||
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 ICommand
|
||||
import { GuildMember, SlashCommandBuilder } from "discord.js"
|
||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||
import roleManage from "utils/functions/rolesmanage"
|
||||
import { ICommand } from "interfaces"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { IPlayerData } from "interfaces"
|
||||
import { IGuildData } from "interfaces"
|
||||
|
||||
export = {
|
||||
name: "verify",
|
||||
description: "Verify yourself as a member of the server.",
|
||||
dev: false,
|
||||
public: true,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("verify")
|
||||
.setDescription("Verify yourself as a member of the server.")
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("Your in-game name.")
|
||||
.setMinLength(3)
|
||||
.setMaxLength(16)
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.member! as GuildMember
|
||||
const ign = interaction.options.getString("ign")!
|
||||
|
||||
const verifyData = await verify.findOne({ where: { userID: user.id } })
|
||||
if (verifyData) {
|
||||
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!ign) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> Please provide your in-game name.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
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 = await getHeadURL(ign)
|
||||
const player = (await getPlayer(uuid)) as IPlayerData
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let username = ""
|
||||
if (user.user.discriminator === "0") {
|
||||
username = user.user.username
|
||||
} else {
|
||||
username = user.user.username + "#" + user.user.discriminator
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Checking your Discord tag...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const linkedDiscord = player?.socialMedia?.links?.DISCORD || null
|
||||
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)) as IGuildData | null
|
||||
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
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.add(roles.rolesToAdd, "Verification")
|
||||
}
|
||||
}
|
||||
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "Verification")
|
||||
await user.setNickname(player.displayname!, "Verification").catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
|
||||
await verify.create({
|
||||
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 ICommand
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
import { SlashCommandBuilder, userMention } from "discord.js"
|
||||
import { ICommand } from "interfaces"
|
||||
import { embedColor, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { getIGN, getHeadURL } from "utils/Hypixel"
|
||||
|
||||
export = {
|
||||
name: "whoami",
|
||||
description: "Get your user info",
|
||||
public: true,
|
||||
dev: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("whoami")
|
||||
.setDescription("Get your user info")
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.user
|
||||
const verifyData = await verify.findOne({ where: { userID: user.id } })
|
||||
|
||||
if (!verifyData) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "You are not verified!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const ign = await getIGN(verifyData.uuid)
|
||||
const head = await getHeadURL(ign!)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: "User Info",
|
||||
description: "**User:** " + userMention(user.id) +
|
||||
"\n**IGN:** `" + ign + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
import { SlashCommandBuilder, userMention } from "discord.js"
|
||||
import { ICommand } from "interfaces"
|
||||
import { embedColor, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { getIGN, getHeadURL } from "utils/Hypixel"
|
||||
|
||||
export = {
|
||||
name: "whoami",
|
||||
description: "Get your user info",
|
||||
public: true,
|
||||
dev: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("whoami")
|
||||
.setDescription("Get your user info")
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.user
|
||||
const verifyData = await verify.findOne({ where: { userID: user.id } })
|
||||
|
||||
if (!verifyData) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "You are not verified!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const ign = await getIGN(verifyData.uuid)
|
||||
const head = await getHeadURL(ign!)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: "User Info",
|
||||
description: "**User:** " + userMention(user.id) +
|
||||
"\n**IGN:** `" + ign + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
||||
import { getIGN, getHeadURL } from "utils/Hypixel"
|
||||
import { embedColor, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { ICommand } from "interfaces"
|
||||
|
||||
export = {
|
||||
name: "whois",
|
||||
description: "Get's the ign of a user.",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("whois")
|
||||
.setDescription("Get's the ign of a user.")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to get the ign of.")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.options.getUser("user")!
|
||||
const verifiedUser = await verify.findOne({ where: { userID: user.id } })
|
||||
if (!verifiedUser) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: userMention(user.id) + " is not verified.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const ign = (await getIGN(verifiedUser.uuid)) as string
|
||||
const head = await getHeadURL(ign)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "**User:** " + userMention(user.id) +
|
||||
"\n**IGN:** " + ign,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
||||
import { getIGN, getHeadURL } from "utils/Hypixel"
|
||||
import { embedColor, devMessage } from "config/options"
|
||||
import verify from "schemas/verifyTag"
|
||||
import { ICommand } from "interfaces"
|
||||
|
||||
export = {
|
||||
name: "whois",
|
||||
description: "Get's the ign of a user.",
|
||||
dev: false,
|
||||
public: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("whois")
|
||||
.setDescription("Get's the ign of a user.")
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to get the ign of.")
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute({ interaction }) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.options.getUser("user")!
|
||||
const verifiedUser = await verify.findOne({ where: { userID: user.id } })
|
||||
if (!verifiedUser) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: userMention(user.id) + " is not verified.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const ign = (await getIGN(verifiedUser.uuid)) as string
|
||||
const head = await getHeadURL(ign)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "**User:** " + userMention(user.id) +
|
||||
"\n**IGN:** " + ign,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
} as ICommand
|
||||
|
||||
@@ -29,6 +29,7 @@ type RoleType =
|
||||
| "elite"
|
||||
| "member"
|
||||
| "default"
|
||||
| "defaultnoverify"
|
||||
| "all"
|
||||
|
||||
export default function roleManage(role: RoleType): { rolesToRemove: string[], rolesToAdd: string[] } {
|
||||
@@ -74,6 +75,12 @@ export default function roleManage(role: RoleType): { rolesToRemove: string[], r
|
||||
return { rolesToRemove, rolesToAdd }
|
||||
}
|
||||
|
||||
if (role === "defaultnoverify") {
|
||||
const rolesToRemove = roles
|
||||
const rolesToAdd = [defaultMember]
|
||||
return { rolesToRemove, rolesToAdd }
|
||||
}
|
||||
|
||||
if (role === "all") {
|
||||
const rolesToRemove = roles
|
||||
rolesToRemove.push(verifyTick)
|
||||
|
||||
Reference in New Issue
Block a user