Moved code to src folder

This commit is contained in:
2023-11-23 12:38:55 +01:00
parent 932bce6057
commit 0eeb48b2dd
68 changed files with 59 additions and 70 deletions

103
src/commands/ban.js Normal file
View File

@@ -0,0 +1,103 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { admin, helper } = require("../../config/roles.json")
const { color } = require("../../config/options.json")
module.exports = {
name: "ban",
description: "Ban a user",
type: "slash",
data: new SlashCommandBuilder()
.setName("ban")
.setDescription("Ban a user")
.addUserOption(option =>
option
.setName("user")
.setDescription("User to ban")
.setRequired(true))
.addStringOption(option =>
option
.setName("reason")
.setDescription("Reason for ban"))
.addNumberOption(option =>
option
.setName("messagedeletiondays")
.setDescription("Number of days to delete messages")
.addChoices(
{ name: "1 day", value: 1 },
{ name: "2 days", value: 2 },
{ name: "3 days", value: 3 },
{ name: "4 days", value: 4 },
{ name: "5 days", value: 5 },
{ name: "6 days", value: 6 },
{ name: "7 days", value: 7 }
)
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute (interaction) {
await interaction.deferReply()
const member = interaction.options.getMember("user")
const reason = interaction.options.getString("reason") ?? "No reason provided."
const messageDeletionDays = interaction.options.getNumber("messagedeletiondays") ?? 0
const mod = await interaction.guild.members.fetch(interaction.user.id)
const memberRoles = member.roles.cache.map(role => role.id)
const modRoles = mod.roles.cache.map(role => role.id)
const embedColor = Number(color.replace("#", "0x"))
if (!modRoles.includes(admin)) {
await interaction.editReply("You do not have permission to use this command.")
return
}
if (member.id === interaction.applicationId) {
await interaction.editReply("I cannot ban myself.")
return
}
if (member.id === interaction.guild.ownerId) {
await interaction.editReply("I ban kick the server owner.")
return
}
if (member.id === mod.id) {
return interaction.editReply("You cannot ban yourself.")
}
if (memberRoles.includes(helper) || memberRoles.includes(admin)) {
await interaction.editReply("I cannot ban a moderator.")
return
}
if (!member.bannable) {
await interaction.editReply("I cannot ban this member.")
return
}
await member.ban({
deleteMessageSeconds: messageDeletionDays * 86400,
reason: reason + ` - ${mod.user.username}`
})
await interaction.editReply({
embeds: [{
title: "Member Banned",
description: "**User:** " + userMention(member.user.id) + "\n" +
"**Reason:** " + reason + "\n" +
"**Moderator:** " + mod.user.username + "\n" +
"**Messages Deleted:** " + messageDeletionDays + " days",
color: embedColor,
footer: {
text: member.user.id,
icon_url: member.user.avatarURL({ dynamic: true })
},
}]
})
}
}

200
src/commands/check.js Normal file
View File

@@ -0,0 +1,200 @@
const { SlashCommandBuilder } = require("discord.js")
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../config/reqs.json")
const { color } = require("../../config/options.json")
const { hypixelLevel, bedwarsLevel, skywarsLevel, getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js")
module.exports = {
name: "check",
description: "Check a player's stats.",
type: "slash",
data: new SlashCommandBuilder()
.setName("check")
.setDescription("Check a player's stats.")
.addStringOption((option) => option.setName("ign")
.setDescription("The player's IGN.")
.setRequired(true))
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply({})
const ign = interaction.options.getString("ign")
const embedColor = Number(color.replace("#", "0x"))
if (!ign) {
await interaction.editReply("Please provide a player's IGN.")
return
}
const uuid = await getUUID(ign)
if (!uuid) {
interaction.editReply({
embeds: [
{ description: "That player doesn't exist.", color: embedColor }
]
})
return
}
const head = await getHeadURL(ign)
const player = await getPlayer(uuid)
if (!player) {
interaction.editReply({
embeds: [{
description: "That player hasn't played Hypixel before.",
color: embedColor
}]
})
return
}
const rank2 = player.newPackageRank
const monthlyRank = player.monthlyPackageRank
let rank = ""
if (rank2 === "VIP") {
rank = "[VIP] "
} else if (rank2 === "VIP_PLUS") {
rank = "[VIP+] "
} else if (rank2 === "MVP") {
rank = "[MVP] "
} else if (rank2 === "MVP_PLUS" && monthlyRank === "NONE") {
rank = "[MVP+] "
} else if (rank2 === "MVP_PLUS" && monthlyRank === "SUPERSTAR") {
rank = "[MVP++] "
}
const guild = await getGuild(uuid)
let guildName = ""
if (!guild) {
guildName = "None"
} else {
guildName = guild.name
}
let guildTag = ""
if (!guild) {
guildTag = ""
} else if (!guild.tag) {
guildTag = ""
} else {
guildTag = " [" + guild.tag + "]"
}
//bedwars level
const hsbwexp = player.stats.Bedwars.Experience
const hsbwstars = bedwarsLevel(hsbwexp)
// bedwars fkdr
const hsbwfk = player.stats.Bedwars.final_kills_bedwars
const hsbwfd = player.stats.Bedwars.final_deaths_bedwars
const hsbwfkdr = hsbwfk / hsbwfd
// bedwars wins
const hsbwwins = player.stats.Bedwars.wins_bedwars
// skywars level
const hsswexp = player.stats.SkyWars.skywars_experience
const hsswstars = skywarsLevel(hsswexp)
// skywars kdr
const hsswkills = player.stats.SkyWars.kills
const hsswdeaths = player.stats.SkyWars.deaths
const hsswkd = hsswkills / hsswdeaths
//skywars wins
const hsswwins = player.stats.SkyWars.wins
// dueks kdr
const hsduelskills = player.stats.Duels.kills
const hsduelsdeaths = player.stats.Duels.deaths
const hsduelskd = hsduelskills / hsduelsdeaths
// duels wins
const hsduelswins = player.stats.Duels.wins
// duels wlr
const hsduelslosses = player.stats.Duels.losses
const hsduelswlr = hsduelswins / hsduelslosses
// network level
const hypixelExp = player.networkExp
const level = hypixelLevel(hypixelExp)
let bwtitle = ""
let swtitle = ""
let duelstitle = ""
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
bwtitle =
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
} else {
bwtitle =
"<a:check_a:1087808632172847134> This player meets the BedWars requirements."
}
if (hsswstars < swstars) {
swtitle =
"<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
} else {
swtitle =
"<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
}
if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
duelstitle =
"<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
} else {
duelstitle =
"<a:check_a:1087808632172847134> This player meets the Duels requirements."
}
await interaction.editReply({
embeds: [{
title: rank + player.displayname + guildTag,
description: "**Network Level:** `" +
level.toFixed(2).toString() + "`\n" +
"**Current Guild:** `" + guildName + "`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL()
},
fields: [
{
name: bwtitle,
value: "**➺ Stars:** `" +
hsbwstars.toFixed(2).toString() + " / " +
bwstars.toString() + "`\n" +
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " + bwfkdr.toString() + "`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() + " / " +
bwwins.toString() + "`"
},
{
name: swtitle,
value:
"**➺ Stars:** `" +
hsswstars.toFixed(2).toString() +
" / " + swstars.toString() + "`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() +
"`\n" +
"**➺ Wins:** `" +
hsswwins.toString() + "`"
},
{
name: duelstitle,
value: "**➺ Wins:** `" +
hsduelswins.toString() +
" / " + duelswins.toString() + "`\n" +
"**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() +
" / " + duelswlr.toString() + "`\n" +
"**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() + "`"
}
]
}]
})
}
}

57
src/commands/clear.js Normal file
View File

@@ -0,0 +1,57 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { color } = require("../../config/options.json")
module.exports = {
name: "clear",
description: "Clears messages",
type: "slash",
data: new SlashCommandBuilder()
.setName("clear")
.setDescription("Clears messages")
.addIntegerOption(option =>
option
.setName("amount")
.setDescription("Amount of messages to clear")
.setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply({ ephemeral: true })
const amount = interaction.options.getInteger("amount")
const channel = interaction.channel
const embedColor = Number(color.replace("#", "0x"))
if (!amount || amount < 1 || amount > 100) {
await interaction.editReply({
embeds: [{
description: "Please provide an amount of messages to clear",
color: embedColor
}],
})
}
channel.messages.fetch({ limit: amount }).then(async messages => {
const messagesToDelete = messages.map(m => m)
.filter(m =>
m.pinned === false &&
m.system === false &&
m.createdTimestamp > Date.now() - 1209600000
)
await channel.bulkDelete(messagesToDelete, true)
await interaction.editReply({
embeds: [{
description: `Deleted ${messages.size} messages`,
color: embedColor
}],
})
})
}
}

74
src/commands/config.js Normal file
View File

@@ -0,0 +1,74 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { color } = require("../../config/options.json")
const settings = require("../schemas/settingsSchema.js")
const mongoose = require("mongoose")
module.exports = {
name: "config",
description: "Configure the bot",
type: "slash",
dev: true,
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),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const setting = interaction.options.getString("setting")
const value = interaction.options.getString("value")
const embedColor = Number(color.replace("#", "0x"))
const settingsData = await settings.findOne({ name: setting })
if (!settingsData) {
const newSetting = new settings({
_id: new mongoose.Types.ObjectId(),
name: setting,
value: value
})
await newSetting.save()
await interaction.editReply({
embeds: [{
description: "Successfully created `" + setting + "` with value `" + value + "`.",
color: embedColor
}]
})
} else {
await settings.findOneAndUpdate(
{ name: setting },
{ value: value }
)
await interaction.editReply({
embeds: [{
description: "Successfully updated `" + setting + "` to value `" + value + "`.",
}]
})
}
}
}

49
src/commands/devel.js Normal file
View File

@@ -0,0 +1,49 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention, EmbedBuilder, ChannelType } = require("discord.js")
module.exports = {
name: "admin",
description: "Admin command.",
type: "slash",
data: new SlashCommandBuilder()
.setName("devel")
.setDescription("Admin command.")
.addSubcommand(subcommand =>
subcommand
.setName("reload")
.setDescription("Reload the bot."))
.addSubcommand(subcommand =>
subcommand
.setName("listallverified")
.setDescription("List all verified users."))
.addSubcommand(subcommand =>
subcommand
.setName("purgereactions")
.setDescription("Purge all reactions from a messages.")
.addIntegerOption(option =>
option
.setName("count")
.setDescription("Count of messages to purge reactions from.")))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
const subcommand = interaction.options.getSubcommand()
if (subcommand === "reload") {
const { exec } = require("child_process")
await interaction.reply({ content: "Reloading...", ephemeral: true })
exec("pm2 restart 0", async (err, stdout, stderr) => {
if (err) {
await interaction.reply({ content: "Error while reloading: " + err, ephemeral: true })
}
})
}
}
}

View File

@@ -0,0 +1,55 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { color } = require("../../config/options.json")
const verify = require("../schemas/verifySchema.js")
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require("../../config/roles.json")
const removeThese = [gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember]
module.exports = {
name: "forceunverify",
description: "Force unverify a user",
type: "slash",
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),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
const member1 = interaction.options.getUser("user")
const member = interaction.guild.members.cache.get(member1.id)
const embedColor = Number(color.replace("#", "0x"))
const verifiedUser = await verify.findOne({ userID: member1.id })
if (!verifiedUser) {
return interaction.reply({
embeds: [{
description: "This user is not verified",
color: embedColor,
}]
})
}
await verify.findOneAndDelete({ userID: member1.id })
await member.roles.remove(removeThese)
await interaction.reply({
embeds: [{
description: "Successfully unverified " + userMention(member1.id),
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
}

282
src/commands/forceupdate.js Normal file
View File

@@ -0,0 +1,282 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { getGuild, getHeadURL, getIGN } = require("../utils/utils.js")
const { hypixelGuildID, color } = require("../../config/options.json")
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../../config/roles.json")
const verify = require("../schemas/verifySchema.js")
const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff]
module.exports = {
name: "forceupdate",
description: "Force update the user",
type: "slash",
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),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const user = interaction.options.getUser("user")
const usermentioned = userMention(user.id)
const verifyData = await verify.findOne({ userID: user.id })
const embedColor = Number(color.replace("#", "0x"))
const user1 = interaction.guild.members.cache.get(user.id)
const roleManage = user1.roles
if (!verifyData) {
await interaction.editReply({
embeds: [{
description: "User is not verified.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
const ign = await getIGN(verifyData.uuid)
const head = await getHeadURL(ign)
const guild = await getGuild(verifyData.uuid)
let responseGuildID = ""
if (!guild) {
responseGuildID = null
} else {
responseGuildID = guild._id
}
if (responseGuildID !== hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await interaction.editReply({
embeds: [{
description: usermentioned + " was given the the Default Member role.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
await roleManage.add(defaultMember)
return
}
if (responseGuildID === hypixelGuildID) {
const GuildMembers = guild.members
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank
if (guildRank === "Guild Master") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(gm, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s rank has been updated to `Guild Master`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
if (guildRank === "Manager") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(manager, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s rank has been updated to `Manager`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
if (guildRank === "Moderator") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(moderator, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s rank has been updated to `Moderator`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
if (guildRank === "Beast") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(beast, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s rank has been updated to `Beast`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === "Elite") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(elite, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s rank has been updated to `Elite`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === "Member") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(member, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s rank has been updated to `Member`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === "Trial Member") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(trialmember, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s rank has been updated to `Trial Member`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
}
}
}

170
src/commands/forceverify.js Normal file
View File

@@ -0,0 +1,170 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js")
const { color, hypixelGuildID } = require("../../config/options.json")
const verify = require("../schemas/verifySchema.js")
const { mongoose } = require("mongoose")
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../../config/roles.json")
module.exports = {
name: "forceverify",
description: "Force verify a user.",
type: "slash",
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),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const user1 = interaction.options.getUser("user")
const user = interaction.guild.members.cache.get(user1.id)
const ign = interaction.options.getString("ign")
const mod = interaction.user
const embedColor = Number(color.replace("#", "0x"))
const verifyData = await verify.findOne({ userID: user.id })
if (verifyData) {
interaction.editReply("That user is already verified.")
return
}
if (!user) {
interaction.editReply("Please provide a user to force verify.\nThis 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 (user1.discriminator == "0") {
username = user1.username
} else {
username = user1.username + "#" + user1.discriminator
}
let modName = ""
if (mod.discriminator == "0") {
modName = mod.username
} else {
modName = mod.username + "#" + mod.discriminator
}
const uuid = await getUUID(ign)
if (!uuid) {
interaction.editReply({
embeds: [{
description: "<a:questionmark_pink:1130206038008803488> That player doesn't exist.",
color: embedColor
}]
})
return
}
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 guild = await getGuild(uuid)
let responseGuildID = ""
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") {
await user.roles.add(gm, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName)
}
if (guildRank === "Manager") {
await user.roles.add(manager, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName)
}
if (guildRank === "Moderator") {
await user.roles.add(moderator, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName)
}
if (guildRank === "Beast") {
await user.roles.add(beast, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName)
}
if (guildRank === "Elite") {
await user.roles.add(elite, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName)
}
if (guildRank === "Member") {
await user.roles.add(member, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName)
}
if (guildRank === "Trial Member") {
await user.roles.add(trialmember, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName)
}
}
await user.roles.add(defaultMember, "User was force verified by " + modName)
const newVerify = new verify({
_id: new mongoose.Types.ObjectId(),
userID: user.id,
uuid: uuid
})
await newVerify.save()
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(),
text: interaction.guild.name + " | Developed by Taken#0002"
}
}]
})
}
}

68
src/commands/guild.js Normal file
View File

@@ -0,0 +1,68 @@
const { SlashCommandBuilder } = require("discord.js")
const { color } = require("../../config/options.json")
const { guildMember } = require("./guild/member.js")
const { guildInfo } = require("./guild/info.js")
module.exports = {
name: "guild",
description: "Subcommands for guilds",
type: "slash",
data: new SlashCommandBuilder()
.setName("guild")
.setDescription("Subcommands for guilds")
.addSubcommand(subcommand =>
subcommand
.setName("member")
.setDescription("Get info about a guild memeber")
.addStringOption(option =>
option
.setName("ign")
.setDescription("The IGN of the player.")
.setRequired(true)
)
)
.addSubcommand(subcommand =>
subcommand
.setName("info")
.setDescription("Get info about a guild.")
.addStringOption(option =>
option
.setName("ign")
.setDescription("The IGN of a member.")
.setRequired(true)
)
)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const subcommand = interaction.options.getSubcommand()
const embedColor = Number(color.replace("#", "0x"))
if (subcommand === "member") {
await guildMember(interaction)
return
}
if (subcommand === "info") {
await guildInfo(interaction)
return
}
await interaction.editReply({
embeds: [{
description: "This command is currently under development",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
}

103
src/commands/guild/info.js Normal file
View File

@@ -0,0 +1,103 @@
const { getUUID, getIGN, getPlayer, getGuild, guildLevel } = require("../../utils/utils.js")
const { color } = require("../../../config/options.json")
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async function guildInfo(interaction) {
const ign = interaction.options.getString("ign")
const embedColor = Number(color.replace("#", "0x"))
const uuid = await getUUID(ign)
if (!uuid) {
interaction.editReply({
embeds: [{
description: "That player doen't exist!",
color: embedColor
}]
})
return
}
const player = await getPlayer(uuid)
if (!player) {
interaction.editReply({
embeds: [{
description: "That player has never joined the server!",
color: embedColor
}]
})
return
}
const guild = await getGuild(uuid)
if (!guild) {
interaction.editReply({
embeds: [{
description: "That player is not in a guild!",
color: embedColor
}]
})
return
}
const guildName = guild.name
const guildCreatedMS = guild.created
const guildCreated = new Date(guildCreatedMS)
const guildTag = guild.tag
const guildExp = guild.exp
const guildLvl = guildLevel(guildExp)
const guildMembers = guild.members
const guildCreatedDate = guildCreated.getDate()
const guildCreatedMonth = guildCreated.getMonth() + 1
const guildCreatedYear = guildCreated.getFullYear()
const guildCreatedHour = guildCreated.getHours()
const guildCreatedMinute = guildCreated.getMinutes()
const guildCreatedSecond = guildCreated.getSeconds()
const guildCreatedTime = guildCreatedDate + "." +
guildCreatedMonth + "." +
guildCreatedYear + " " +
guildCreatedHour + ":" +
guildCreatedMinute + ":" +
guildCreatedSecond
const guildOwner = guildMembers.find((m) => m.rank === "Guild Master").uuid
const guildOwnerName = await getIGN(guildOwner)
const guildRanks = guild.ranks.map((r) => "**➺ " + r.name + "** `[" + r.tag + "]`").join("\n")
const guildMembersDailyXP = Object.values(guildMembers).map((m) => m.expHistory[Object.keys(m.expHistory)[0]])
const totalGuildMembersDailyXP = guildMembersDailyXP.reduce((a, b) => a + b, 0)
await interaction.editReply({
embeds: [{
title: "**Info on** " + guildName,
description: "**Guild Name: **`" + guildName + "`\n" +
"**Guild Tag: **`" + guildTag + "`\n" +
"**Guild Level: **`" + guildLvl + "`\n" +
"**Guild Owner: **`" + guildOwnerName + "`",
fields: [
{
name: "**Guild Ranks**",
value: guildRanks
},
{
name: "**GEXP**",
value: "**➺ Total weekly GEXP:** `" + totalGuildMembersDailyXP + "`"
},
{
name: "**Guild Created**",
value: "**➺ **`" + guildCreatedTime + "`"
}
],
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
module.exports = { guildInfo }

View File

@@ -0,0 +1,148 @@
const { getUUID, getPlayer, getGuild, getHeadURL } = require("../../utils/utils.js")
const { color } = require("../../../config/options.json")
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async function guildMember(interaction) {
const ign = interaction.options.getString("ign")
const embedColor = Number(color.replace("#", "0x"))
const uuid = await getUUID(ign)
if (!uuid) {
interaction.editReply({
embeds: [
{
description: "This user does not exist",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
})
}
const head = await getHeadURL(ign)
const player = await getPlayer(uuid)
if (!player) {
await interaction.editReply({
embeds: [
{
description: "This user never logged on to hypixel",
color: embedColor,
thumbnail: {
url: head,
},
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
})
}
const serverRank = player.newPackageRank
const monthlyRank = player.monthlyPackageRank
const displayName = player.displayname
let rank = ""
if (serverRank === "VIP") {
rank = "[VIP] "
} else if (serverRank === "VIP_PLUS") {
rank = "[VIP+] "
} else if (serverRank === "MVP") {
rank = "[MVP] "
} else if (serverRank === "MVP_PLUS" && monthlyRank === "NONE") {
rank = "[MVP+] "
} else if (serverRank === "MVP_PLUS" && monthlyRank === "SUPERSTAR") {
rank = "[MVP++] "
}
const guild = await getGuild(uuid)
if (!guild) {
await interaction.editReply({
embeds: [
{
description: "This user is not in a guild",
color: embedColor,
thumbnail: {
url: head,
},
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
})
}
const guildName = guild.name
const guildTag = " [" + guild.tag + "]" ?? ""
const guildMembers = guild.members
const guildMember = guildMembers.find((member) => member.uuid === uuid)
const guildRank = guildMember.rank
const memberGexp = guildMember.expHistory
const allDaysGexp = Object.keys(memberGexp).map((key) => {
return "**➺ " + key + ":** " + "`" + memberGexp[key] + "`" + "\n"
})
const expValue = allDaysGexp.join("")
const totalWeeklyGexp = Object.values(memberGexp).reduce((a, b) => a + b, 0)
const averageWeeklyGexp = Math.round(totalWeeklyGexp / 7)
const guildMemberJoinMS = guildMember.joined
const guildMemberJoinTime = new Date(guildMemberJoinMS)
const guildMemberJoinDate = guildMemberJoinTime.getDate()
const guildMemberJoinMonth = guildMemberJoinTime.getMonth() + 1
const guildMemberJoinYear = guildMemberJoinTime.getFullYear()
const guildMemberJoinHours = guildMemberJoinTime.getHours()
const guildMemberJoinMinutes = guildMemberJoinTime.getMinutes()
const guildMemberJoinSeconds = guildMemberJoinTime.getSeconds()
const guildMemberJoin =
guildMemberJoinDate + "." +
guildMemberJoinMonth + "." +
guildMemberJoinYear + " " +
guildMemberJoinHours + ":" +
guildMemberJoinMinutes + ":" +
guildMemberJoinSeconds
await interaction.editReply({
embeds: [
{
title: rank + displayName + guildTag,
description: "**Guild Name:** `" + guildName + "`\n" +
"**Guild Rank:** `" + guildRank + "`\n",
color: embedColor,
thumbnail: {
url: head,
},
fields: [
{
name: "**Daily GEXP**",
value: expValue,
},
{
name: "**Weekly GEXP**",
value: "**➺ Total:** `" + totalWeeklyGexp + "`\n" +
"**➺ Daily avarage:** `" + averageWeeklyGexp + "`",
},
{
name: "**Join date**",
value: "**➺ **`" + guildMemberJoin + "`",
},
],
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
})
return
}
module.exports = { guildMember }

56
src/commands/help.js Normal file
View File

@@ -0,0 +1,56 @@
const { SlashCommandBuilder, ChannelType } = require("discord.js")
const { color } = require("../../config/options.json")
module.exports = {
name: "help",
description: "Help command",
type: "slash",
data: new SlashCommandBuilder()
.setName("help")
.setDescription("Help command")
.setDMPermission(true),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply({ ephemeral: true })
const embedColor = Number(color.replace("#", "0x"))
await interaction.editReply({
embeds: [{
title: "Commands",
description: "List of commands",
fields: [
{
name: "/check",
value: "Check the stats of a player"
},
{
name: "/reqs",
value: "Check the requirements of the guild"
},
{
name: "/update",
value: "Update's your roles"
},
{
name: "/help",
value: "Shows this message"
}
],
color: embedColor,
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
},
footer: {
icon_url: interaction.guild.iconURL({ dynamic: true }),
text: interaction.guild.name + " | Developed by: @Taken#0001"
}
}]
})
}
}

84
src/commands/kick.js Normal file
View File

@@ -0,0 +1,84 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { admin, helper } = require("../../config/roles.json")
const { color } = require("../../config/options.json")
module.exports = {
name: "kick",
description: "Kick a member from the server.",
type: "slash",
data: new SlashCommandBuilder()
.setName("kick")
.setDescription("Kick a member from the server.")
.addUserOption(option =>
option
.setName("member")
.setDescription("Member to kick.")
.setRequired(true))
.addStringOption(option =>
option
.setName("reason")
.setDescription("Reason for kicking the member."))
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const member = interaction.options.getMember("member")
const reason = interaction.options.getString("reason") ?? "No reason provided."
const mod = await interaction.guild.members.fetch(interaction.user.id)
const memberRoles = member.roles.cache.map(role => role.id)
const modRoles = mod.roles.cache.map(role => role.id)
const embedColor = Number(color.replace("#", "0x"))
if (!modRoles.includes(helper) && !modRoles.includes(admin)) {
await interaction.editReply("You do not have permission to use this command.")
return
}
if (member.id === interaction.applicationId) {
await interaction.editReply("I cannot kick myself.")
return
}
if (member.id === interaction.guild.ownerId) {
await interaction.editReply("I cannot kick the server owner.")
return
}
if (member.id === mod.id) {
return interaction.editReply("You cannot kick yourself.")
}
if (memberRoles.includes(helper) || memberRoles.includes(admin)) {
await interaction.editReply("I cannot kick a moderator.")
return
}
if (!member.kickable) {
await interaction.editReply("I cannot kick this member.")
return
}
await member.kick(reason + ` - ${mod.user.username}`)
await interaction.editReply({
embeds: [{
title: "Member Kicked",
description: "**User:** " + userMention(member.user.id) + "\n" +
"**Reason:** " + reason + "\n" +
"**Moderator:** " + mod.user.username,
color: embedColor,
footer: {
text: member.user.id,
icon_url: member.user.avatarURL({ dynamic: true })
},
}]
})
}
}

62
src/commands/remove.js Normal file
View File

@@ -0,0 +1,62 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { color } = require("../../config/options.json")
const { waitinglistSchema } = require("../schemas/waitinglistSchema.js")
module.exports = {
name: "remove",
description: "Remove a person on the waiting list.",
type: "slash",
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),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
interaction.deferReply()
const user = interaction.options.getUser("user")
const reason = interaction.options.getString("reason") ?? "No reason provided."
const mod = interaction.user
const embedColor = Number(color.replace("#", "0x"))
const waitinglist = await waitinglistSchema.findOne({ UserID: user.id })
if (!waitinglist) {
await interaction.editReply({
embeds: [{
description: userMention(user.id) + " is not on the waiting list.",
color: color
}]
})
return
}
await waitinglistSchema.findOneAndDelete({ UserID: user.id })
await interaction.editReply({
embeds: [{
description: userMention(user.id) + " has been removed from the waiting list.\n" +
"**Reason:** `" + reason + "`\n" +
"**Moderator:** " + userMention(mod.id),
color: embedColor,
}]
})
}
}

53
src/commands/reqs.js Normal file
View File

@@ -0,0 +1,53 @@
const { SlashCommandBuilder } = require("discord.js")
const { color } = require("../../config/options.json")
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../config/reqs.json")
module.exports = {
name: "reqs",
description: "Displays the requirements for the guild.",
type: "slash",
data: new SlashCommandBuilder()
.setName("reqs")
.setDescription("Displays the requirements for the guild."),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply({ ephemeral: true })
const embedColor = Number(color.replace("#", "0x"))
await interaction.editReply({
embeds: [{
title: "Requirements",
description: "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**",
color: embedColor,
thumbnail: {
url: interaction.guild.iconURL()
},
fields: [
{
name: "**Bedwars**",
value: "**Stars:** `" + bwstars.toString() +
"`\n**Wins:** `" + bwwins.toString() +
"`\n**FKDR:** `" + bwfkdr.toString() + "`"
},
{
name: "**Skywars**",
value: "**Stars:** `" + swstars.toString() + "`"
},
{
name: "**Duels**",
value: "**Wins:** `" + duelswins.toString() +
"`\n**WLR:** `" + duelswlr.toString() + "`"
}
],
footer: {
text: interaction.guild.name + " | Developed by: @Taken#0002",
icon_url: interaction.guild.iconURL()
}
}]
})
}
}

59
src/commands/send.js Normal file
View File

@@ -0,0 +1,59 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { color } = require("../../config/options.json")
module.exports = {
name: "send",
description: "Send a message to a channel.",
type: "slash",
data: new SlashCommandBuilder()
.setName("send")
.setDescription("Send a message to a channel.")
.addStringOption(option =>
option
.setName("message")
.setDescription("The message to send."))
.addChannelOption(option =>
option
.setName("channel")
.setDescription("The channel to send the message to."))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply({ ephemeral: true })
const message = interaction.options.getString("message")
const channel = interaction.options.getChannel("channel")
const embedColor = Number(color.replace("#", "0x"))
if (!message) {
interaction.editReply({ content: "Please provide a message to send.", ephemeral: true })
return
}
if (!channel) {
interaction.editReply({ content: "Please provide a channel to send the message to.", ephemeral: true })
return
}
channel.send({
embeds: [
{
title: interaction.guild.name,
description: message,
color: embedColor,
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
},
footer: {
text: "Developed by @Taken#0002"
}
}
]
})
}
}

41
src/commands/setnick.js Normal file
View File

@@ -0,0 +1,41 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
module.exports = {
name: "setnick",
description: "Set your nickname",
type: "slash",
data: new SlashCommandBuilder()
.setName("setnick")
.setDescription("Set your nickname")
.addUserOption(option =>
option
.setName("user")
.setDescription("The user to set the nickname for")
.setRequired(true))
.addStringOption(option =>
option
.setName("nickname")
.setDescription("The nickname to set")
.setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
const user = interaction.options.getUser("user")
const nickname = interaction.options.getString("nickname")
const member = await interaction.guild.members.fetch(user.id)
if (!member.manageable) {
return interaction.reply({ content: "I cannot set the nickname for this user!", ephemeral: true })
}
await member.setNickname(nickname, `Set by ${interaction.user.tag}`)
await interaction.reply({ content: "Set the nickname of " + userMention(member.id) + " to " + nickname, ephemeral: true })
}
}

222
src/commands/setup.js Normal file
View File

@@ -0,0 +1,222 @@
const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, } = require("discord.js")
const { color } = require("../../config/options.json")
module.exports = {
name: "setup",
description: "Used for setup of the bot.",
type: "slash",
dev: true,
data: new SlashCommandBuilder()
.setName("setup")
.setDescription("Configure the bot.")
.addSubcommand((subcommand) =>
subcommand
.setName("sendguildapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true))
)
.addSubcommand((subcommand) =>
subcommand
.setName("sendstaffapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.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.")
.setRequired(true)))
.addSubcommand((subcommand) =>
subcommand
.setName("sendwaitinglistmessage")
.setDescription("Send the waiting list message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the waiting list message to.")
.setRequired(true)))
.addSubcommand((subcommand) =>
subcommand
.setName("sendinactivityapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true)))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
const user = interaction.user
const guild = interaction.guild
const subcommand = interaction.options.getSubcommand()
const embedColor = Number(color.replace("#", "0x"))
if (subcommand === "sendguildapplication") {
const channel = interaction.options.getChannel("channel")
await channel.send({
embeds: [
{
title: "Guild Application",
description: "You can apply for the guild by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}
],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("guildapply")
.setLabel("Apply")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }))
]
})
await interaction.reply({ content: "Message sent", ephemeral: true })
}
if (subcommand === "sendstaffapplication") {
const channel = interaction.options.getChannel("channel")
await channel.send({
embeds: [
{
title: "Staff Application",
description: "You can apply for the staff team by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}
],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("staffapply")
.setLabel("Apply")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }))
]
})
await interaction.reply({ content: "Message sent", ephemeral: true })
}
if (subcommand === "sendinactivityapplication") {
const channel = interaction.options.getChannel("channel")
await channel.send({
embeds: [
{
title: "Inactivity Log",
description: "You can send an inactivity log by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}
],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("guildinactivitylog")
.setLabel("Submit")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }))
]
})
await interaction.reply({ content: "Message sent", ephemeral: true })
}
if (subcommand === "sendverfiymessage") {
const channel = interaction.options.getChannel("channel")
await channel.send({
embeds: [{
title: "Verification",
description: "You can verify by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("verifybutton")
.setLabel("Verify")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }))
]
})
await interaction.reply({ content: "Message sent", ephemeral: true })
}
if (subcommand === "sendwaitinglistmessage") {
const channel = interaction.options.getChannel("channel")
await channel.send({
embeds: [{
title: "Waiting List",
description: "The people below were accepted into the guild\n" +
"Try to invite them in order.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("waitinglistupdate")
.setLabel("Update")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "🔄" }))
]
})
await interaction.reply({ content: "Message sent", ephemeral: true })
}
}
}

61
src/commands/slowmode.js Normal file
View File

@@ -0,0 +1,61 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { color } = require("../../config/options.json")
module.exports = {
name: "slowmode",
description: "Set the slowmode of a channel.",
type: "slash",
data: new SlashCommandBuilder()
.setName("slowmode")
.setDescription("Set the slowmode of a channel.")
.addIntegerOption(option =>
option
.setName("seconds")
.setDescription("The amount of seconds to set the slowmode to."))
.addChannelOption(option =>
option
.setName("channel")
.setDescription("The channel to set the slowmode of."))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply({ ephermeral: true })
const seconds = interaction.options.getInteger("seconds") ?? 5
const channel = interaction.options.getChannel("channel") ?? interaction.channel
const embedColor = Number(color.replace("#", "0x"))
if (seconds > 21600) {
await channel.setRateLimitPerUser(21600)
await interaction.editReply({
embeds: [{
description: `Set the slowmode of ${channel} to 21600 seconds.`,
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by: @Taken#0001",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
await interaction.editReply({
embeds: [{
description: `Set the slowmode of ${channel} to ${seconds} seconds.`,
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by: @Taken#0001",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
await channel.setRateLimitPerUser(seconds)
}
}

274
src/commands/update.js Normal file
View File

@@ -0,0 +1,274 @@
const { SlashCommandBuilder } = require("discord.js")
const { getGuild, getIGN, getHeadURL } = require("../utils/utils.js")
const verify = require("../schemas/verifySchema.js")
const { color, hypixelGuildID } = require("../../config/options.json")
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../../config/roles.json")
const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff]
module.exports = {
name: "update",
description: "Update your guild rank.",
type: "slash",
data: new SlashCommandBuilder()
.setName("update")
.setDescription("Update your guild rank.")
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const user1 = interaction.user
const user = interaction.guild.members.cache.get(user1.id)
const verifyData = await verify.findOne({ userID: user.id })
const roleManage = user.roles
const embedColor = Number(color.replace("#", "0x"))
if (!verifyData) {
await interaction.editReply({
embeds: [{
description: "You are not verified. Please run `/verify` to verify yourself",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
const guild = await getGuild(verifyData.uuid)
let guildID = ""
if (!guild) {
guildID = null
} else {
guildID = guild._id
}
const ign = await getIGN(verifyData.uuid)
const head = await getHeadURL(ign)
if (guildID !== hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Updated your roles to `Default Member`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildID === hypixelGuildID) {
const GuildMembers = guild.members
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank
if (guildRank === "Guild Master") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(guildStaff, "User used the update command")
await roleManage.add(gm, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Guild Master`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
if (guildRank === "Manager") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(guildStaff, "User used the update command")
await roleManage.add(manager, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Manager`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
if (guildRank === "Moderator") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(guildStaff, "User used the update command")
await roleManage.add(moderator, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Moderator`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
if (guildRank === "Beast") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(beast, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Beast`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === "Elite") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(elite, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Elite`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === "Member") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(member, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Member`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === "Trial Member") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(trialmember, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Trial Member`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
}
}
}

56
src/commands/uuid.js Normal file
View File

@@ -0,0 +1,56 @@
const { SlashCommandBuilder } = require("discord.js")
const { color } = require("../../config/options.json")
const { getUUID, getIGN, getHeadURL, formatUuid } = require("../utils/utils.js")
module.exports = {
name: "uuid",
description: "Get a player's UUID",
type: "slash",
data: new SlashCommandBuilder()
.setName("uuid")
.setDescription("Get a player's UUID")
.addStringOption(option => option
.setName("ign")
.setDescription("Player's name")
.setRequired(true)
),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const ign = interaction.options.getString("ign")
const uuid = await getUUID(ign)
const formattedUuid = formatUuid(uuid)
const newIgn = await getIGN(uuid)
const head = await getHeadURL(ign)
const embedColor = Number(color.replace("#", "0x"))
if (!uuid) {
interaction.editReply({
description: "That player doesn't exist!",
color: embedColor
})
return
}
await interaction.editReply({
embeds: [{
title: newIgn,
description: "**UUID:** `" + uuid + "`\n" +
"**Formatted UUID:** `" + formattedUuid + "`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
}

197
src/commands/verify.js Normal file
View File

@@ -0,0 +1,197 @@
const { SlashCommandBuilder } = require("discord.js")
const { getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js")
const { color, hypixelGuildID } = require("../../config/options.json")
const verify = require("../schemas/verifySchema.js")
const mongoose = require("mongoose")
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../../config/roles.json")
module.exports = {
name: "verify",
description: "Verify yourself as a member of the server.",
type: "slash",
data: new SlashCommandBuilder()
.setName("verify")
.setDescription("Verify yourself as a member of the server.")
.addStringOption((option) =>
option
.setName("ign")
.setDescription("Your in-game name."))
.setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const user1 = interaction.user
const user = interaction.guild.members.cache.get(user1.id)
const ign = interaction.options.getString("ign")
const embedColor = Number(color.replace("#", "0x"))
const verifyData = await verify.findOne({ 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
}
const uuid = await getUUID(ign)
if (!uuid) {
interaction.editReply({
embeds: [{
description: "<a:questionmark_pink:1130206038008803488> That player does not exist.",
color: embedColor
}]
})
return
}
const head = await 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
}
let username = ""
if (user1.discriminator === "0") {
username = user1.username
} else {
username = user1.username + "#" + user1.discriminator
}
if (!player.socialMedia) {
interaction.editReply({
embeds: [
{
description: "<a:cross_a:1087808606897983539> There is no Discord account linked to `" + stats.data.player.displayname + "`.\n\n" +
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
color: embedColor
}
]
})
return
}
if (!player.socialMedia.links.DISCORD) {
interaction.editReply({
embeds: [
{
description: "<a:cross_a:1087808606897983539> There is no Discord account linked to `" + stats.data.player.displayname + "`.\n\n" +
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
color: embedColor
}
]
})
return
}
const linkedDiscord = player.socialMedia.links.DISCORD
if (linkedDiscord !== username) {
interaction.editReply({
embeds: [
{
description: "<a:cross_a:1087808606897983539> The Discord account linked to `" + stats.data.player.displayname + "` is currently `" + linkedDiscord + "`\n\n" +
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
color: embedColor
}
]
})
return
}
const guild = await getGuild(uuid)
let guildID = ""
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" && guildID === hypixelGuildID) {
await user.roles.add(gm, "Verification")
await user.roles.add(guildRole, "Verification")
await user.roles.add(guildStaff, "Verification")
}
if (guildRank === "Manager" && guildID === hypixelGuildID) {
await user.roles.add(manager, "Verification")
await user.roles.add(guildRole, "Verification")
await user.roles.add(guildStaff, "Verification")
}
if (guildRank === "Moderator" && guildID === hypixelGuildID) {
await user.roles.add(moderator, "Verification")
await user.roles.add(guildRole, "Verification")
await user.roles.add(guildStaff, "Verification")
}
if (guildRank === "Beast" && guildID === hypixelGuildID) {
await user.roles.add(beast, "Verification")
await user.roles.add(guildRole, "Verification")
}
if (guildRank === "Elite" && guildID === hypixelGuildID) {
await user.roles.add(elite, "Verification")
await user.roles.add(guildRole, "Verification")
}
if (guildRank === "Member" && guildID === hypixelGuildID) {
await user.roles.add(member, "Verification")
await user.roles.add(guildRole, "Verification")
}
if (guildRank === "Trial Member" && guildID === hypixelGuildID) {
await user.roles.add(trialmember, "Verification")
await user.roles.add(guildRole, "Verification")
}
}
await user.roles.add(defaultMember, "Verification")
const newVerify = new verify({
_id: new mongoose.Types.ObjectId(),
userID: user.id,
uuid: uuid
})
await newVerify.save()
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(),
text: interaction.guild.name + " | Developed by Taken#0002"
}
}
]
})
}
}

56
src/commands/whois.js Normal file
View File

@@ -0,0 +1,56 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { getIGN, getHeadURL } = require("../utils/utils.js")
const { color } = require("../../config/options.json")
const verify = require("../schemas/verifySchema.js")
module.exports = {
name: "whois",
description: "Get's the ign of a user.",
type: "slash",
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),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) {
await interaction.deferReply()
const user = interaction.options.getUser("user")
const embedColor = Number(color.replace("#", "0x"))
const verifiedUser = await verify.findOne({ userID: user.id })
if (!verifiedUser) {
interaction.editReply({ content: "This user has not verified their account." })
return
}
const ign = await getIGN(verifiedUser.uuid)
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 + " | Developed by: @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
}