Added eslintrc config and updated all files to it

This commit is contained in:
2023-11-22 23:50:21 +01:00
parent 10771fd04e
commit 3d4fc1fccb
70 changed files with 1276 additions and 1234 deletions

42
.eslintrc.js Normal file
View File

@@ -0,0 +1,42 @@
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": "eslint:recommended",
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"windows"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"never"
]
}
}

View File

@@ -1,12 +1,12 @@
const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention } = require('discord.js'); const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention } = require("discord.js")
module.exports = { module.exports = {
name: 'congratsmessage', name: "congratsmessage",
description: 'Congratulate a user.', description: "Congratulate a user.",
type: 'contextmenu', type: "contextmenu",
data: new ContextMenuCommandBuilder() data: new ContextMenuCommandBuilder()
.setName('Congratulate') .setName("Congratulate")
.setType(ApplicationCommandType.Message) .setType(ApplicationCommandType.Message)
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages), .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
@@ -15,22 +15,22 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
const { targetId } = interaction const { targetId } = interaction
const message = await interaction.channel.messages.fetch(targetId); const message = await interaction.channel.messages.fetch(targetId)
if (!message) { if (!message) {
return interaction.reply({ content: 'That user does not exist.', ephemeral: true }); return interaction.reply({ content: "That user does not exist.", ephemeral: true })
} }
const target = message.author; const target = message.author
await message.reply({ await message.reply({
embeds: [{ embeds: [{
title: 'Congratulations!', title: "Congratulations!",
description: `GG to ${userMention(target.id)}!`, description: `GG to ${userMention(target.id)}!`,
}] }]
}); })
await message.react('🎉'); await message.react("🎉")
await interaction.reply({ content: `Sent a congrats message`, ephemeral: true }); await interaction.reply({ content: "Sent a congrats message", ephemeral: true })
} }
}; }

View File

@@ -1,12 +1,12 @@
const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits } = require('discord.js'); const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits } = require("discord.js")
module.exports = { module.exports = {
name: 'resetnick', name: "resetnick",
description: 'Reset your nickname.', description: "Reset your nickname.",
type: 'contextmenu', type: "contextmenu",
data: new ContextMenuCommandBuilder() data: new ContextMenuCommandBuilder()
.setName('Reset Nickname') .setName("Reset Nickname")
.setType(ApplicationCommandType.User) .setType(ApplicationCommandType.User)
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames), .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames),
@@ -15,22 +15,22 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
const { targetId } = interaction const { targetId } = interaction
const target = await interaction.guild.members.fetch(targetId); const target = await interaction.guild.members.fetch(targetId)
if (!target) { if (!target) {
return interaction.reply({ content: 'That user does not exist.', ephemeral: true }); return interaction.reply({ content: "That user does not exist.", ephemeral: true })
} }
if (target.id === interaction.user.id) { if (target.id === interaction.user.id) {
return interaction.reply({ content: 'You can\'t reset your own nickname.', ephemeral: true }); return interaction.reply({ content: "You can't reset your own nickname.", ephemeral: true })
} }
if (!target.manageable) { if (!target.manageable) {
return interaction.reply({ content: 'I cannot reset that user\'s nickname.', ephemeral: true }); return interaction.reply({ content: "I cannot reset that user's nickname.", ephemeral: true })
} }
await target.setNickname(target.user.username, 'Reset by ' + interaction.user.username + "#" + interaction.user.discriminator); await target.setNickname(target.user.username, "Reset by " + interaction.user.username + "#" + interaction.user.discriminator)
return interaction.reply({ content: `Reset ${target.user.username}'s nickname.`, ephemeral: true }); return interaction.reply({ content: `Reset ${target.user.username}'s nickname.`, ephemeral: true })
} }
}; }

View File

@@ -1,25 +1,25 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
module.exports = { module.exports = {
name: 'dev-info', name: "dev-info",
description: 'Test command for the bot.', description: "Test command for the bot.",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('dev-info') .setName("dev-info")
.setDescription('Test command for the bot.') .setDescription("Test command for the bot.")
.addStringOption(option => .addStringOption(option =>
option option
.setName('test') .setName("test")
.setDescription('Test option.')) .setDescription("Test option."))
.addStringOption(option => .addStringOption(option =>
option option
.setName('test2') .setName("test2")
.setDescription('Test option.')) .setDescription("Test option."))
.addStringOption(option => .addStringOption(option =>
option option
.setName('test3') .setName("test3")
.setDescription('Test option.')) .setDescription("Test option."))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -27,17 +27,17 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
const test = interaction.options.getString('test'); const test = interaction.options.getString("test")
const test2 = interaction.options.getString('test2'); const test2 = interaction.options.getString("test2")
const test3 = interaction.options.getString('test3'); const test3 = interaction.options.getString("test3")
const message = await interaction.channel.messages.fetch(test); const message = await interaction.channel.messages.fetch(test)
const embed = message.embeds[0]; const embed = message.embeds[0]
const fields = embed.fields; const fields = embed.fields
const field1 = fields[0]; const field1 = fields[0]
console.log(field1.value); console.log(field1.value)
await interaction.reply({ content: 'Test command.', ephemeral: true }); await interaction.reply({ content: "Test command.", ephemeral: true })
} }
}; }

View File

@@ -1,28 +1,28 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js') const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { admin, helper } = require('../config/roles.json') const { admin, helper } = require("../config/roles.json")
const { color } = require('../config/options.json') const { color } = require("../config/options.json")
module.exports = { module.exports = {
name: 'ban', name: "ban",
description: 'Ban a user', description: "Ban a user",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('ban') .setName("ban")
.setDescription('Ban a user') .setDescription("Ban a user")
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName("user")
.setDescription('User to ban') .setDescription("User to ban")
.setRequired(true)) .setRequired(true))
.addStringOption(option => .addStringOption(option =>
option option
.setName('reason') .setName("reason")
.setDescription('Reason for ban')) .setDescription("Reason for ban"))
.addNumberOption(option => .addNumberOption(option =>
option option
.setName('messagedeletiondays') .setName("messagedeletiondays")
.setDescription('Number of days to delete messages') .setDescription("Number of days to delete messages")
.addChoices( .addChoices(
{ name: "1 day", value: 1 }, { name: "1 day", value: 1 },
{ name: "2 days", value: 2 }, { name: "2 days", value: 2 },
@@ -42,13 +42,13 @@ module.exports = {
await interaction.deferReply() await interaction.deferReply()
const member = interaction.options.getMember('user') const member = interaction.options.getMember("user")
const reason = interaction.options.getString('reason') ?? "No reason provided." const reason = interaction.options.getString("reason") ?? "No reason provided."
const messageDeletionDays = interaction.options.getNumber('messagedeletiondays') ?? 0 const messageDeletionDays = interaction.options.getNumber("messagedeletiondays") ?? 0
const mod = await interaction.guild.members.fetch(interaction.user.id) const mod = await interaction.guild.members.fetch(interaction.user.id)
const memberRoles = member.roles.cache.map(role => role.id) const memberRoles = member.roles.cache.map(role => role.id)
const modRoles = mod.roles.cache.map(role => role.id) const modRoles = mod.roles.cache.map(role => role.id)
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
if (!modRoles.includes(admin)) { if (!modRoles.includes(admin)) {
await interaction.editReply("You do not have permission to use this command.") await interaction.editReply("You do not have permission to use this command.")

View File

@@ -1,7 +1,7 @@
const { SlashCommandBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js")
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../config/reqs.json"); const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../config/reqs.json")
const { color } = require("../config/options.json"); const { color } = require("../config/options.json")
const { hypixelLevel, bedwarsLevel, skywarsLevel, getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js"); const { hypixelLevel, bedwarsLevel, skywarsLevel, getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js")
module.exports = { module.exports = {
name: "check", name: "check",
@@ -20,27 +20,27 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({}); await interaction.deferReply({})
const ign = interaction.options.getString("ign"); const ign = interaction.options.getString("ign")
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
if (!ign) { if (!ign) {
await interaction.editReply("Please provide a player's IGN."); await interaction.editReply("Please provide a player's IGN.")
return; return
} }
const uuid = await getUUID(ign); const uuid = await getUUID(ign)
if (!uuid) { if (!uuid) {
interaction.editReply({ interaction.editReply({
embeds: [ embeds: [
{ description: "That player doesn't exist.", color: embedColor } { description: "That player doesn't exist.", color: embedColor }
] ]
}); })
return; return
} }
const head = await getHeadURL(ign); const head = await getHeadURL(ign)
const player = await getPlayer(uuid) const player = await getPlayer(uuid)
if (!player) { if (!player) {
interaction.editReply({ interaction.editReply({
@@ -48,32 +48,32 @@ module.exports = {
description: "That player hasn't played Hypixel before.", description: "That player hasn't played Hypixel before.",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
const rank2 = player.newPackageRank; const rank2 = player.newPackageRank
const monthlyRank = player.monthlyPackageRank; const monthlyRank = player.monthlyPackageRank
let rank = "" let rank = ""
if (rank2 === 'VIP') { if (rank2 === "VIP") {
rank = "[VIP] " rank = "[VIP] "
} else if (rank2 === 'VIP_PLUS') { } else if (rank2 === "VIP_PLUS") {
rank = "[VIP+] " rank = "[VIP+] "
} else if (rank2 === 'MVP') { } else if (rank2 === "MVP") {
rank = "[MVP] " rank = "[MVP] "
} else if (rank2 === 'MVP_PLUS' && monthlyRank === 'NONE') { } else if (rank2 === "MVP_PLUS" && monthlyRank === "NONE") {
rank = "[MVP+] " rank = "[MVP+] "
} else if (rank2 === 'MVP_PLUS' && monthlyRank === 'SUPERSTAR') { } else if (rank2 === "MVP_PLUS" && monthlyRank === "SUPERSTAR") {
rank = "[MVP++] " rank = "[MVP++] "
} }
const guild = await getGuild(uuid) const guild = await getGuild(uuid)
let guildName = "" let guildName = ""
if (!guild) { if (!guild) {
guildName = "None"; guildName = "None"
} else { } else {
guildName = guild.name; guildName = guild.name
} }
let guildTag = "" let guildTag = ""
@@ -86,61 +86,61 @@ module.exports = {
} }
//bedwars level //bedwars level
const hsbwexp = player.stats.Bedwars.Experience; const hsbwexp = player.stats.Bedwars.Experience
const hsbwstars = bedwarsLevel(hsbwexp); const hsbwstars = bedwarsLevel(hsbwexp)
// bedwars fkdr // bedwars fkdr
const hsbwfk = player.stats.Bedwars.final_kills_bedwars; const hsbwfk = player.stats.Bedwars.final_kills_bedwars
const hsbwfd = player.stats.Bedwars.final_deaths_bedwars; const hsbwfd = player.stats.Bedwars.final_deaths_bedwars
const hsbwfkdr = hsbwfk / hsbwfd; const hsbwfkdr = hsbwfk / hsbwfd
// bedwars wins // bedwars wins
const hsbwwins = player.stats.Bedwars.wins_bedwars; const hsbwwins = player.stats.Bedwars.wins_bedwars
// skywars level // skywars level
const hsswexp = player.stats.SkyWars.skywars_experience; const hsswexp = player.stats.SkyWars.skywars_experience
const hsswstars = skywarsLevel(hsswexp); const hsswstars = skywarsLevel(hsswexp)
// skywars kdr // skywars kdr
const hsswkills = player.stats.SkyWars.kills; const hsswkills = player.stats.SkyWars.kills
const hsswdeaths = player.stats.SkyWars.deaths; const hsswdeaths = player.stats.SkyWars.deaths
const hsswkd = hsswkills / hsswdeaths; const hsswkd = hsswkills / hsswdeaths
//skywars wins //skywars wins
const hsswwins = player.stats.SkyWars.wins; const hsswwins = player.stats.SkyWars.wins
// dueks kdr // dueks kdr
const hsduelskills = player.stats.Duels.kills const hsduelskills = player.stats.Duels.kills
const hsduelsdeaths = player.stats.Duels.deaths const hsduelsdeaths = player.stats.Duels.deaths
const hsduelskd = hsduelskills / hsduelsdeaths const hsduelskd = hsduelskills / hsduelsdeaths
// duels wins // duels wins
const hsduelswins = player.stats.Duels.wins; const hsduelswins = player.stats.Duels.wins
// duels wlr // duels wlr
const hsduelslosses = player.stats.Duels.losses; const hsduelslosses = player.stats.Duels.losses
const hsduelswlr = hsduelswins / hsduelslosses; const hsduelswlr = hsduelswins / hsduelslosses
// network level // network level
const hypixelExp = player.networkExp; const hypixelExp = player.networkExp
const level = hypixelLevel(hypixelExp); const level = hypixelLevel(hypixelExp)
let bwtitle = "" let bwtitle = ""
let swtitle = "" let swtitle = ""
let duelstitle = "" let duelstitle = ""
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) { if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
bwtitle = bwtitle =
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."; "<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
} else { } else {
bwtitle = bwtitle =
"<a:check_a:1087808632172847134> This player meets the BedWars requirements."; "<a:check_a:1087808632172847134> This player meets the BedWars requirements."
} }
if (hsswstars < swstars) { if (hsswstars < swstars) {
swtitle = swtitle =
"<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."; "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
} else { } else {
swtitle = swtitle =
"<a:check_a:1087808632172847134> This player meets the SkyWars requirements."; "<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
} }
if (hsduelswins < duelswins || hsduelswlr < duelswlr) { if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
duelstitle = duelstitle =
"<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."; "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
} else { } else {
duelstitle = duelstitle =
"<a:check_a:1087808632172847134> This player meets the Duels requirements."; "<a:check_a:1087808632172847134> This player meets the Duels requirements."
} }
await interaction.editReply({ await interaction.editReply({
@@ -195,6 +195,6 @@ module.exports = {
} }
] ]
}] }]
}); })
} }
}; }

View File

@@ -1,18 +1,18 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js') const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { color } = require('../config/options.json') const { color } = require("../config/options.json")
module.exports = { module.exports = {
name: 'clear', name: "clear",
description: 'Clears messages', description: "Clears messages",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('clear') .setName("clear")
.setDescription('Clears messages') .setDescription("Clears messages")
.addIntegerOption(option => .addIntegerOption(option =>
option option
.setName('amount') .setName("amount")
.setDescription('Amount of messages to clear') .setDescription("Amount of messages to clear")
.setRequired(true)) .setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -23,14 +23,14 @@ module.exports = {
await interaction.deferReply({ ephemeral: true }) await interaction.deferReply({ ephemeral: true })
const amount = interaction.options.getInteger('amount') const amount = interaction.options.getInteger("amount")
const channel = interaction.channel const channel = interaction.channel
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
if (!amount || amount < 1 || amount > 100) { if (!amount || amount < 1 || amount > 100) {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: 'Please provide an amount of messages to clear', description: "Please provide an amount of messages to clear",
color: embedColor color: embedColor
}], }],
}) })

View File

@@ -1,7 +1,7 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { color } = require("../config/options.json"); const { color } = require("../config/options.json")
const settings = require("../schemas/settingsSchema.js"); const settings = require("../schemas/settingsSchema.js")
const mongoose = require("mongoose"); const mongoose = require("mongoose")
module.exports = { module.exports = {
name: "config", name: "config",
@@ -33,12 +33,12 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply()
const setting = interaction.options.getString("setting") const setting = interaction.options.getString("setting")
const value = interaction.options.getString("value"); const value = interaction.options.getString("value")
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const settingsData = await settings.findOne({ name: setting }); const settingsData = await settings.findOne({ name: setting })
if (!settingsData) { if (!settingsData) {
@@ -46,22 +46,22 @@ module.exports = {
_id: new mongoose.Types.ObjectId(), _id: new mongoose.Types.ObjectId(),
name: setting, name: setting,
value: value value: value
}); })
await newSetting.save(); await newSetting.save()
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
description: "Successfully created `" + setting + "` with value `" + value + "`.", description: "Successfully created `" + setting + "` with value `" + value + "`.",
color: embedColor color: embedColor
}] }]
}); })
} else { } else {
await settings.findOneAndUpdate( await settings.findOneAndUpdate(
{ name: setting }, { name: setting },
{ value: value } { value: value }
); )
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{

View File

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

View File

@@ -1,21 +1,21 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { color } = require("../config/options.json"); const { color } = require("../config/options.json")
const verify = require("../schemas/verifySchema.js"); const verify = require("../schemas/verifySchema.js")
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json"); 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] const removeThese = [gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember]
module.exports = { module.exports = {
name: "forceunverify", name: "forceunverify",
description: "Force unverify a user", description: "Force unverify a user",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('forceunverify') .setName("forceunverify")
.setDescription('Force unverify a user') .setDescription("Force unverify a user")
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName("user")
.setDescription('The user to force unverify') .setDescription("The user to force unverify")
.setRequired(true)) .setRequired(true))
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator), .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
@@ -23,9 +23,9 @@ module.exports = {
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */ /** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) { async execute(interaction) {
const member1 = interaction.options.getUser('user'); const member1 = interaction.options.getUser("user")
const member = interaction.guild.members.cache.get(member1.id) const member = interaction.guild.members.cache.get(member1.id)
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
const verifiedUser = await verify.findOne({ userID: member1.id }) const verifiedUser = await verify.findOne({ userID: member1.id })
if (!verifiedUser) { if (!verifiedUser) {

View File

@@ -1,22 +1,22 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { getGuild, getHeadURL, getIGN } = require('../utils/utils.js') const { getGuild, getHeadURL, getIGN } = require("../utils/utils.js")
const { hypixelGuildID, color } = require('../config/options.json'); const { hypixelGuildID, color } = require("../config/options.json")
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json'); const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json")
const verify = require('../schemas/verifySchema.js') const verify = require("../schemas/verifySchema.js")
const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff] const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff]
module.exports = { module.exports = {
name: 'forceupdate', name: "forceupdate",
description: 'Force update the user', description: "Force update the user",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('forceupdate') .setName("forceupdate")
.setDescription('Force update the user') .setDescription("Force update the user")
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName("user")
.setDescription('The user to force update') .setDescription("The user to force update")
.setRequired(true)) .setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -25,15 +25,15 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply()
const user = interaction.options.getUser('user'); const user = interaction.options.getUser("user")
const usermentioned = userMention(user.id); const usermentioned = userMention(user.id)
const verifyData = await verify.findOne({ userID: user.id }) const verifyData = await verify.findOne({ userID: user.id })
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const user1 = interaction.guild.members.cache.get(user.id); const user1 = interaction.guild.members.cache.get(user.id)
const roleManage = user1.roles; const roleManage = user1.roles
if (!verifyData) { if (!verifyData) {
await interaction.editReply({ await interaction.editReply({
@@ -49,9 +49,9 @@ module.exports = {
return return
} }
const ign = await getIGN(verifyData.uuid); const ign = await getIGN(verifyData.uuid)
const head = await getHeadURL(ign) const head = await getHeadURL(ign)
const guild = await getGuild(verifyData.uuid); const guild = await getGuild(verifyData.uuid)
let responseGuildID = "" let responseGuildID = ""
if (!guild) { if (!guild) {
@@ -85,10 +85,10 @@ module.exports = {
if (responseGuildID === hypixelGuildID) { if (responseGuildID === hypixelGuildID) {
const GuildMembers = guild.members; const GuildMembers = guild.members
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank
if (guildRank === 'Guild Master') { if (guildRank === "Guild Master") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
@@ -115,7 +115,7 @@ module.exports = {
}) })
} }
if (guildRank === 'Manager') { if (guildRank === "Manager") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
@@ -142,7 +142,7 @@ module.exports = {
}) })
} }
if (guildRank === 'Moderator') { if (guildRank === "Moderator") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
@@ -170,7 +170,7 @@ module.exports = {
} }
if (guildRank === 'Beast') { if (guildRank === "Beast") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
@@ -197,7 +197,7 @@ module.exports = {
return return
} }
if (guildRank === 'Elite') { if (guildRank === "Elite") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
@@ -224,7 +224,7 @@ module.exports = {
return return
} }
if (guildRank === 'Member') { if (guildRank === "Member") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
@@ -251,7 +251,7 @@ module.exports = {
return return
} }
if (guildRank === 'Trial Member') { if (guildRank === "Trial Member") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")

View File

@@ -1,27 +1,27 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { getUUID, getPlayer, getGuild, getHeadURL } = require('../utils/utils.js'); const { getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js")
const { color, hypixelGuildID } = require('../config/options.json'); const { color, hypixelGuildID } = require("../config/options.json")
const verify = require('../schemas/verifySchema.js') const verify = require("../schemas/verifySchema.js")
const { mongoose } = require('mongoose'); const { mongoose } = require("mongoose")
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json'); const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json")
module.exports = { module.exports = {
name: 'forceverify', name: "forceverify",
description: 'Force verify a user.', description: "Force verify a user.",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('forceverify') .setName("forceverify")
.setDescription('Force verify a user.') .setDescription("Force verify a user.")
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName("user")
.setDescription('The user to force verify.')) .setDescription("The user to force verify."))
.addStringOption(option => .addStringOption(option =>
option option
.setName('ign') .setName("ign")
.setDescription('The user\'s in-game name.')) .setDescription("The user's in-game name."))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -29,27 +29,27 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply()
const user1 = interaction.options.getUser('user'); const user1 = interaction.options.getUser("user")
const user = interaction.guild.members.cache.get(user1.id); const user = interaction.guild.members.cache.get(user1.id)
const ign = interaction.options.getString('ign'); const ign = interaction.options.getString("ign")
const mod = interaction.user const mod = interaction.user
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const verifyData = await verify.findOne({ userID: user.id }) const verifyData = await verify.findOne({ userID: user.id })
if (verifyData) { if (verifyData) {
interaction.editReply('That user is already verified.') interaction.editReply("That user is already verified.")
return return
} }
if (!user) { if (!user) {
interaction.editReply('Please provide a user to force verify.\nThis can also mean the user is not in the server.') interaction.editReply("Please provide a user to force verify.\nThis can also mean the user is not in the server.")
return return
} }
if (!ign) { if (!ign) {
interaction.editReply('Please provide a player\'s IGN.') interaction.editReply("Please provide a player's IGN.")
return return
} }
@@ -67,7 +67,7 @@ module.exports = {
modName = mod.username + "#" + mod.discriminator modName = mod.username + "#" + mod.discriminator
} }
const uuid = await getUUID(ign); const uuid = await getUUID(ign)
if (!uuid) { if (!uuid) {
interaction.editReply({ interaction.editReply({
embeds: [{ embeds: [{
@@ -78,18 +78,18 @@ module.exports = {
return return
} }
const player = await getPlayer(uuid); const player = await getPlayer(uuid)
if (!player) { if (!player) {
interaction.editReply({ interaction.editReply({
embeds: [{ embeds: [{
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.", description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
const guild = await getGuild(uuid); const guild = await getGuild(uuid)
let responseGuildID = "" let responseGuildID = ""
if (!guild) { if (!guild) {
responseGuildID = null responseGuildID = null
@@ -97,51 +97,51 @@ module.exports = {
responseGuildID = guild._id responseGuildID = guild._id
} }
const head = await getHeadURL(ign); const head = await getHeadURL(ign)
if (responseGuildID === hypixelGuildID) { if (responseGuildID === hypixelGuildID) {
const GuildMembers = guild.members; const GuildMembers = guild.members
const guildRank = GuildMembers.find(member => member.uuid === player.uuid).rank; const guildRank = GuildMembers.find(member => member.uuid === player.uuid).rank
if (guildRank === "Guild Master") { if (guildRank === "Guild Master") {
await user.roles.add(gm, "User was force verified by " + modName); 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(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName) await user.roles.add(guildStaff, "User was force verified by " + modName)
} }
if (guildRank === "Manager") { if (guildRank === "Manager") {
await user.roles.add(manager, "User was force verified by " + modName); 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(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName) await user.roles.add(guildStaff, "User was force verified by " + modName)
} }
if (guildRank === "Moderator") { if (guildRank === "Moderator") {
await user.roles.add(moderator, "User was force verified by " + modName); 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(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName) await user.roles.add(guildStaff, "User was force verified by " + modName)
} }
if (guildRank === "Beast") { if (guildRank === "Beast") {
await user.roles.add(beast, "User was force verified by " + modName); await user.roles.add(beast, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName) await user.roles.add(guildRole, "User was force verified by " + modName)
} }
if (guildRank === "Elite") { if (guildRank === "Elite") {
await user.roles.add(elite, "User was force verified by " + modName); await user.roles.add(elite, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName) await user.roles.add(guildRole, "User was force verified by " + modName)
} }
if (guildRank === "Member") { if (guildRank === "Member") {
await user.roles.add(member, "User was force verified by " + modName); await user.roles.add(member, "User was force verified by " + modName)
await user.roles.add(guildRole, "User was force verified by " + modName) await user.roles.add(guildRole, "User was force verified by " + modName)
} }
if (guildRank === "Trial Member") { if (guildRank === "Trial Member") {
await user.roles.add(trialmember, "User was force verified by " + modName); 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(guildRole, "User was force verified by " + modName)
} }
} }
await user.roles.add(defaultMember, "User was force verified by " + modName); await user.roles.add(defaultMember, "User was force verified by " + modName)
const newVerify = new verify({ const newVerify = new verify({
_id: new mongoose.Types.ObjectId(), _id: new mongoose.Types.ObjectId(),
@@ -149,7 +149,7 @@ module.exports = {
uuid: uuid uuid: uuid
}) })
await newVerify.save(); await newVerify.save()
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
@@ -164,7 +164,7 @@ module.exports = {
text: interaction.guild.name + " | Developed by Taken#0002" text: interaction.guild.name + " | Developed by Taken#0002"
} }
}] }]
}); })
} }
}; }

View File

@@ -1,35 +1,35 @@
const { SlashCommandBuilder } = require('discord.js') const { SlashCommandBuilder } = require("discord.js")
const { color } = require('../config/options.json') const { color } = require("../config/options.json")
const { guildMember } = require('./guild/member.js') const { guildMember } = require("./guild/member.js")
const { guildInfo } = require('./guild/info.js') const { guildInfo } = require("./guild/info.js")
module.exports = { module.exports = {
name: 'guild', name: "guild",
description: 'Subcommands for guilds', description: "Subcommands for guilds",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('guild') .setName("guild")
.setDescription('Subcommands for guilds') .setDescription("Subcommands for guilds")
.addSubcommand(subcommand => .addSubcommand(subcommand =>
subcommand subcommand
.setName('member') .setName("member")
.setDescription('Get info about a guild memeber') .setDescription("Get info about a guild memeber")
.addStringOption(option => .addStringOption(option =>
option option
.setName('ign') .setName("ign")
.setDescription('The IGN of the player.') .setDescription("The IGN of the player.")
.setRequired(true) .setRequired(true)
) )
) )
.addSubcommand(subcommand => .addSubcommand(subcommand =>
subcommand subcommand
.setName('info') .setName("info")
.setDescription('Get info about a guild.') .setDescription("Get info about a guild.")
.addStringOption(option => .addStringOption(option =>
option option
.setName('ign') .setName("ign")
.setDescription('The IGN of a member.') .setDescription("The IGN of a member.")
.setRequired(true) .setRequired(true)
) )
) )
@@ -42,14 +42,14 @@ module.exports = {
await interaction.deferReply() await interaction.deferReply()
const subcommand = interaction.options.getSubcommand() const subcommand = interaction.options.getSubcommand()
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
if (subcommand === 'member') { if (subcommand === "member") {
await guildMember(interaction) await guildMember(interaction)
return return
} }
if (subcommand === 'info') { if (subcommand === "info") {
await guildInfo(interaction) await guildInfo(interaction)
return return
} }

View File

@@ -1,12 +1,12 @@
const { getUUID, getIGN, getPlayer, getGuild, guildLevel } = require("../../utils/utils.js") const { getUUID, getIGN, getPlayer, getGuild, guildLevel } = require("../../utils/utils.js")
const { color } = require("../../config/options.json"); const { color } = require("../../config/options.json")
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */ /** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async function guildInfo(interaction) { async function guildInfo(interaction) {
const ign = interaction.options.getString("ign"); const ign = interaction.options.getString("ign")
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const uuid = await getUUID(ign) const uuid = await getUUID(ign)
if (!uuid) { if (!uuid) {
@@ -41,12 +41,12 @@ async function guildInfo(interaction) {
return return
} }
const guildName = guild.name; const guildName = guild.name
const guildCreatedMS = guild.created; const guildCreatedMS = guild.created
const guildCreated = new Date(guildCreatedMS); const guildCreated = new Date(guildCreatedMS)
const guildTag = guild.tag; const guildTag = guild.tag
const guildExp = guild.exp; const guildExp = guild.exp
const guildLvl = guildLevel(guildExp); const guildLvl = guildLevel(guildExp)
const guildMembers = guild.members const guildMembers = guild.members
const guildCreatedDate = guildCreated.getDate() const guildCreatedDate = guildCreated.getDate()

View File

@@ -1,13 +1,13 @@
const { getUUID, getPlayer, getGuild, getHeadURL } = require("../../utils/utils.js"); const { getUUID, getPlayer, getGuild, getHeadURL } = require("../../utils/utils.js")
const { color } = require("../../config/options.json"); const { color } = require("../../config/options.json")
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */ /** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async function guildMember(interaction) { async function guildMember(interaction) {
const ign = interaction.options.getString("ign"); const ign = interaction.options.getString("ign")
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const uuid = await getUUID(ign); const uuid = await getUUID(ign)
if (!uuid) { if (!uuid) {
interaction.editReply({ interaction.editReply({
embeds: [ embeds: [
@@ -20,11 +20,11 @@ async function guildMember(interaction) {
}, },
}, },
], ],
}); })
} }
const head = await getHeadURL(ign); const head = await getHeadURL(ign)
const player = await getPlayer(uuid); const player = await getPlayer(uuid)
if (!player) { if (!player) {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
@@ -40,27 +40,27 @@ async function guildMember(interaction) {
}, },
}, },
], ],
}); })
} }
const serverRank = player.newPackageRank; const serverRank = player.newPackageRank
const monthlyRank = player.monthlyPackageRank; const monthlyRank = player.monthlyPackageRank
const displayName = player.displayname; const displayName = player.displayname
let rank = ""; let rank = ""
if (serverRank === "VIP") { if (serverRank === "VIP") {
rank = "[VIP] "; rank = "[VIP] "
} else if (serverRank === "VIP_PLUS") { } else if (serverRank === "VIP_PLUS") {
rank = "[VIP+] "; rank = "[VIP+] "
} else if (serverRank === "MVP") { } else if (serverRank === "MVP") {
rank = "[MVP] "; rank = "[MVP] "
} else if (serverRank === "MVP_PLUS" && monthlyRank === "NONE") { } else if (serverRank === "MVP_PLUS" && monthlyRank === "NONE") {
rank = "[MVP+] "; rank = "[MVP+] "
} else if (serverRank === "MVP_PLUS" && monthlyRank === "SUPERSTAR") { } else if (serverRank === "MVP_PLUS" && monthlyRank === "SUPERSTAR") {
rank = "[MVP++] "; rank = "[MVP++] "
} }
const guild = await getGuild(uuid); const guild = await getGuild(uuid)
if (!guild) { if (!guild) {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
@@ -76,31 +76,31 @@ async function guildMember(interaction) {
}, },
}, },
], ],
}); })
} }
const guildName = guild.name; const guildName = guild.name
const guildTag = " [" + guild.tag + "]" ?? ""; const guildTag = " [" + guild.tag + "]" ?? ""
const guildMembers = guild.members; const guildMembers = guild.members
const guildMember = guildMembers.find((member) => member.uuid === uuid); const guildMember = guildMembers.find((member) => member.uuid === uuid)
const guildRank = guildMember.rank; const guildRank = guildMember.rank
const memberGexp = guildMember.expHistory; const memberGexp = guildMember.expHistory
const allDaysGexp = Object.keys(memberGexp).map((key) => { const allDaysGexp = Object.keys(memberGexp).map((key) => {
return "**➺ " + key + ":** " + "`" + memberGexp[key] + "`" + "\n"; return "**➺ " + key + ":** " + "`" + memberGexp[key] + "`" + "\n"
}); })
const expValue = allDaysGexp.join(""); const expValue = allDaysGexp.join("")
const totalWeeklyGexp = Object.values(memberGexp).reduce((a, b) => a + b, 0); const totalWeeklyGexp = Object.values(memberGexp).reduce((a, b) => a + b, 0)
const averageWeeklyGexp = Math.round(totalWeeklyGexp / 7); const averageWeeklyGexp = Math.round(totalWeeklyGexp / 7)
const guildMemberJoinMS = guildMember.joined; const guildMemberJoinMS = guildMember.joined
const guildMemberJoinTime = new Date(guildMemberJoinMS); const guildMemberJoinTime = new Date(guildMemberJoinMS)
const guildMemberJoinDate = guildMemberJoinTime.getDate(); const guildMemberJoinDate = guildMemberJoinTime.getDate()
const guildMemberJoinMonth = guildMemberJoinTime.getMonth() + 1; const guildMemberJoinMonth = guildMemberJoinTime.getMonth() + 1
const guildMemberJoinYear = guildMemberJoinTime.getFullYear(); const guildMemberJoinYear = guildMemberJoinTime.getFullYear()
const guildMemberJoinHours = guildMemberJoinTime.getHours(); const guildMemberJoinHours = guildMemberJoinTime.getHours()
const guildMemberJoinMinutes = guildMemberJoinTime.getMinutes(); const guildMemberJoinMinutes = guildMemberJoinTime.getMinutes()
const guildMemberJoinSeconds = guildMemberJoinTime.getSeconds(); const guildMemberJoinSeconds = guildMemberJoinTime.getSeconds()
const guildMemberJoin = const guildMemberJoin =
guildMemberJoinDate + "." + guildMemberJoinDate + "." +
@@ -108,7 +108,7 @@ async function guildMember(interaction) {
guildMemberJoinYear + " " + guildMemberJoinYear + " " +
guildMemberJoinHours + ":" + guildMemberJoinHours + ":" +
guildMemberJoinMinutes + ":" + guildMemberJoinMinutes + ":" +
guildMemberJoinSeconds; guildMemberJoinSeconds
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
@@ -141,8 +141,8 @@ async function guildMember(interaction) {
}, },
}, },
], ],
}); })
return; return
} }
module.exports = { guildMember } module.exports = { guildMember }

View File

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

View File

@@ -1,24 +1,24 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js') const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { admin, helper } = require('../config/roles.json') const { admin, helper } = require("../config/roles.json")
const { color } = require('../config/options.json') const { color } = require("../config/options.json")
module.exports = { module.exports = {
name: 'kick', name: "kick",
description: 'Kick a member from the server.', description: "Kick a member from the server.",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('kick') .setName("kick")
.setDescription('Kick a member from the server.') .setDescription("Kick a member from the server.")
.addUserOption(option => .addUserOption(option =>
option option
.setName('member') .setName("member")
.setDescription('Member to kick.') .setDescription("Member to kick.")
.setRequired(true)) .setRequired(true))
.addStringOption(option => .addStringOption(option =>
option option
.setName('reason') .setName("reason")
.setDescription('Reason for kicking the member.')) .setDescription("Reason for kicking the member."))
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
.setDMPermission(false), .setDMPermission(false),
@@ -28,12 +28,12 @@ module.exports = {
await interaction.deferReply() await interaction.deferReply()
const member = interaction.options.getMember('member') const member = interaction.options.getMember("member")
const reason = interaction.options.getString('reason') ?? "No reason provided." const reason = interaction.options.getString("reason") ?? "No reason provided."
const mod = await interaction.guild.members.fetch(interaction.user.id) const mod = await interaction.guild.members.fetch(interaction.user.id)
const memberRoles = member.roles.cache.map(role => role.id) const memberRoles = member.roles.cache.map(role => role.id)
const modRoles = mod.roles.cache.map(role => role.id) const modRoles = mod.roles.cache.map(role => role.id)
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
if (!modRoles.includes(helper) && !modRoles.includes(admin)) { if (!modRoles.includes(helper) && !modRoles.includes(admin)) {
await interaction.editReply("You do not have permission to use this command.") await interaction.editReply("You do not have permission to use this command.")

View File

@@ -1,25 +1,25 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { color } = require('../config/options.json'); const { color } = require("../config/options.json")
const { waitinglistSchema } = require("../schemas/waitinglistSchema.js") const { waitinglistSchema } = require("../schemas/waitinglistSchema.js")
module.exports = { module.exports = {
name: 'remove', name: "remove",
description: 'Remove a person on the waiting list.', description: "Remove a person on the waiting list.",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('remove') .setName("remove")
.setDescription('Remove a person on the waiting list.') .setDescription("Remove a person on the waiting list.")
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName("user")
.setDescription('The user to remove.') .setDescription("The user to remove.")
.setRequired(true) .setRequired(true)
) )
.addStringOption(option => .addStringOption(option =>
option option
.setName('reason') .setName("reason")
.setDescription('The reason for removing the user.') .setDescription("The reason for removing the user.")
.setRequired(false) .setRequired(false)
) )
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
@@ -31,10 +31,10 @@ module.exports = {
interaction.deferReply() interaction.deferReply()
const user = interaction.options.getUser('user'); const user = interaction.options.getUser("user")
const reason = interaction.options.getString('reason') ?? "No reason provided." const reason = interaction.options.getString("reason") ?? "No reason provided."
const mod = interaction.user const mod = interaction.user
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
const waitinglist = await waitinglistSchema.findOne({ UserID: user.id }) const waitinglist = await waitinglistSchema.findOne({ UserID: user.id })

View File

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

View File

@@ -1,22 +1,22 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { color } = require('../config/options.json'); const { color } = require("../config/options.json")
module.exports = { module.exports = {
name: 'send', name: "send",
description: 'Send a message to a channel.', description: "Send a message to a channel.",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('send') .setName("send")
.setDescription('Send a message to a channel.') .setDescription("Send a message to a channel.")
.addStringOption(option => .addStringOption(option =>
option option
.setName('message') .setName("message")
.setDescription('The message to send.')) .setDescription("The message to send."))
.addChannelOption(option => .addChannelOption(option =>
option option
.setName('channel') .setName("channel")
.setDescription('The channel to send the message to.')) .setDescription("The channel to send the message to."))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -24,19 +24,19 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true })
const message = interaction.options.getString('message'); const message = interaction.options.getString("message")
const channel = interaction.options.getChannel('channel'); const channel = interaction.options.getChannel("channel")
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
if (!message) { if (!message) {
interaction.editReply({ content: 'Please provide a message to send.', ephemeral: true }) interaction.editReply({ content: "Please provide a message to send.", ephemeral: true })
return return
} }
if (!channel) { if (!channel) {
interaction.editReply({ content: 'Please provide a channel to send the message to.', ephemeral: true }) interaction.editReply({ content: "Please provide a channel to send the message to.", ephemeral: true })
return return
} }
@@ -54,6 +54,6 @@ module.exports = {
} }
} }
] ]
}); })
} }
}; }

View File

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

View File

@@ -1,5 +1,5 @@
const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, } = require("discord.js"); const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, } = require("discord.js")
const { color } = require("../config/options.json"); const { color } = require("../config/options.json")
module.exports = { module.exports = {
name: "setup", name: "setup",
@@ -62,14 +62,14 @@ module.exports = {
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */ /** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) { async execute(interaction) {
const user = interaction.user; const user = interaction.user
const guild = interaction.guild; const guild = interaction.guild
const subcommand = interaction.options.getSubcommand(); const subcommand = interaction.options.getSubcommand()
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
if (subcommand === "sendguildapplication") { if (subcommand === "sendguildapplication") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel")
await channel.send({ await channel.send({
embeds: [ embeds: [
@@ -94,12 +94,12 @@ module.exports = {
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" })) .setEmoji({ name: "✅" }))
] ]
}); })
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true })
} }
if (subcommand === "sendstaffapplication") { if (subcommand === "sendstaffapplication") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel")
await channel.send({ await channel.send({
embeds: [ embeds: [
@@ -124,13 +124,13 @@ module.exports = {
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" })) .setEmoji({ name: "✅" }))
] ]
}); })
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true })
} }
if (subcommand === "sendinactivityapplication") { if (subcommand === "sendinactivityapplication") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel")
await channel.send({ await channel.send({
embeds: [ embeds: [
@@ -155,13 +155,13 @@ module.exports = {
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" })) .setEmoji({ name: "✅" }))
] ]
}); })
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true })
} }
if (subcommand === "sendverfiymessage") { if (subcommand === "sendverfiymessage") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel")
await channel.send({ await channel.send({
embeds: [{ embeds: [{
@@ -184,13 +184,13 @@ module.exports = {
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" })) .setEmoji({ name: "✅" }))
] ]
}); })
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true })
} }
if (subcommand === "sendwaitinglistmessage") { if (subcommand === "sendwaitinglistmessage") {
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel")
await channel.send({ await channel.send({
embeds: [{ embeds: [{
@@ -214,9 +214,9 @@ module.exports = {
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: "🔄" })) .setEmoji({ name: "🔄" }))
] ]
}); })
await interaction.reply({ content: "Message sent", ephemeral: true }); await interaction.reply({ content: "Message sent", ephemeral: true })
} }
} }
}; }

View File

@@ -1,22 +1,22 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
const { color } = require('../config/options.json'); const { color } = require("../config/options.json")
module.exports = { module.exports = {
name: 'slowmode', name: "slowmode",
description: 'Set the slowmode of a channel.', description: "Set the slowmode of a channel.",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('slowmode') .setName("slowmode")
.setDescription('Set the slowmode of a channel.') .setDescription("Set the slowmode of a channel.")
.addIntegerOption(option => .addIntegerOption(option =>
option option
.setName('seconds') .setName("seconds")
.setDescription('The amount of seconds to set the slowmode to.')) .setDescription("The amount of seconds to set the slowmode to."))
.addChannelOption(option => .addChannelOption(option =>
option option
.setName('channel') .setName("channel")
.setDescription('The channel to set the slowmode of.')) .setDescription("The channel to set the slowmode of."))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -24,11 +24,11 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephermeral: true }); await interaction.deferReply({ ephermeral: true })
const seconds = interaction.options.getInteger('seconds') ?? 5 const seconds = interaction.options.getInteger("seconds") ?? 5
const channel = interaction.options.getChannel('channel') ?? interaction.channel const channel = interaction.options.getChannel("channel") ?? interaction.channel
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
if (seconds > 21600) { if (seconds > 21600) {
await channel.setRateLimitPerUser(21600) await channel.setRateLimitPerUser(21600)

View File

@@ -1,31 +1,31 @@
const { SlashCommandBuilder } = require('discord.js'); const { SlashCommandBuilder } = require("discord.js")
const { getGuild, getIGN, getHeadURL } = require('../utils/utils.js'); const { getGuild, getIGN, getHeadURL } = require("../utils/utils.js")
const verify = require('../schemas/verifySchema.js') const verify = require("../schemas/verifySchema.js")
const { color, hypixelGuildID } = require('../config/options.json'); const { color, hypixelGuildID } = require("../config/options.json")
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.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]; const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff]
module.exports = { module.exports = {
name: 'update', name: "update",
description: 'Update your guild rank.', description: "Update your guild rank.",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('update') .setName("update")
.setDescription('Update your guild rank.') .setDescription("Update your guild rank.")
.setDMPermission(false), .setDMPermission(false),
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */ /** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply()
const user1 = interaction.user; const user1 = interaction.user
const user = interaction.guild.members.cache.get(user1.id); const user = interaction.guild.members.cache.get(user1.id)
const verifyData = await verify.findOne({ userID: user.id }) const verifyData = await verify.findOne({ userID: user.id })
const roleManage = user.roles; const roleManage = user.roles
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
if (!verifyData) { if (!verifyData) {
await interaction.editReply({ await interaction.editReply({
@@ -41,7 +41,7 @@ module.exports = {
return return
} }
const guild = await getGuild(verifyData.uuid); const guild = await getGuild(verifyData.uuid)
let guildID = "" let guildID = ""
if (!guild) { if (!guild) {
guildID = null guildID = null
@@ -49,8 +49,8 @@ module.exports = {
guildID = guild._id guildID = guild._id
} }
const ign = await getIGN(verifyData.uuid); const ign = await getIGN(verifyData.uuid)
const head = await getHeadURL(ign); const head = await getHeadURL(ign)
if (guildID !== hypixelGuildID) { if (guildID !== hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
@@ -77,10 +77,10 @@ module.exports = {
if (guildID === hypixelGuildID) { if (guildID === hypixelGuildID) {
const GuildMembers = guild.members; const GuildMembers = guild.members
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank
if (guildRank === 'Guild Master') { if (guildRank === "Guild Master") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
@@ -107,7 +107,7 @@ module.exports = {
}) })
} }
if (guildRank === 'Manager') { if (guildRank === "Manager") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
@@ -134,7 +134,7 @@ module.exports = {
}) })
} }
if (guildRank === 'Moderator') { if (guildRank === "Moderator") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
@@ -162,7 +162,7 @@ module.exports = {
} }
if (guildRank === 'Beast') { if (guildRank === "Beast") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
@@ -189,7 +189,7 @@ module.exports = {
return return
} }
if (guildRank === 'Elite') { if (guildRank === "Elite") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
@@ -216,7 +216,7 @@ module.exports = {
return return
} }
if (guildRank === 'Member') { if (guildRank === "Member") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
@@ -243,7 +243,7 @@ module.exports = {
return return
} }
if (guildRank === 'Trial Member') { if (guildRank === "Trial Member") {
for (let i = 0; i < removeThese.length; i++) { for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)") await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
@@ -271,4 +271,4 @@ module.exports = {
} }
} }
} }
}; }

View File

@@ -1,18 +1,18 @@
const { SlashCommandBuilder } = require('discord.js') const { SlashCommandBuilder } = require("discord.js")
const { color } = require('../config/options.json') const { color } = require("../config/options.json")
const { getUUID, getIGN, getHeadURL, formatUuid } = require('../utils/utils.js') const { getUUID, getIGN, getHeadURL, formatUuid } = require("../utils/utils.js")
module.exports = { module.exports = {
name: 'uuid', name: "uuid",
description: 'Get a player\'s UUID', description: "Get a player's UUID",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('uuid') .setName("uuid")
.setDescription('Get a player\'s UUID') .setDescription("Get a player's UUID")
.addStringOption(option => option .addStringOption(option => option
.setName('ign') .setName("ign")
.setDescription('Player\'s name') .setDescription("Player's name")
.setRequired(true) .setRequired(true)
), ),
@@ -22,16 +22,16 @@ module.exports = {
await interaction.deferReply() await interaction.deferReply()
const ign = interaction.options.getString('ign') const ign = interaction.options.getString("ign")
const uuid = await getUUID(ign) const uuid = await getUUID(ign)
const formattedUuid = formatUuid(uuid) const formattedUuid = formatUuid(uuid)
const newIgn = await getIGN(uuid) const newIgn = await getIGN(uuid)
const head = await getHeadURL(ign) const head = await getHeadURL(ign)
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
if (!uuid) { if (!uuid) {
interaction.editReply({ interaction.editReply({
description: 'That player doesn\'t exist!', description: "That player doesn't exist!",
color: embedColor color: embedColor
}) })
return return

View File

@@ -1,9 +1,9 @@
const { SlashCommandBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js")
const { getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js"); const { getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js")
const { color, hypixelGuildID } = require("../config/options.json"); const { color, hypixelGuildID } = require("../config/options.json")
const verify = require("../schemas/verifySchema.js"); const verify = require("../schemas/verifySchema.js")
const mongoose = require("mongoose"); const mongoose = require("mongoose")
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json"); const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json")
module.exports = { module.exports = {
name: "verify", name: "verify",
@@ -22,17 +22,17 @@ module.exports = {
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */ /** @param { import('discord.js').ChatInputCommandInteraction } interaction */
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply()
const user1 = interaction.user const user1 = interaction.user
const user = interaction.guild.members.cache.get(user1.id); const user = interaction.guild.members.cache.get(user1.id)
const ign = interaction.options.getString("ign"); const ign = interaction.options.getString("ign")
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const verifyData = await verify.findOne({ userID: user.id }); const verifyData = await verify.findOne({ userID: user.id })
if (verifyData) { if (verifyData) {
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.") interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
return; return
} }
if (!ign) { if (!ign) {
@@ -42,30 +42,30 @@ module.exports = {
color: embedColor color: embedColor
}] }]
}) })
return; return
} }
const uuid = await getUUID(ign); const uuid = await getUUID(ign)
if (!uuid) { if (!uuid) {
interaction.editReply({ interaction.editReply({
embeds: [{ embeds: [{
description: "<a:questionmark_pink:1130206038008803488> That player does not exist.", description: "<a:questionmark_pink:1130206038008803488> That player does not exist.",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
const head = await getHeadURL(ign); const head = await getHeadURL(ign)
const player = await getPlayer(uuid); const player = await getPlayer(uuid)
if (!player) { if (!player) {
interaction.editReply({ interaction.editReply({
embeds: [{ embeds: [{
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.", description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
let username = "" let username = ""
@@ -84,8 +84,8 @@ module.exports = {
color: embedColor color: embedColor
} }
] ]
}); })
return; return
} }
if (!player.socialMedia.links.DISCORD) { if (!player.socialMedia.links.DISCORD) {
@@ -97,8 +97,8 @@ module.exports = {
color: embedColor color: embedColor
} }
] ]
}); })
return; return
} }
const linkedDiscord = player.socialMedia.links.DISCORD const linkedDiscord = player.socialMedia.links.DISCORD
@@ -112,11 +112,11 @@ module.exports = {
color: embedColor color: embedColor
} }
] ]
}); })
return; return
} }
const guild = await getGuild(uuid); const guild = await getGuild(uuid)
let guildID = "" let guildID = ""
if (!guild) { if (!guild) {
guildID = null guildID = null
@@ -126,56 +126,56 @@ module.exports = {
if (guildID === hypixelGuildID) { if (guildID === hypixelGuildID) {
const GuildMembers = guild.members const GuildMembers = guild.members
const guildRank = GuildMembers.find((member) => member.uuid === player.uuid).rank; const guildRank = GuildMembers.find((member) => member.uuid === player.uuid).rank
if (guildRank === "Guild Master" && guildID === hypixelGuildID) { if (guildRank === "Guild Master" && guildID === hypixelGuildID) {
await user.roles.add(gm, "Verification"); await user.roles.add(gm, "Verification")
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification")
await user.roles.add(guildStaff, "Verification"); await user.roles.add(guildStaff, "Verification")
} }
if (guildRank === "Manager" && guildID === hypixelGuildID) { if (guildRank === "Manager" && guildID === hypixelGuildID) {
await user.roles.add(manager, "Verification"); await user.roles.add(manager, "Verification")
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification")
await user.roles.add(guildStaff, "Verification"); await user.roles.add(guildStaff, "Verification")
} }
if (guildRank === "Moderator" && guildID === hypixelGuildID) { if (guildRank === "Moderator" && guildID === hypixelGuildID) {
await user.roles.add(moderator, "Verification"); await user.roles.add(moderator, "Verification")
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification")
await user.roles.add(guildStaff, "Verification"); await user.roles.add(guildStaff, "Verification")
} }
if (guildRank === "Beast" && guildID === hypixelGuildID) { if (guildRank === "Beast" && guildID === hypixelGuildID) {
await user.roles.add(beast, "Verification"); await user.roles.add(beast, "Verification")
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification")
} }
if (guildRank === "Elite" && guildID === hypixelGuildID) { if (guildRank === "Elite" && guildID === hypixelGuildID) {
await user.roles.add(elite, "Verification"); await user.roles.add(elite, "Verification")
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification")
} }
if (guildRank === "Member" && guildID === hypixelGuildID) { if (guildRank === "Member" && guildID === hypixelGuildID) {
await user.roles.add(member, "Verification"); await user.roles.add(member, "Verification")
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification")
} }
if (guildRank === "Trial Member" && guildID === hypixelGuildID) { if (guildRank === "Trial Member" && guildID === hypixelGuildID) {
await user.roles.add(trialmember, "Verification"); await user.roles.add(trialmember, "Verification")
await user.roles.add(guildRole, "Verification"); await user.roles.add(guildRole, "Verification")
} }
} }
await user.roles.add(defaultMember, "Verification"); await user.roles.add(defaultMember, "Verification")
const newVerify = new verify({ const newVerify = new verify({
_id: new mongoose.Types.ObjectId(), _id: new mongoose.Types.ObjectId(),
userID: user.id, userID: user.id,
uuid: uuid uuid: uuid
}); })
await newVerify.save(); await newVerify.save()
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
@@ -192,6 +192,6 @@ module.exports = {
} }
} }
] ]
}); })
} }
}; }

View File

@@ -1,20 +1,20 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js")
const { getIGN, getHeadURL } = require('../utils/utils.js') const { getIGN, getHeadURL } = require("../utils/utils.js")
const { color } = require('../config/options.json'); const { color } = require("../config/options.json")
const verify = require('../schemas/verifySchema.js'); const verify = require("../schemas/verifySchema.js")
module.exports = { module.exports = {
name: 'whois', name: "whois",
description: 'Get\'s the ign of a user.', description: "Get's the ign of a user.",
type: 'slash', type: "slash",
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('whois') .setName("whois")
.setDescription('Get\'s the ign of a user.') .setDescription("Get's the ign of a user.")
.addUserOption(option => .addUserOption(option =>
option option
.setName('user') .setName("user")
.setDescription('The user to get the ign of.') .setDescription("The user to get the ign of.")
.setRequired(true)) .setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -23,18 +23,18 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply()
const user = interaction.options.getUser('user'); const user = interaction.options.getUser("user")
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const verifiedUser = await verify.findOne({ userID: user.id }); const verifiedUser = await verify.findOne({ userID: user.id })
if (!verifiedUser) { if (!verifiedUser) {
interaction.editReply({ content: 'This user has not verified their account.' }); interaction.editReply({ content: "This user has not verified their account." })
return return
} }
const ign = await getIGN(verifiedUser.uuid); const ign = await getIGN(verifiedUser.uuid)
const head = await getHeadURL(ign) const head = await getHeadURL(ign)
await interaction.editReply({ await interaction.editReply({
@@ -53,4 +53,4 @@ module.exports = {
}) })
} }
}; }

View File

@@ -1,25 +1,25 @@
const { color } = require('../../config/options.json'); const { color } = require("../../config/options.json")
const guildapp = require('../../schemas/guildAppSchema.js'); const guildapp = require("../../schemas/guildAppSchema.js")
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require('../../config/reqs.json'); const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../config/reqs.json")
const { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } = require("../../utils/utils.js"); const { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } = require("../../utils/utils.js")
module.exports = { module.exports = {
name: 'checkstats', name: "checkstats",
description: 'Check your stats.', description: "Check your stats.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply()
const message = interaction.message; const message = interaction.message
const embed = message.embeds[0]; const embed = message.embeds[0]
const applicantId = embed.footer.text.split(" ")[1] const applicantId = embed.footer.text.split(" ")[1]
const guildappdata = await guildapp.findOne({ userID: applicantId }) const guildappdata = await guildapp.findOne({ userID: applicantId })
const uuid = guildappdata.uuid; const uuid = guildappdata.uuid
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const player = await getPlayer(uuid) const player = await getPlayer(uuid)
if (!player) { if (!player) {
@@ -28,34 +28,34 @@ module.exports = {
description: "That player hasn't played Hypixel before.", description: "That player hasn't played Hypixel before.",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
const ign = player.playername const ign = player.playername
const head = await getHeadURL(ign) const head = await getHeadURL(ign)
const rank2 = player.newPackageRank; const rank2 = player.newPackageRank
const monthlyRank = player.monthlyPackageRank; const monthlyRank = player.monthlyPackageRank
let rank = "" let rank = ""
if (rank2 === 'VIP') { if (rank2 === "VIP") {
rank = "[VIP] " rank = "[VIP] "
} else if (rank2 === 'VIP_PLUS') { } else if (rank2 === "VIP_PLUS") {
rank = "[VIP+] " rank = "[VIP+] "
} else if (rank2 === 'MVP') { } else if (rank2 === "MVP") {
rank = "[MVP] " rank = "[MVP] "
} else if (rank2 === 'MVP_PLUS' && monthlyRank === 'NONE') { } else if (rank2 === "MVP_PLUS" && monthlyRank === "NONE") {
rank = "[MVP+] " rank = "[MVP+] "
} else if (rank2 === 'MVP_PLUS' && monthlyRank === 'SUPERSTAR') { } else if (rank2 === "MVP_PLUS" && monthlyRank === "SUPERSTAR") {
rank = "[MVP++] " rank = "[MVP++] "
} }
const guild = await getGuild(uuid) const guild = await getGuild(uuid)
let guildName = "" let guildName = ""
if (!guild) { if (!guild) {
guildName = "None"; guildName = "None"
} else { } else {
guildName = guild.name; guildName = guild.name
} }
let guildTag = "" let guildTag = ""
@@ -68,35 +68,35 @@ module.exports = {
} }
//bedwars level //bedwars level
const hsbwexp = player.stats.Bedwars.Experience; const hsbwexp = player.stats.Bedwars.Experience
const hsbwstars = bedwarsLevel(hsbwexp); const hsbwstars = bedwarsLevel(hsbwexp)
// bedwars fkdr // bedwars fkdr
const hsbwfk = player.stats.Bedwars.final_kills_bedwars; const hsbwfk = player.stats.Bedwars.final_kills_bedwars
const hsbwfd = player.stats.Bedwars.final_deaths_bedwars; const hsbwfd = player.stats.Bedwars.final_deaths_bedwars
const hsbwfkdr = hsbwfk / hsbwfd; const hsbwfkdr = hsbwfk / hsbwfd
// bedwars wins // bedwars wins
const hsbwwins = player.stats.Bedwars.wins_bedwars; const hsbwwins = player.stats.Bedwars.wins_bedwars
// skywars level // skywars level
const hsswexp = player.stats.SkyWars.skywars_experience; const hsswexp = player.stats.SkyWars.skywars_experience
const hsswstars = skywarsLevel(hsswexp); const hsswstars = skywarsLevel(hsswexp)
// skywars kdr // skywars kdr
const hsswkills = player.stats.SkyWars.kills; const hsswkills = player.stats.SkyWars.kills
const hsswdeaths = player.stats.SkyWars.deaths; const hsswdeaths = player.stats.SkyWars.deaths
const hsswkd = hsswkills / hsswdeaths; const hsswkd = hsswkills / hsswdeaths
//skywars wins //skywars wins
const hsswwins = player.stats.SkyWars.wins; const hsswwins = player.stats.SkyWars.wins
// dueks kdr // dueks kdr
const hsduelskills = player.stats.Duels.kills const hsduelskills = player.stats.Duels.kills
const hsduelsdeaths = player.stats.Duels.deaths const hsduelsdeaths = player.stats.Duels.deaths
const hsduelskd = hsduelskills / hsduelsdeaths const hsduelskd = hsduelskills / hsduelsdeaths
// duels wins // duels wins
const hsduelswins = player.stats.Duels.wins; const hsduelswins = player.stats.Duels.wins
// duels wlr // duels wlr
const hsduelslosses = player.stats.Duels.losses; const hsduelslosses = player.stats.Duels.losses
const hsduelswlr = hsduelswins / hsduelslosses; const hsduelswlr = hsduelswins / hsduelslosses
// network level // network level
const hypixelExp = player.networkExp; const hypixelExp = player.networkExp
const level = hypixelLevel(hypixelExp); const level = hypixelLevel(hypixelExp)
let bwtitle = "" let bwtitle = ""
let swtitle = "" let swtitle = ""
@@ -168,6 +168,6 @@ module.exports = {
} }
] ]
}] }]
}); })
} }
}; }

View File

@@ -1,34 +1,34 @@
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require('discord.js'); const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require("discord.js")
const { color } = require('../../config/options.json'); const { color } = require("../../config/options.json")
const mongoose = require("mongoose"); const mongoose = require("mongoose")
const guildapp = require('../../schemas/guildAppSchema.js'); const guildapp = require("../../schemas/guildAppSchema.js")
const waitingList = require('../../schemas/waitinglistSchema.js'); const waitingList = require("../../schemas/waitinglistSchema.js")
const { waitingListRole } = require('../../config/roles.json'); const { waitingListRole } = require("../../config/roles.json")
module.exports = { module.exports = {
name: 'guildapplicationaccept', name: "guildapplicationaccept",
description: 'Accept a guild application.', description: "Accept a guild application.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply()
const user = interaction.user; const user = interaction.user
const guild = interaction.guild; const guild = interaction.guild
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const message = interaction.message; const message = interaction.message
const embed = message.embeds[0]; const embed = message.embeds[0]
const applicantId = embed.footer.text.split(" ")[1] const applicantId = embed.footer.text.split(" ")[1]
const applicantIGN1 = embed.fields[0].value; const applicantIGN1 = embed.fields[0].value
const applicantIGN = applicantIGN1.replaceAll("`", ""); const applicantIGN = applicantIGN1.replaceAll("`", "")
const applicant = await guild.members.fetch(applicantId) const applicant = await guild.members.fetch(applicantId)
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator; const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
await message.edit({ await message.edit({
components: [ components: [
@@ -50,18 +50,18 @@ module.exports = {
.setDisabled(true) .setDisabled(true)
) )
] ]
}); })
await applicant.send({ await applicant.send({
embeds: [{ embeds: [{
description: `Your application for the Illegitimate guild has been accepted.`, description: "Your application for the Illegitimate guild has been accepted.",
color: embedColor color: embedColor
}] }]
}); })
const applicantEntry = await guildapp.findOne({ userID: applicantId }) const applicantEntry = await guildapp.findOne({ userID: applicantId })
const applicantUUID = applicantEntry.uuid; const applicantUUID = applicantEntry.uuid
const time = Date.now(); const time = Date.now()
const waitingListAdd = new waitingList({ const waitingListAdd = new waitingList({
_id: new mongoose.Types.ObjectId(), _id: new mongoose.Types.ObjectId(),
@@ -69,12 +69,12 @@ module.exports = {
uuid: applicantUUID, uuid: applicantUUID,
IGN: applicantIGN, IGN: applicantIGN,
timestamp: time timestamp: time
}); })
await waitingListAdd.save(); await waitingListAdd.save()
await applicant.roles.add(waitingListRole); await applicant.roles.add(waitingListRole)
await guildapp.findOneAndDelete({ userID: applicantId }); await guildapp.findOneAndDelete({ userID: applicantId })
await interaction.editReply({ await interaction.editReply({
@@ -90,6 +90,6 @@ module.exports = {
text: "ID: " + applicant.id text: "ID: " + applicant.id
} }
}] }]
}); })
} }
}; }

View File

@@ -1,27 +1,27 @@
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
module.exports = { module.exports = {
name: 'guildapplicationdeny', name: "guildapplicationdeny",
description: 'Deny a guild application.', description: "Deny a guild application.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
const modal = new ModalBuilder() const modal = new ModalBuilder()
.setTitle('Deny Reason') .setTitle("Deny Reason")
.setCustomId('denyreasonbox') .setCustomId("denyreasonbox")
.setComponents( .setComponents(
new ActionRowBuilder().setComponents( new ActionRowBuilder().setComponents(
new TextInputBuilder() new TextInputBuilder()
.setLabel('Deny Reason') .setLabel("Deny Reason")
.setCustomId('denyreason') .setCustomId("denyreason")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setPlaceholder('Enter a reason for denying the application') .setPlaceholder("Enter a reason for denying the application")
.setRequired(false) .setRequired(false)
) )
) )
await interaction.showModal(modal); await interaction.showModal(modal)
} }
}; }

View File

@@ -1,26 +1,26 @@
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js'); const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require("discord.js")
const { color } = require('../../config/options.json'); const { color } = require("../../config/options.json")
const { largeM, smallM, ignM } = require('../../config/limitmessages.json') const { largeM, smallM, ignM } = require("../../config/limitmessages.json")
const { applicationsChannel } = require('../../config/options.json'); const { applicationsChannel } = require("../../config/options.json")
const questions = require('../../config/questions.json'); const questions = require("../../config/questions.json")
const { guildRole } = require('../../config/roles.json') const { guildRole } = require("../../config/roles.json")
const { getUUID } = require('../../utils/utils.js') const { getUUID } = require("../../utils/utils.js")
const mongoose = require('mongoose'); const mongoose = require("mongoose")
const guildapp = require('../../schemas/guildAppSchema.js'); const guildapp = require("../../schemas/guildAppSchema.js")
module.exports = { module.exports = {
name: 'guildapply', name: "guildapply",
description: 'Guild application button.', description: "Guild application button.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
const user = interaction.user; const user = interaction.user
const guild = interaction.guild; const guild = interaction.guild
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const userRoles = guild.members.cache.get(user.id).roles.cache.map(role => role.id); const userRoles = guild.members.cache.get(user.id).roles.cache.map(role => role.id)
const guildQuestions = questions.guild const guildQuestions = questions.guild
function qu(n) { function qu(n) {
@@ -31,19 +31,19 @@ module.exports = {
return guildQuestions[n - 1].r return guildQuestions[n - 1].r
} }
if (interaction.customId === 'guildapply') { if (interaction.customId === "guildapply") {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true })
if (userRoles.includes(guildRole)) { if (userRoles.includes(guildRole)) {
await interaction.editReply({ content: "You are already a member of the guild.", ephemeral: true }); await interaction.editReply({ content: "You are already a member of the guild.", ephemeral: true })
return return
} }
const application = await guildapp.findOne({ userID: user.id }); const application = await guildapp.findOne({ userID: user.id })
if (application) { if (application) {
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true }); await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true })
return return
} }
@@ -60,7 +60,7 @@ module.exports = {
try { try {
await user.send({ await user.send({
embeds: [{ embeds: [{
title: 'Guild Application', title: "Guild Application",
description: "Please answer the following questions to apply for the guild.\n" + description: "Please answer the following questions to apply for the guild.\n" +
"If you wish to cancel your application, please type `cancel` at any time.\n" + "If you wish to cancel your application, please type `cancel` at any time.\n" +
"If you wish to proceed with your application, please type `yes`.\n\n" + "If you wish to proceed with your application, please type `yes`.\n\n" +
@@ -70,7 +70,7 @@ module.exports = {
}] }]
}) })
} catch (error) { } catch (error) {
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true }); await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true })
return return
} }
@@ -81,17 +81,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 time: 1000 * 60
}); })
if (input.size === 0) { if (input.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return return
} }
if (input.first().content.toLowerCase() !== 'yes') { if (input.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return return
} }
if (input.first().attachments.size > 0) { if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
@@ -110,17 +110,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5, time: 1000 * 60 * 5,
}); })
if (answer1.size === 0) { if (answer1.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer1.first().content.toLowerCase() === 'cancel') { if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer1.first().attachments.size > 0) { if (answer1.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer1.first().content > 16) { if (answer1.first().content > 16) {
@@ -160,17 +160,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer2.size === 0) { if (answer2.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer2.first().content.toLowerCase() === 'cancel') { if (answer2.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer2.first().attachments.size > 0) { if (answer2.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer2.first().content.size > 8) { if (answer2.first().content.size > 8) {
@@ -199,17 +199,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer3.size === 0) { if (answer3.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer3.first().content.toLowerCase() === 'cancel') { if (answer3.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer3.first().attachments.size > 0) { if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer3.first().content > 128) { if (answer3.first().content > 128) {
@@ -238,17 +238,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer4.size === 0) { if (answer4.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer4.first().content.toLowerCase() === 'cancel') { if (answer4.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer4.first().attachments.size > 0) { if (answer4.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer4.first().content > 256) { if (answer4.first().content > 256) {
@@ -276,17 +276,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer5.size === 0) { if (answer5.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer5.first().content.toLowerCase() === 'cancel') { if (answer5.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer5.first().attachments.size > 0) { if (answer5.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer5.first().content > 128) { if (answer5.first().content > 128) {
@@ -314,17 +314,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer6.size === 0) { if (answer6.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer6.first().content.toLowerCase() === 'cancel') { if (answer6.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer6.first().attachments.size > 0) { if (answer6.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer6.first().content > 256) { if (answer6.first().content > 256) {
@@ -352,17 +352,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer7.size === 0) { if (answer7.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer7.first().content.toLowerCase() === 'cancel') { if (answer7.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer7.first().attachments.size > 0) { if (answer7.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer7.first().content > 128) { if (answer7.first().content > 128) {
@@ -390,17 +390,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer8.size === 0) { if (answer8.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer8.first().content.toLowerCase() === 'cancel') { if (answer8.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer8.first().attachments.size > 0) { if (answer8.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer8.first().content > 64) { if (answer8.first().content > 64) {
@@ -424,17 +424,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5 time: 1000 * 60 * 5
}); })
if (final.size === 0) { if (final.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return return
} }
if (final.first().content.toLowerCase() !== 'yes') { if (final.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return return
} }
if (final.first().attachments.size > 0) { if (final.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
@@ -453,7 +453,7 @@ module.exports = {
await newGuildApp.save() await newGuildApp.save()
const channel = guild.channels.cache.get(applicationsChannel); const channel = guild.channels.cache.get(applicationsChannel)
await channel.send({ await channel.send({
embeds: [{ embeds: [{
title: user.username + "#" + user.discriminator + " - Guild Application", title: user.username + "#" + user.discriminator + " - Guild Application",
@@ -516,7 +516,7 @@ module.exports = {
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
) )
] ]
}); })
} }
} }

View File

@@ -1,9 +1,9 @@
const { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder } = require("discord.js"); const { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder } = require("discord.js")
const { gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole } = require("../../config/roles.json"); const { gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole } = require("../../config/roles.json")
const { ignM, smallM, largeM } = require("../../config/limitmessages.json"); const { ignM, smallM, largeM } = require("../../config/limitmessages.json")
const { ia1, ia2, ia3, ria1, ria2, ria3 } = require("../../config/questions.json"); const { ia1, ia2, ia3, ria1, ria2, ria3 } = require("../../config/questions.json")
const { color, inactivityLogChannel } = require("../../config/options.json"); const { color, inactivityLogChannel } = require("../../config/options.json")
const guildRoles = [gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole]; const guildRoles = [gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole]
module.exports = { module.exports = {
name: "guildinactivitylog", name: "guildinactivitylog",
@@ -13,28 +13,28 @@ module.exports = {
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
const guild = interaction.guild; const guild = interaction.guild
const user = interaction.user; const user = interaction.user
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const userRoles = guild.members.cache.get(user.id).roles.cache; const userRoles = guild.members.cache.get(user.id).roles.cache
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"; const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"
if (!userRoles.some((role) => guildRoles.includes(role.id))) { if (!userRoles.some((role) => guildRoles.includes(role.id))) {
return await interaction.reply({ return await interaction.reply({
content: "Only guild members can use this button.", content: "Only guild members can use this button.",
ephemeral: true ephemeral: true
}); })
} }
const tooLong = new EmbedBuilder() const tooLong = new EmbedBuilder()
.setDescription("You took too long to respond.") .setDescription("You took too long to respond.")
.setColor(embedColor); .setColor(embedColor)
const cancelled = new EmbedBuilder() const cancelled = new EmbedBuilder()
.setDescription("You have cancelled your application.") .setDescription("You have cancelled your application.")
.setColor(embedColor); .setColor(embedColor)
const attachments = new EmbedBuilder() const attachments = new EmbedBuilder()
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
.setColor(embedColor); .setColor(embedColor)
try { try {
await user.send({ await user.send({
@@ -46,29 +46,29 @@ module.exports = {
"You have a minute to respond to this message.", "You have a minute to respond to this message.",
color: embedColor color: embedColor
}] }]
}); })
} catch (error) { } catch (error) {
return await interaction.reply({ content: "Please enable your DMs.", ephemeral: true }); return await interaction.reply({ content: "Please enable your DMs.", ephemeral: true })
} }
await interaction.reply({ content: "Please check your DMs.", ephemeral: true }); await interaction.reply({ content: "Please check your DMs.", ephemeral: true })
const input = await user.dmChannel.awaitMessages({ const input = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id, filter: (m) => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 time: 1000 * 60
}); })
if (input.first().attachments.size > 0) { if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return; return
} }
if (input.size === 0) { if (input.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return; return
} }
if (input.first().content.toLowerCase() !== "yes") { if (input.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return; return
} }
await user.send({ await user.send({
@@ -80,16 +80,16 @@ module.exports = {
text: "You have 5 minutes to respond to this message." text: "You have 5 minutes to respond to this message."
} }
}] }]
}); })
const answer1 = await user.dmChannel.awaitMessages({ const answer1 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id, filter: (m) => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5 time: 1000 * 60 * 5
}); })
if (answer1.first().attachments.size > 0) { if (answer1.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return; return
} }
if (answer1.first().content > 16) { if (answer1.first().content > 16) {
await user.send({ await user.send({
@@ -97,29 +97,29 @@ module.exports = {
description: "Max character limit is 16.", description: "Max character limit is 16.",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
try { try {
await fetch(mojangAPI + answer1.first().content); await fetch(mojangAPI + answer1.first().content)
} catch (error) { } catch (error) {
await user.send({ await user.send({
embeds: [{ embeds: [{
description: "That is not a valid Minecraft username.\n" + "Application cancelled.", description: "That is not a valid Minecraft username.\n" + "Application cancelled.",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
if (answer1.size === 0) { if (answer1.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return; return
} }
if (answer1.first().content.toLowerCase() === "cancel") { if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return; return
} }
const answer1_1 = answer1.first().content; const answer1_1 = answer1.first().content
await user.send({ await user.send({
embeds: [{ embeds: [{
@@ -130,15 +130,15 @@ module.exports = {
text: "You have 5 minutes to respond to this message." text: "You have 5 minutes to respond to this message."
} }
}] }]
}); })
const answer2 = await user.dmChannel.awaitMessages({ const answer2 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id, filter: (m) => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5 time: 1000 * 60 * 5
}); })
if (answer2.first().attachments.size > 0) { if (answer2.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return; return
} }
if (answer2.first().content > 128) { if (answer2.first().content > 128) {
await user.send({ await user.send({
@@ -146,18 +146,18 @@ module.exports = {
description: "Max character limit is 128.", description: "Max character limit is 128.",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
if (answer1.size === 0) { if (answer1.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return; return
} }
if (answer1.first().content.toLowerCase() === "cancel") { if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return; return
} }
const answer2_1 = answer1.first().content; const answer2_1 = answer1.first().content
await user.send({ await user.send({
embeds: [{ embeds: [{
@@ -168,15 +168,15 @@ module.exports = {
text: "You have 15 minutes to respond to this message." text: "You have 15 minutes to respond to this message."
} }
}] }]
}); })
const answer3 = await user.dmChannel.awaitMessages({ const answer3 = await user.dmChannel.awaitMessages({
filter: (m) => m.author.id === user.id, filter: (m) => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer3.first().attachments.size > 0) { if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return; return
} }
if (answer3.first().content > 256) { if (answer3.first().content > 256) {
await user.send({ await user.send({
@@ -184,18 +184,18 @@ module.exports = {
description: "Max character limit is 256", description: "Max character limit is 256",
color: embedColor color: embedColor
}] }]
}); })
return; return
} }
if (answer1.size === 0) { if (answer1.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return; return
} }
if (answer1.first().content.toLowerCase() === "cancel") { if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return; return
} }
const answer3_1 = answer1.first().content; const answer3_1 = answer1.first().content
await user.send({ await user.send({
embeds: [{ embeds: [{
@@ -207,17 +207,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5 time: 1000 * 60 * 5
}); })
if (final.first().attachments.size > 0) { if (final.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (final.size === 0) { if (final.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return return
} }
if (final.first().content.toLowerCase() !== 'yes') { if (final.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return return
} }
@@ -228,7 +228,7 @@ module.exports = {
}] }]
}) })
const appChannel = await guild.channels.cache.get(inactivityLogChannel); const appChannel = await guild.channels.cache.get(inactivityLogChannel)
await appChannel.send({ await appChannel.send({
embeds: [{ embeds: [{
@@ -268,6 +268,6 @@ module.exports = {
.setStyle(ButtonStyle.Danger), .setStyle(ButtonStyle.Danger),
) )
] ]
}); })
} }
}; }

View File

@@ -7,7 +7,7 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); await interaction.reply({ content: "This button is currently disabled.", ephemeral: true })
} }
} }

View File

@@ -7,7 +7,7 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.reply({ content: "This button is currently disabled.", ephemeral: true }); await interaction.reply({ content: "This button is currently disabled.", ephemeral: true })
} }
} }

View File

@@ -1,33 +1,33 @@
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
const { color } = require('../../config/options.json'); const { color } = require("../../config/options.json")
const staffapp = require('../../schemas/staffAppSchema.js'); const staffapp = require("../../schemas/staffAppSchema.js")
module.exports = { module.exports = {
name: 'staffapplicationaccept', name: "staffapplicationaccept",
description: 'Accept a staff application.', description: "Accept a staff application.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
const user = interaction.user; const user = interaction.user
const guild = interaction.guild; const guild = interaction.guild
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const message = interaction.message; const message = interaction.message
const embed = message.embeds[0]; const embed = message.embeds[0]
const applicantId = embed.footer.text.split(" ")[1] const applicantId = embed.footer.text.split(" ")[1]
const applicant = await guild.members.fetch(applicantId) const applicant = await guild.members.fetch(applicantId)
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator; const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
await applicant.send({ await applicant.send({
embeds: [{ embeds: [{
description: `Your application for the Illegitimate staff team has been accepted.`, description: "Your application for the Illegitimate staff team has been accepted.",
color: embedColor color: embedColor
}] }]
}); })
await message.edit({ await message.edit({
components: [ components: [
@@ -44,9 +44,9 @@ module.exports = {
.setDisabled(true) .setDisabled(true)
) )
] ]
}); })
await staffapp.findOneAndDelete({ userId: applicantId }); await staffapp.findOneAndDelete({ userId: applicantId })
await interaction.reply({ await interaction.reply({
embeds: [{ embeds: [{
@@ -61,7 +61,7 @@ module.exports = {
text: "ID: " + applicantId text: "ID: " + applicantId
} }
}] }]
}); })
} }
} }

View File

@@ -1,27 +1,27 @@
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
module.exports = { module.exports = {
name: 'staffapplicationdeny', name: "staffapplicationdeny",
description: 'Deny a guild application.', description: "Deny a guild application.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
const modal = new ModalBuilder() const modal = new ModalBuilder()
.setTitle('Deny Reason') .setTitle("Deny Reason")
.setCustomId('staffdenyreasonbox') .setCustomId("staffdenyreasonbox")
.setComponents( .setComponents(
new ActionRowBuilder().setComponents( new ActionRowBuilder().setComponents(
new TextInputBuilder() new TextInputBuilder()
.setLabel('Deny Reason') .setLabel("Deny Reason")
.setCustomId('staffdenyreason') .setCustomId("staffdenyreason")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setPlaceholder('Enter a reason for denying the application') .setPlaceholder("Enter a reason for denying the application")
.setRequired(false) .setRequired(false)
) )
) )
await interaction.showModal(modal); await interaction.showModal(modal)
} }
}; }

View File

@@ -1,30 +1,30 @@
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js'); const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require("discord.js")
const { color } = require('../../config/options.json'); const { color } = require("../../config/options.json")
const { largeM, ignM } = require('../../config/limitmessages.json') const { largeM, ignM } = require("../../config/limitmessages.json")
const { staffApplicationsChannel } = require('../../config/options.json'); const { staffApplicationsChannel } = require("../../config/options.json")
const questions = require('../../config/questions.json'); const questions = require("../../config/questions.json")
const { guildRole, guildStaff } = require('../../config/roles.json') const { guildRole, guildStaff } = require("../../config/roles.json")
const mongoose = require('mongoose'); const mongoose = require("mongoose")
const staffapp = require('../../schemas/staffAppSchema.js'); const staffapp = require("../../schemas/staffAppSchema.js")
const settings = require("../../schemas/settingsSchema.js"); const settings = require("../../schemas/settingsSchema.js")
const { getUUID } = require('../../utils/utils.js') const { getUUID } = require("../../utils/utils.js")
const dev = process.env.DEV const dev = process.env.DEV
module.exports = { module.exports = {
name: 'staffapply', name: "staffapply",
description: 'Apply for the staff team.', description: "Apply for the staff team.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
const user = interaction.user; const user = interaction.user
const guild = interaction.guild; const guild = interaction.guild
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const userRoles = interaction.member.roles.cache; const userRoles = interaction.member.roles.cache
const setting = await settings.findOne({ name: "staffAppStatus" }) const setting = await settings.findOne({ name: "staffAppStatus" })
const status = setting.value; const status = setting.value
const staffQuestions = questions.staff const staffQuestions = questions.staff
function sq(n) { function sq(n) {
@@ -37,29 +37,29 @@ module.exports = {
if (interaction.customId === "staffapply") { if (interaction.customId === "staffapply") {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true })
if (user.id !== dev) { if (user.id !== dev) {
if (status === "0") { if (status === "0") {
await interaction.editReply({ content: "Staff applications are currently closed.", ephemeral: true }); await interaction.editReply({ content: "Staff applications are currently closed.", ephemeral: true })
return return
} }
} }
if (!userRoles.has(guildRole)) { if (!userRoles.has(guildRole)) {
await interaction.editReply({ content: "You must be a member of the guild to apply for staff.", ephemeral: true }); await interaction.editReply({ content: "You must be a member of the guild to apply for staff.", ephemeral: true })
return return
} }
if (userRoles.has(guildStaff)) { if (userRoles.has(guildStaff)) {
await interaction.editReply({ content: "You are already a staff member.", ephemeral: true }); await interaction.editReply({ content: "You are already a staff member.", ephemeral: true })
return return
} }
const application = await staffapp.findOne({ userID: user.id }); const application = await staffapp.findOne({ userID: user.id })
if (application) { if (application) {
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true }); await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true })
return return
} }
@@ -76,7 +76,7 @@ module.exports = {
try { try {
await user.send({ await user.send({
embeds: [{ embeds: [{
title: 'Staff Application', title: "Staff Application",
description: "Please answer the following questions to apply for staff.\n" + description: "Please answer the following questions to apply for staff.\n" +
"If you wish to cancel your application, please press type `cancel` at any time.\n" + "If you wish to cancel your application, please press type `cancel` at any time.\n" +
"If you wish to proceed with your application, please type `yes`.\n\n" + "If you wish to proceed with your application, please type `yes`.\n\n" +
@@ -86,7 +86,7 @@ module.exports = {
}] }]
}) })
} catch (error) { } catch (error) {
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true }); await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true })
return return
} }
@@ -96,17 +96,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 time: 1000 * 60
}); })
if (input.size === 0) { if (input.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return return
} }
if (input.first().content.toLowerCase() !== 'yes') { if (input.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return return
} }
if (input.first().attachments.size > 0) { if (input.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
@@ -125,17 +125,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5, time: 1000 * 60 * 5,
}); })
if (answer1.size === 0) { if (answer1.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer1.first().content.toLowerCase() === 'cancel') { if (answer1.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer1.first().attachments.size > 0) { if (answer1.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer1.first().content > 16) { if (answer1.first().content > 16) {
@@ -175,17 +175,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer2.size === 0) { if (answer2.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer2.first().content.toLowerCase() === 'cancel') { if (answer2.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer2.first().attachments.size > 0) { if (answer2.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer2.first().content > 64) { if (answer2.first().content > 64) {
@@ -214,17 +214,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer3.size === 0) { if (answer3.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer3.first().content.toLowerCase() === 'cancel') { if (answer3.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer3.first().attachments.size > 0) { if (answer3.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer3.first().content > 256) { if (answer3.first().content > 256) {
@@ -252,17 +252,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer4.size === 0) { if (answer4.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer4.first().content.toLowerCase() === 'cancel') { if (answer4.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer4.first().attachments.size > 0) { if (answer4.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer4.first().content > 256) { if (answer4.first().content > 256) {
@@ -290,17 +290,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer5.size === 0) { if (answer5.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer5.first().content.toLowerCase() === 'cancel') { if (answer5.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer5.first().attachments.size > 0) { if (answer5.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer5.first().content > 256) { if (answer5.first().content > 256) {
@@ -329,17 +329,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 15 time: 1000 * 60 * 15
}); })
if (answer6.size === 0) { if (answer6.size === 0) {
await user.send({ embeds: [tooLong] }) await user.send({ embeds: [tooLong] })
return return
} }
if (answer6.first().content.toLowerCase() === 'cancel') { if (answer6.first().content.toLowerCase() === "cancel") {
await user.send({ embeds: [cancelled] }) await user.send({ embeds: [cancelled] })
return return
} }
if (answer6.first().attachments.size > 0) { if (answer6.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
if (answer6.first().content > 256) { if (answer6.first().content > 256) {
@@ -363,17 +363,17 @@ module.exports = {
filter: m => m.author.id === user.id, filter: m => m.author.id === user.id,
max: 1, max: 1,
time: 1000 * 60 * 5 time: 1000 * 60 * 5
}); })
if (final.size === 0) { if (final.size === 0) {
await user.send({ embeds: [tooLong] }); await user.send({ embeds: [tooLong] })
return return
} }
if (final.first().content.toLowerCase() !== 'yes') { if (final.first().content.toLowerCase() !== "yes") {
await user.send({ embeds: [cancelled] }); await user.send({ embeds: [cancelled] })
return return
} }
if (final.first().attachments.size > 0) { if (final.first().attachments.size > 0) {
await user.send({ embeds: [attachments] }); await user.send({ embeds: [attachments] })
return return
} }
@@ -391,9 +391,9 @@ module.exports = {
}) })
await newStaffApp.save() await newStaffApp.save()
await user.deleteDM(); await user.deleteDM()
const channel = guild.channels.cache.get(staffApplicationsChannel); const channel = guild.channels.cache.get(staffApplicationsChannel)
await channel.send({ await channel.send({
embeds: [{ embeds: [{
@@ -446,7 +446,7 @@ module.exports = {
.setStyle(ButtonStyle.Danger) .setStyle(ButtonStyle.Danger)
) )
] ]
}); })
} }
} }
} }

View File

@@ -1,9 +1,9 @@
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js') const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
module.exports = { module.exports = {
name: 'verify', name: "verify",
description: 'Configure the bot.', description: "Configure the bot.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */

View File

@@ -1,21 +1,21 @@
const waitinglist = require('../../schemas/waitinglistSchema.js'); const waitinglist = require("../../schemas/waitinglistSchema.js")
const { getGuild } = require('../../utils/utils.js'); const { getGuild } = require("../../utils/utils.js")
const { hypixelGuildID } = require("../../config/options.json") const { hypixelGuildID } = require("../../config/options.json")
module.exports = { module.exports = {
name: 'waitinglistupdate', name: "waitinglistupdate",
description: 'Update the waiting list.', description: "Update the waiting list.",
type: 'button', type: "button",
/** @param {import('discord.js').ButtonInteraction} interaction */ /** @param {import('discord.js').ButtonInteraction} interaction */
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true })
const user = interaction.user; const user = interaction.user
const message = interaction.message; const message = interaction.message
const embed = message.embeds[0]; const embed = message.embeds[0]
const accepted = await waitinglist.find() const accepted = await waitinglist.find()
for (let i = 0; i < accepted.length; i++) { for (let i = 0; i < accepted.length; i++) {
@@ -30,7 +30,7 @@ module.exports = {
} }
let fields = []; let fields = []
for (let i = 0; i < accepted.length; i++) { for (let i = 0; i < accepted.length; i++) {
@@ -40,7 +40,7 @@ module.exports = {
fields.push({ fields.push({
name: `${i + 1}. ${accepted[i].IGN}`, name: `${i + 1}. ${accepted[i].IGN}`,
value: `TS: <t:${timestamp}:R>` value: `TS: <t:${timestamp}:R>`
}); })
} }
await message.edit({ await message.edit({
@@ -56,8 +56,8 @@ module.exports = {
fields: fields, fields: fields,
timestamp: new Date(), timestamp: new Date(),
}], }],
}); })
await interaction.editReply({ content: 'Updated the waiting list', ephemeral: true }); await interaction.editReply({ content: "Updated the waiting list", ephemeral: true })
} }
} }

View File

@@ -1,35 +1,35 @@
const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
const { color } = require('../../config/options.json'); const { color } = require("../../config/options.json")
const guildapp = require('../../schemas/guildAppSchema.js'); const guildapp = require("../../schemas/guildAppSchema.js")
module.exports = { module.exports = {
name: 'denyreasonbox', name: "denyreasonbox",
description: 'Deny reason box.', description: "Deny reason box.",
type: 'modal', type: "modal",
/** @param {import('discord.js').ModalSubmitInteraction} interaction */ /** @param {import('discord.js').ModalSubmitInteraction} interaction */
async execute(interaction) { async execute(interaction) {
if (interaction.type !== InteractionType.ModalSubmit) return; if (interaction.type !== InteractionType.ModalSubmit) return
if (interaction.customId !== "denyreasonbox") return; if (interaction.customId !== "denyreasonbox") return
interaction.deferReply(); interaction.deferReply()
const guild = interaction.guild; const guild = interaction.guild
const message = interaction.message; const message = interaction.message
const embed = message.embeds[0]; const embed = message.embeds[0]
const applicantId = embed.footer.text.split(" ")[1]; const applicantId = embed.footer.text.split(" ")[1]
let applicant = "" let applicant = ""
try { try {
applicant = await guild.members.fetch(applicantId); applicant = await guild.members.fetch(applicantId)
} catch (error) { } catch (error) {
applicant = null; applicant = null
} }
const reason = interaction.fields.fields.get('denyreason').value || "No reason provided"; const reason = interaction.fields.fields.get("denyreason").value || "No reason provided"
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
await message.edit({ await message.edit({
components: [ components: [
@@ -51,12 +51,12 @@ module.exports = {
.setDisabled(true) .setDisabled(true)
) )
] ]
}); })
const dmMessage = new EmbedBuilder() const dmMessage = new EmbedBuilder()
.setDescription("Your application for the Illegitimate guild has been denied\n" + .setDescription("Your application for the Illegitimate guild has been denied\n" +
"**Reason:** `" + reason + "`") "**Reason:** `" + reason + "`")
.setColor(embedColor); .setColor(embedColor)
const missingUser = new EmbedBuilder() const missingUser = new EmbedBuilder()
.setDescription("[WARN] User has left the server and cannot be notified.") .setDescription("[WARN] User has left the server and cannot be notified.")
@@ -74,20 +74,20 @@ module.exports = {
}) })
if (applicant !== null) { if (applicant !== null) {
await applicant.send({ embeds: [dmMessage] }); await applicant.send({ embeds: [dmMessage] })
} }
let responseEmbeds = "" let responseEmbeds = ""
if (applicant === null) { if (applicant === null) {
responseEmbeds = [responseEmbed, missingUser]; responseEmbeds = [responseEmbed, missingUser]
} else { } else {
responseEmbeds = [responseEmbed]; responseEmbeds = [responseEmbed]
} }
await guildapp.findOneAndDelete({ userID: applicantId }); await guildapp.findOneAndDelete({ userID: applicantId })
await interaction.editReply({ await interaction.editReply({
embeds: responseEmbeds embeds: responseEmbeds
}); })
} }
} }

View File

@@ -1,27 +1,27 @@
const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
const { color } = require('../../config/options.json'); const { color } = require("../../config/options.json")
const staffapp = require('../../schemas/staffAppSchema.js'); const staffapp = require("../../schemas/staffAppSchema.js")
module.exports = { module.exports = {
name: 'staffdenyreasonbox', name: "staffdenyreasonbox",
description: 'Deny reason box.', description: "Deny reason box.",
type: 'modal', type: "modal",
/** @param {import('discord.js').ModalSubmitInteraction} interaction */ /** @param {import('discord.js').ModalSubmitInteraction} interaction */
async execute(interaction) { async execute(interaction) {
if (interaction.type !== InteractionType.ModalSubmit) return; if (interaction.type !== InteractionType.ModalSubmit) return
if (interaction.customId !== "staffdenyreasonbox") return; if (interaction.customId !== "staffdenyreasonbox") return
interaction.deferReply(); interaction.deferReply()
const guild = interaction.guild; const guild = interaction.guild
const reason = interaction.fields.fields.get('staffdenyreason').value || "No reason provided"; const reason = interaction.fields.fields.get("staffdenyreason").value || "No reason provided"
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"))
const message = interaction.message; const message = interaction.message
const embed = message.embeds[0]; const embed = message.embeds[0]
const applicantId = embed.footer.text.split(" ")[1] const applicantId = embed.footer.text.split(" ")[1]
const applicant = await guild.members.fetch(applicantId) const applicant = await guild.members.fetch(applicantId)
@@ -40,16 +40,16 @@ module.exports = {
.setDisabled(true), .setDisabled(true),
) )
] ]
}); })
const dmMessage = new EmbedBuilder() const dmMessage = new EmbedBuilder()
.setDescription("Your application for the Illegitimate guild staff has been denied\n" + .setDescription("Your application for the Illegitimate guild staff has been denied\n" +
"**Reason:** `" + reason + "`") "**Reason:** `" + reason + "`")
.setColor(embedColor); .setColor(embedColor)
await applicant.send({ embeds: [dmMessage] }); await applicant.send({ embeds: [dmMessage] })
await staffapp.findOneAndDelete({ userID: applicantId }); await staffapp.findOneAndDelete({ userID: applicantId })
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
@@ -65,6 +65,6 @@ module.exports = {
text: "ID: " + applicant.id text: "ID: " + applicant.id
} }
}], }],
});; })
} }
} }

View File

@@ -1,21 +1,21 @@
const { userMention } = require('discord.js'); const { userMention } = require("discord.js")
const { color, botLogChannel } = require('../../../config/options.json'); const { color, botLogChannel } = require("../../../config/options.json")
module.exports = { module.exports = {
name: 'logNewJoins', name: "logNewJoins",
description: 'Logs new joins', description: "Logs new joins",
type: 'event', type: "event",
event: 'guildMemberAdd', event: "guildMemberAdd",
/** @param { import('discord.js').GuildMember } member */ /** @param { import('discord.js').GuildMember } member */
execute(member) { execute(member) {
const channel = member.guild.channels.cache.get(botLogChannel); const channel = member.guild.channels.cache.get(botLogChannel)
const embedColor = Number(color.replace('#', '0x')); const embedColor = Number(color.replace("#", "0x"))
if (!channel) { if (!channel) {
console.log(`[ERROR] Could not find channel used for new join logging.`); console.log("[ERROR] Could not find channel used for new join logging.")
return; return
} }
channel.send({ channel.send({

View File

@@ -11,12 +11,12 @@ module.exports = {
console.log(interaction.user.username + "#" + console.log(interaction.user.username + "#" +
interaction.user.discriminator + " ran " + interaction.user.discriminator + " ran " +
interaction.commandName interaction.commandName
); )
} else if (interaction.isButton()) { } else if (interaction.isButton()) {
console.log(interaction.user.username + "#" + console.log(interaction.user.username + "#" +
interaction.user.discriminator + " clicked " + interaction.user.discriminator + " clicked " +
interaction.customId interaction.customId
); )
} }
} }
} }

View File

@@ -1,14 +1,14 @@
module.exports = { module.exports = {
name: 'ur mom', name: "ur mom",
description: 'ur moms someone', description: "ur moms someone",
type: 'event', type: "event",
event: 'messageCreate', event: "messageCreate",
/** @param { import('discord.js').Message } message */ /** @param { import('discord.js').Message } message */
async execute(message) { async execute(message) {
if (message.content.toLowerCase().includes('ur mom') && message.author.username === "taken.lua") { if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") {
message.react("Woot:734345936347725885"); message.react("Woot:734345936347725885")
} }
} }
} }

View File

@@ -1,11 +1,11 @@
module.exports = { module.exports = {
name: 'conolelog', name: "conolelog",
description: "console log", description: "console log",
type: 'event', type: "event",
event: 'ready', event: "ready",
/** @param { import('discord.js').Client } client */ /** @param { import('discord.js').Client } client */
execute(client) { execute(client) {
console.log("Logged in as " + client.user.tag + "!"); console.log("Logged in as " + client.user.tag + "!")
} }
} }

View File

@@ -1,27 +1,27 @@
const { onlineLogChannel, color } = require('../../../config/options.json'); const { onlineLogChannel, color } = require("../../../config/options.json")
module.exports = { module.exports = {
name: 'sendonlinemessage', name: "sendonlinemessage",
description: "send an online message", description: "send an online message",
type: 'event', type: "event",
event: 'ready', event: "ready",
execute(client) { execute(client) {
if (process.env.NODE_ENV === 'dev') return if (process.env.NODE_ENV === "dev") return
const channel = client.channels.cache.get(onlineLogChannel); const channel = client.channels.cache.get(onlineLogChannel)
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
if (!channel) { if (!channel) {
console.log(`[ERROR] Could not find channel used for online message.`); console.log("[ERROR] Could not find channel used for online message.")
return; return
} }
channel.send({ channel.send({
embeds: [{ embeds: [{
description: `Bot is online!`, description: "Bot is online!",
color: embedColor color: embedColor
}] }]
}); })
} }
} }

View File

@@ -1,10 +1,10 @@
const statuses = require('../../../config/statuses.json') const statuses = require("../../../config/statuses.json")
module.exports = { module.exports = {
name: 'status', name: "status",
description: 'Sets the status of the bot', description: "Sets the status of the bot",
type: 'event', type: "event",
event: 'ready', event: "ready",
/** @param { import('discord.js').Client } client */ /** @param { import('discord.js').Client } client */
@@ -19,9 +19,9 @@ module.exports = {
client.user.setActivity( client.user.setActivity(
{ name: statuses[0].name, type: 3} { name: statuses[0].name, type: 3}
); )
let i = 0; let i = 0
setInterval(() => setInterval(() =>
client.user.setActivity( client.user.setActivity(
statuses[i = 1, i++ % statuses.length] statuses[i = 1, i++ % statuses.length]
@@ -29,6 +29,6 @@ module.exports = {
1000 * 60 * 10 1000 * 60 * 10
) )
client.user.setStatus('dnd'); client.user.setStatus("dnd")
} }
} }

View File

@@ -1,11 +1,11 @@
const { userMention, channelMention } = require('discord.js') const { userMention, channelMention } = require("discord.js")
const { botLogChannel, color } = require('../../../config/options.json') const { botLogChannel, color } = require("../../../config/options.json")
module.exports = { module.exports = {
name: 'vcJoinLeave', name: "vcJoinLeave",
description: 'Logs when a user joins or leaves a voice channel.', description: "Logs when a user joins or leaves a voice channel.",
type: 'event', type: "event",
event: 'voiceStateUpdate', event: "voiceStateUpdate",
/** /**
* @param { import('discord.js').VoiceState } oldState * @param { import('discord.js').VoiceState } oldState
@@ -18,10 +18,10 @@ module.exports = {
const guild = oldState.guild const guild = oldState.guild
const channel = guild.channels.cache.get(botLogChannel) const channel = guild.channels.cache.get(botLogChannel)
const embedColor = Number(color.replace('#', '0x')) const embedColor = Number(color.replace("#", "0x"))
if (!channel) { if (!channel) {
console.log(`[ERROR] Could not find channel used for voice channel join/leave logging.`) console.log("[ERROR] Could not find channel used for voice channel join/leave logging.")
return return
} }

View File

@@ -1,9 +1,9 @@
const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js'); const { Client, GatewayIntentBits, Partials, Collection } = require("discord.js")
const { loadSlashCommandsEvents, loadContextMenuEvents, loadModalEvents, loadButtonEvents, loadEvents } = require('./utils/eventHandler.js') const { loadSlashCommandsEvents, loadContextMenuEvents, loadModalEvents, loadButtonEvents, loadEvents } = require("./utils/eventHandler.js")
const { autoDeployCommands } = require('./utils/autodeploy.js'); const { autoDeployCommands } = require("./utils/autodeploy.js")
require('dotenv').config(); require("dotenv").config()
const mongoURI = process.env.MONGOURI; const mongoURI = process.env.MONGOURI
const { connect } = require('mongoose'); const { connect } = require("mongoose")
const client = new Client({ const client = new Client({
intents: [ intents: [
@@ -20,30 +20,30 @@ const client = new Client({
Partials.Message, Partials.Message,
Partials.Channel Partials.Channel
] ]
}); })
client.commands = new Collection(); client.commands = new Collection()
client.events = new Collection(); client.events = new Collection()
client.modals = new Collection(); client.modals = new Collection()
loadSlashCommandsEvents(client); loadSlashCommandsEvents(client)
loadContextMenuEvents(client); loadContextMenuEvents(client)
loadButtonEvents(client); loadButtonEvents(client)
loadModalEvents(client); loadModalEvents(client)
loadEvents(client); loadEvents(client)
let token = "" let token = ""
if (process.env.NODE_ENV === 'dev') { if (process.env.NODE_ENV === "dev") {
console.log("Running in development mode."); console.log("Running in development mode.")
token = process.env.DEVTOKEN; token = process.env.DEVTOKEN
autoDeployCommands() autoDeployCommands()
} else { } else {
console.log("Running in production mode."); console.log("Running in production mode.")
token = process.env.PRODTOKEN; token = process.env.PRODTOKEN
} }
client.login(token); client.login(token)
connect(mongoURI, {}).then(() => { connect(mongoURI, {}).then(() => {
console.log('Connected to MongoDB'); console.log("Connected to MongoDB")
}) })

View File

@@ -1,9 +1,9 @@
const { Schema, model } = require('mongoose'); const { Schema, model } = require("mongoose")
const guildAppSchema = new Schema({ const guildAppSchema = new Schema({
_id: Schema.Types.ObjectId, _id: Schema.Types.ObjectId,
userID: { type: String, required: true }, userID: { type: String, required: true },
uuid: { type: String, required: true }, uuid: { type: String, required: true },
}); })
module.exports = model('guildapp', guildAppSchema, 'guildapp'); module.exports = model("guildapp", guildAppSchema, "guildapp")

View File

@@ -1,9 +1,9 @@
const { Schema, model } = require('mongoose'); const { Schema, model } = require("mongoose")
const settingsSchema = new Schema({ const settingsSchema = new Schema({
_id: Schema.Types.ObjectId, _id: Schema.Types.ObjectId,
name: { type: String, required: true }, name: { type: String, required: true },
value: { type: String, required: true }, value: { type: String, required: true },
}); })
module.exports = model('settings', settingsSchema, 'settings'); module.exports = model("settings", settingsSchema, "settings")

View File

@@ -1,9 +1,9 @@
const { Schema, model } = require('mongoose'); const { Schema, model } = require("mongoose")
const staffAppSchema = new Schema({ const staffAppSchema = new Schema({
_id: Schema.Types.ObjectId, _id: Schema.Types.ObjectId,
userID: { type: String, required: true }, userID: { type: String, required: true },
uuid: { type: String, required: true }, uuid: { type: String, required: true },
}); })
module.exports = model('staffapp', staffAppSchema, 'staffapp'); module.exports = model("staffapp", staffAppSchema, "staffapp")

View File

@@ -1,9 +1,9 @@
const { Schema, model } = require('mongoose'); const { Schema, model } = require("mongoose")
const verifySchema = new Schema({ const verifySchema = new Schema({
_id: Schema.Types.ObjectId, _id: Schema.Types.ObjectId,
userID: { type: String, required: true }, userID: { type: String, required: true },
uuid: { type: String, required: true }, uuid: { type: String, required: true },
}); })
module.exports = model('verify', verifySchema, 'verify'); module.exports = model("verify", verifySchema, "verify")

View File

@@ -1,4 +1,4 @@
const { Schema, model } = require('mongoose'); const { Schema, model } = require("mongoose")
const waitinglistSchema = new Schema({ const waitinglistSchema = new Schema({
_id: Schema.Types.ObjectId, _id: Schema.Types.ObjectId,
@@ -6,6 +6,6 @@ const waitinglistSchema = new Schema({
uuid: { type: String, required: true }, uuid: { type: String, required: true },
IGN: { type: String, required: true }, IGN: { type: String, required: true },
timestamp: { type: String, required: true } timestamp: { type: String, required: true }
}); })
module.exports = model('waitinglist', waitinglistSchema, 'waitinglist'); module.exports = model("waitinglist", waitinglistSchema, "waitinglist")

View File

@@ -1,87 +1,87 @@
const { REST, Routes } = require('discord.js'); const { REST, Routes } = require("discord.js")
const env = require('dotenv').config(); require("dotenv").config()
const token = process.env.PRODTOKEN; const token = process.env.PRODTOKEN
const clientId = process.env.CLIENTID; const clientId = process.env.CLIENTID
const guildId = process.env.GUILDID; const guildId = process.env.GUILDID
const fs = require('node:fs'); const fs = require("node:fs")
const args = process.argv.slice(2); const args = process.argv.slice(2)
const arg = args[0]; const arg = args[0]
if (!arg) { if (!arg) {
console.log('Please specify a command to run!'); console.log("Please specify a command to run!")
} }
else if (arg === '--prod') { else if (arg === "--prod") {
const commands = []; const commands = []
// Grab all the command files from the commands directory you created earlier // Grab all the command files from the commands directory you created earlier
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); const commandFiles = fs.readdirSync("./commands").filter(file => file.endsWith(".js"))
const contentMenuCommands = fs.readdirSync('./commands-contextmenu').filter(file => file.endsWith('.js')); const contentMenuCommands = fs.readdirSync("./commands-contextmenu").filter(file => file.endsWith(".js"))
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`../commands/${file}`); const command = require(`../commands/${file}`)
commands.push(command.data.toJSON()); commands.push(command.data.toJSON())
} }
for (const file of contentMenuCommands) { for (const file of contentMenuCommands) {
const command = require(`../commands-contextmenu/${file}`); const command = require(`../commands-contextmenu/${file}`)
commands.push(command.data.toJSON()); commands.push(command.data.toJSON())
} }
// Construct and prepare an instance of the REST module // Construct and prepare an instance of the REST module
const rest = new REST({ version: '10' }).setToken(token); const rest = new REST({ version: "10" }).setToken(token);
// and deploy your commands! // and deploy your commands!
(async () => { (async () => {
try { try {
console.log(`Started refreshing ${commands.length} application (/) commands.`); console.log(`Started refreshing ${commands.length} application (/) commands.`)
// The put method is used to fully refresh all commands in the guild with the current set // The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put( const data = await rest.put(
Routes.applicationCommands(clientId), Routes.applicationCommands(clientId),
{ body: commands }, { body: commands },
); )
console.log(`Successfully reloaded ${data.length} application (/) commands.`); console.log(`Successfully reloaded ${data.length} application (/) commands.`)
} catch (error) { } catch (error) {
// And of course, make sure you catch and log any errors! // And of course, make sure you catch and log any errors!
console.error(error); console.error(error)
} }
})(); })()
} }
else if (arg === '--dev') { else if (arg === "--dev") {
const commands = []; const commands = []
// Grab all the command files from the commands directory you created earlier // Grab all the command files from the commands directory you created earlier
const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js')); const commandFiles = fs.readdirSync("./commands-testing").filter(file => file.endsWith(".js"))
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`../commands-testing/${file}`); const command = require(`../commands-testing/${file}`)
commands.push(command.data.toJSON()); commands.push(command.data.toJSON())
} }
// Construct and prepare an instance of the REST module // Construct and prepare an instance of the REST module
const rest = new REST({ version: '10' }).setToken(token); const rest = new REST({ version: "10" }).setToken(token);
// and deploy your commands! // and deploy your commands!
(async () => { (async () => {
try { try {
console.log(`Started refreshing ${commands.length} application (/) commands.`); console.log(`Started refreshing ${commands.length} application (/) commands.`)
// The put method is used to fully refresh all commands in the guild with the current set // The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put( const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId), Routes.applicationGuildCommands(clientId, guildId),
{ body: commands }, { body: commands },
); )
console.log(`Successfully reloaded ${data.length} application (/) commands.`); console.log(`Successfully reloaded ${data.length} application (/) commands.`)
} catch (error) { } catch (error) {
// And of course, make sure you catch and log any errors! // And of course, make sure you catch and log any errors!
console.error(error); console.error(error)
} }
})(); })()
} }
else if (arg && arg !== '--prod' && arg !== '--dev') { else if (arg && arg !== "--prod" && arg !== "--dev") {
console.log('Invalid argument!'); console.log("Invalid argument!")
} }

View File

@@ -1,10 +1,10 @@
const { REST, Routes } = require('discord.js'); const { REST, Routes } = require("discord.js")
require('dotenv').config(); require("dotenv").config()
const token = process.env.DEVTOKEN; const token = process.env.DEVTOKEN
const clientId = process.env.DEVID; const clientId = process.env.DEVID
const guildId = process.env.GUILDID; const guildId = process.env.GUILDID
const commands = []; const commands = []
// Grab all the command files from the commands directory you created earlier // Grab all the command files from the commands directory you created earlier
// const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js')); // const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js'));
@@ -15,28 +15,28 @@ const commandFiles = [
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`${file}`); const command = require(`${file}`)
commands.push(command.data.toJSON()); commands.push(command.data.toJSON())
} }
// Construct and prepare an instance of the REST module // Construct and prepare an instance of the REST module
const rest = new REST({ version: '10' }).setToken(token); const rest = new REST({ version: "10" }).setToken(token);
// and deploy your commands! // and deploy your commands!
(async () => { (async () => {
try { try {
console.log(`Started refreshing ${commands.length} application (/) commands.`); console.log(`Started refreshing ${commands.length} application (/) commands.`)
// The put method is used to fully refresh all commands in the guild with the current set // The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put( const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId), Routes.applicationGuildCommands(clientId, guildId),
{ body: commands }, { body: commands },
); )
console.log(`Successfully reloaded ${data.length} application (/) commands.`); console.log(`Successfully reloaded ${data.length} application (/) commands.`)
} catch (error) { } catch (error) {
// And of course, make sure you catch and log any errors! // And of course, make sure you catch and log any errors!
console.error(error); console.error(error)
} }
})(); })()

View File

@@ -1,10 +1,10 @@
const { REST, Routes } = require('discord.js'); const { REST, Routes } = require("discord.js")
const log = require('log-beautify') const log = require("log-beautify")
const fs = require('fs'); const fs = require("fs")
require('dotenv').config(); require("dotenv").config()
const token = process.env.DEVTOKEN; const token = process.env.DEVTOKEN
const clientId = process.env.DEVID; const clientId = process.env.DEVID
const guildId = process.env.GUILDID; const guildId = process.env.GUILDID
log.useSymbols = false log.useSymbols = false
log.setColors({ log.setColors({
@@ -13,31 +13,31 @@ log.setColors({
}) })
async function autoDeployCommands() { async function autoDeployCommands() {
const commands = []; const commands = []
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); const commandFiles = fs.readdirSync("./commands/").filter(file => file.endsWith(".js"))
const contentMenuCommands = fs.readdirSync('./commands-contextmenu/').filter(file => file.endsWith('.js')); const contentMenuCommands = fs.readdirSync("./commands-contextmenu/").filter(file => file.endsWith(".js"))
const commandsTesting = fs.readdirSync('./commands-testing/').filter(file => file.endsWith('.js')); const commandsTesting = fs.readdirSync("./commands-testing/").filter(file => file.endsWith(".js"))
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`../commands/${file}`); const command = require(`../commands/${file}`)
if (command.dev) { if (command.dev) {
commands.push(command.data.toJSON()); commands.push(command.data.toJSON())
} }
} }
for (const file of contentMenuCommands) { for (const file of contentMenuCommands) {
const command = require(`../commands-contextmenu/${file}`); const command = require(`../commands-contextmenu/${file}`)
if (command.dev) { if (command.dev) {
commands.push(command.data.toJSON()); commands.push(command.data.toJSON())
} }
} }
for (const file of commandsTesting) { for (const file of commandsTesting) {
const command = require(`../commands-testing/${file}`); const command = require(`../commands-testing/${file}`)
if (command.dev) { if (command.dev) {
commands.push(command.data.toJSON()); commands.push(command.data.toJSON())
} }
} }
const rest = new REST({ version: '10' }).setToken(token); const rest = new REST({ version: "10" }).setToken(token)
const currentCommands = await rest.get( const currentCommands = await rest.get(
Routes.applicationGuildCommands(clientId, guildId), Routes.applicationGuildCommands(clientId, guildId),
@@ -61,32 +61,32 @@ async function autoDeployCommands() {
const newCmds = sortedNewCommandsInfo.map(cmd => { const newCmds = sortedNewCommandsInfo.map(cmd => {
return " " + cmd.name + " was registered." return " " + cmd.name + " was registered."
}).join('\n') }).join("\n")
const currentCmds = sortedCurrentCommandsInfo.map(cmd => { const currentCmds = sortedCurrentCommandsInfo.map(cmd => {
return " " + cmd.name + " was unregistered." return " " + cmd.name + " was unregistered."
}).join('\n') }).join("\n")
if (JSON.stringify(sortedNewCommandsInfo) === JSON.stringify(sortedCurrentCommandsInfo)) { if (JSON.stringify(sortedNewCommandsInfo) === JSON.stringify(sortedCurrentCommandsInfo)) {
log.success('Commands are the same, skipping deploy.') log.success("Commands are the same, skipping deploy.")
log.newCmds(newCmds) log.newCmds(newCmds)
return return
} }
(async () => { (async () => {
try { try {
log.warning('Commands are different, starting deploy.') log.warning("Commands are different, starting deploy.")
log.currentCmds(currentCmds) log.currentCmds(currentCmds)
console.log(`Started refreshing ${commands.length} application (/) commands.`); console.log(`Started refreshing ${commands.length} application (/) commands.`)
const data = await rest.put( const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId), Routes.applicationGuildCommands(clientId, guildId),
{ body: commands }, { body: commands },
); )
log.newCmds(newCmds) log.newCmds(newCmds)
console.log(`Successfully reloaded ${data.length} application (/) commands.`); console.log(`Successfully reloaded ${data.length} application (/) commands.`)
} catch (error) { } catch (error) {
console.error(error); console.error(error)
} }
})() })()
} }

View File

@@ -1,8 +1,8 @@
const { loadButtonEvents } = require('./eventHandlers/button.js') const { loadButtonEvents } = require("./eventHandlers/button.js")
const { loadSlashCommandsEvents } = require('./eventHandlers/command.js') const { loadSlashCommandsEvents } = require("./eventHandlers/command.js")
const { loadContextMenuEvents } = require('./eventHandlers/contextmenu.js') const { loadContextMenuEvents } = require("./eventHandlers/contextmenu.js")
const { loadModalEvents } = require('./eventHandlers/modal.js') const { loadModalEvents } = require("./eventHandlers/modal.js")
const { loadEvents } = require('./eventHandlers/events.js') const { loadEvents } = require("./eventHandlers/events.js")
module.exports = { module.exports = {
loadSlashCommandsEvents, loadSlashCommandsEvents,

View File

@@ -1,42 +1,42 @@
const { Events } = require('discord.js') const { Events } = require("discord.js")
const path = require('path'); const path = require("path")
const fs = require('fs'); const fs = require("fs")
/** @param { import('discord.js').Client } client */ /** @param { import('discord.js').Client } client */
function loadButtonEvents(client) { function loadButtonEvents(client) {
const btnPath = path.join(__dirname, '..', '..', 'events', 'buttons'); const btnPath = path.join(__dirname, "..", "..", "events", "buttons")
const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith('.js')); const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith(".js"))
for (const file of btnFiles) { for (const file of btnFiles) {
const filePath = path.join(btnPath, file); const filePath = path.join(btnPath, file)
const btn = require(filePath); const btn = require(filePath)
if ('name' in btn && 'execute' in btn && btn.type === 'button') { if ("name" in btn && "execute" in btn && btn.type === "button") {
client.events.set(btn.name, btn); client.events.set(btn.name, btn)
} else { } else {
console.log(`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`); console.log(`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`)
} }
} }
client.on(Events.InteractionCreate, async event => { client.on(Events.InteractionCreate, async event => {
if (!event.isButton()) if (!event.isButton())
return; return
const event2 = event.client.events.get(event.customId); const event2 = event.client.events.get(event.customId)
if (!event2) { if (!event2) {
console.error(`No event matching ${event.customId} was found.`); console.error(`No event matching ${event.customId} was found.`)
return; return
} }
try { try {
await event2.execute(event); await event2.execute(event)
} catch (error) { } catch (error) {
console.error(error); console.error(error)
await event.reply({ await event.reply({
content: 'There was an error while executing this event!', content: "There was an error while executing this event!",
ephemeral: true ephemeral: true
}) })
} }

View File

@@ -1,59 +1,59 @@
const { Events } = require('discord.js') const { Events } = require("discord.js")
const path = require('path'); const path = require("path")
const fs = require('fs'); const fs = require("fs")
/** @param { import('discord.js').Client } client */ /** @param { import('discord.js').Client } client */
function loadSlashCommandsEvents(client) { function loadSlashCommandsEvents(client) {
const cmdPath = path.join(__dirname, '..', '..', 'commands'); const cmdPath = path.join(__dirname, "..", "..", "commands")
const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith('.js')); const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith(".js"))
for (const file of cmdFiles) { for (const file of cmdFiles) {
const filePath = path.join(cmdPath, file); const filePath = path.join(cmdPath, file)
const cmd = require(filePath); const cmd = require(filePath)
if ('data' in cmd && 'execute' in cmd && cmd.type === 'slash') { if ("data" in cmd && "execute" in cmd && cmd.type === "slash") {
client.commands.set(cmd.data.name, cmd); client.commands.set(cmd.data.name, cmd)
} else { } else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`); console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`)
} }
} }
//! commands testing //! commands testing
const cmdTestPath = path.join(__dirname, '..', '..', 'commands-testing'); const cmdTestPath = path.join(__dirname, "..", "..", "commands-testing")
const cmdTestFiles = fs.readdirSync(cmdTestPath).filter(file => file.endsWith('.js')); const cmdTestFiles = fs.readdirSync(cmdTestPath).filter(file => file.endsWith(".js"))
for (const file of cmdTestFiles) { for (const file of cmdTestFiles) {
const filePath = path.join(cmdTestPath, file); const filePath = path.join(cmdTestPath, file)
const cmd = require(filePath); const cmd = require(filePath)
if ('data' in cmd && 'execute' in cmd && cmd.type === 'slash') { if ("data" in cmd && "execute" in cmd && cmd.type === "slash") {
client.commands.set(cmd.data.name, cmd); client.commands.set(cmd.data.name, cmd)
} else { } else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`); console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`)
} }
} }
//! command handler //! command handler
client.on(Events.InteractionCreate, async interaction => { client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) if (!interaction.isChatInputCommand())
return; return
const command = interaction.client.commands.get(interaction.commandName); const command = interaction.client.commands.get(interaction.commandName)
if (!command) { if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`); console.error(`No command matching ${interaction.commandName} was found.`)
return; return
} }
try { try {
await command.execute(interaction); await command.execute(interaction)
} catch (error) { } catch (error) {
console.error(error); console.error(error)
await interaction.reply({ await interaction.reply({
content: 'There was an error while executing this command!', content: "There was an error while executing this command!",
ephemeral: true ephemeral: true
}) })
} }

View File

@@ -1,43 +1,43 @@
const { Events } = require('discord.js') const { Events } = require("discord.js")
const path = require('path'); const path = require("path")
const fs = require('fs'); const fs = require("fs")
/** @param { import('discord.js').Client } client */ /** @param { import('discord.js').Client } client */
function loadContextMenuEvents(client) { function loadContextMenuEvents(client) {
const contextMenuPath = path.join(__dirname, '..', '..', 'commands-contextmenu'); const contextMenuPath = path.join(__dirname, "..", "..", "commands-contextmenu")
const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith('.js')); const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith(".js"))
for (const file of contextMenuFiles) { for (const file of contextMenuFiles) {
const filePath = path.join(contextMenuPath, file); const filePath = path.join(contextMenuPath, file)
const cmd = require(filePath); const cmd = require(filePath)
if ('data' in cmd && 'execute' in cmd && cmd.type === 'contextmenu') { if ("data" in cmd && "execute" in cmd && cmd.type === "contextmenu") {
client.commands.set(cmd.data.name, cmd); client.commands.set(cmd.data.name, cmd)
} else { } else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`); console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`)
} }
} }
//! context menu command handler //! context menu command handler
client.on(Events.InteractionCreate, async interaction => { client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isContextMenuCommand()) if (!interaction.isContextMenuCommand())
return; return
const command = interaction.client.commands.get(interaction.commandName); const command = interaction.client.commands.get(interaction.commandName)
if (!command) { if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`); console.error(`No command matching ${interaction.commandName} was found.`)
return; return
} }
try { try {
await command.execute(interaction); await command.execute(interaction)
} catch (error) { } catch (error) {
console.error(error); console.error(error)
await interaction.reply({ await interaction.reply({
content: 'There was an error while executing this command!', content: "There was an error while executing this command!",
ephemeral: true ephemeral: true
}) })
} }

View File

@@ -1,20 +1,20 @@
const path = require('path'); const path = require("path")
const fs = require('fs'); const fs = require("fs")
/** @param { import('discord.js').Client } client */ /** @param { import('discord.js').Client } client */
function loadEvents(client) { function loadEvents(client) {
const serverDir = path.join(__dirname, '..', '..', 'events', 'server') const serverDir = path.join(__dirname, "..", "..", "events", "server")
const eventDirs = fs.readdirSync(serverDir) const eventDirs = fs.readdirSync(serverDir)
for (const eventDir of eventDirs) { for (const eventDir of eventDirs) {
const eventFiles = fs.readdirSync(path.join(serverDir, eventDir)) const eventFiles = fs.readdirSync(path.join(serverDir, eventDir))
for (const eventFile of eventFiles) { for (const eventFile of eventFiles) {
const eventPath = path.join(serverDir, eventDir, eventFile) const eventPath = path.join(serverDir, eventDir, eventFile)
const event = require(eventPath) const event = require(eventPath)
if ('name' in event && 'execute' in event && 'event' in event && event.type === 'event') { if ("name" in event && "execute" in event && "event" in event && event.type === "event") {
client.on(event.event, event.execute) client.on(event.event, event.execute)
} else { } else {
console.log(`[WARNING] The event at ${eventPath} is missing a required "name", "execute", "type" or "event" property.`); console.log(`[WARNING] The event at ${eventPath} is missing a required "name", "execute", "type" or "event" property.`)
} }
} }
} }

View File

@@ -1,22 +1,22 @@
const { Events } = require('discord.js') const { Events } = require("discord.js")
const path = require('path'); const path = require("path")
const fs = require('fs'); const fs = require("fs")
/** @param { import('discord.js').Client } client */ /** @param { import('discord.js').Client } client */
function loadModalEvents(client) { function loadModalEvents(client) {
const modalPath = path.join(__dirname, '..', '..', 'events', 'modals'); const modalPath = path.join(__dirname, "..", "..", "events", "modals")
const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith('.js')); const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith(".js"))
for (const file of modalFiles) { for (const file of modalFiles) {
const filePath = path.join(modalPath, file); const filePath = path.join(modalPath, file)
const modal = require(filePath); const modal = require(filePath)
if ('name' in modal && 'execute' in modal && modal.type === 'modal') { if ("name" in modal && "execute" in modal && modal.type === "modal") {
client.on(Events.InteractionCreate, modal.execute); client.on(Events.InteractionCreate, modal.execute)
} else { } else {
console.log(`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`); console.log(`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`)
} }
} }
} }

View File

@@ -1,10 +1,10 @@
const fetch = require('axios') const fetch = require("axios")
const apikey = process.env.HYPIXELAPIKEY const apikey = process.env.HYPIXELAPIKEY
const mojang = 'https://api.mojang.com/users/profiles/minecraft/' const mojang = "https://api.mojang.com/users/profiles/minecraft/"
const mojanguuid = "https://sessionserver.mojang.com/session/minecraft/profile/" const mojanguuid = "https://sessionserver.mojang.com/session/minecraft/profile/"
const hypixel = 'https://api.hypixel.net/player' const hypixel = "https://api.hypixel.net/player"
const guild = 'https://api.hypixel.net/guild' const guild = "https://api.hypixel.net/guild"
const minotar = 'https://minotar.net/helm/' const minotar = "https://minotar.net/helm/"
async function getUUID(ign) { async function getUUID(ign) {
try { try {

View File

@@ -2,52 +2,52 @@
Code used from the slothpixel project https://github.com/slothpixel/core Code used from the slothpixel project https://github.com/slothpixel/core
*/ */
function getExpForLevel(level) { function getExpForLevel(level) {
if (level == 0) return 0; if (level == 0) return 0
let respectedLevel = getLevelRespectingPrestige(level); let respectedLevel = getLevelRespectingPrestige(level)
if (respectedLevel > EASY_LEVELS) { if (respectedLevel > EASY_LEVELS) {
return 5000; return 5000
} }
switch (respectedLevel) { switch (respectedLevel) {
case 1: case 1:
return 500; return 500
case 2: case 2:
return 1000; return 1000
case 3: case 3:
return 2000; return 2000
case 4: case 4:
return 3500; return 3500
} }
return 5000; return 5000
} }
function getLevelRespectingPrestige(level) { function getLevelRespectingPrestige(level) {
if (level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE) { if (level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE) {
return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE; return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE
} }
else { else {
return level % LEVELS_PER_PRESTIGE; return level % LEVELS_PER_PRESTIGE
} }
} }
const EASY_LEVELS = 4; const EASY_LEVELS = 4
const EASY_LEVELS_XP = 7000; const EASY_LEVELS_XP = 7000
const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP; const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP
const LEVELS_PER_PRESTIGE = 100; const LEVELS_PER_PRESTIGE = 100
const HIGHEST_PRESTIGE = 50; const HIGHEST_PRESTIGE = 50
function bedwarsLevel(exp) { function bedwarsLevel(exp) {
let prestiges = Math.floor(exp / XP_PER_PRESTIGE); let prestiges = Math.floor(exp / XP_PER_PRESTIGE)
let level = prestiges * LEVELS_PER_PRESTIGE; let level = prestiges * LEVELS_PER_PRESTIGE
let expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE); let expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE)
for (let i = 1; i <= EASY_LEVELS; ++i) { for (let i = 1; i <= EASY_LEVELS; ++i) {
let expForEasyLevel = getExpForLevel(i); let expForEasyLevel = getExpForLevel(i)
if (expWithoutPrestiges < expForEasyLevel) { if (expWithoutPrestiges < expForEasyLevel) {
break; break
} }
level++; level++
expWithoutPrestiges -= expForEasyLevel; expWithoutPrestiges -= expForEasyLevel
} }
return level + expWithoutPrestiges / 5000 return level + expWithoutPrestiges / 5000
} }

View File

@@ -18,39 +18,39 @@ function guildLevel(exp) {
2500000, 2500000,
2500000, 2500000,
3000000, 3000000,
]; ]
let level = 0; let level = 0
// Increments by one from zero to the level cap // Increments by one from zero to the level cap
for (let i = 0; i <= 1000; i += 1) { for (let i = 0; i <= 1000; i += 1) {
// need is the required exp to get to the next level // need is the required exp to get to the next level
let need = 0; let need = 0
if (i >= EXP_NEEDED.length) { if (i >= EXP_NEEDED.length) {
need = EXP_NEEDED[EXP_NEEDED.length - 1]; need = EXP_NEEDED[EXP_NEEDED.length - 1]
} else { need = EXP_NEEDED[i]; } } else { need = EXP_NEEDED[i] }
// If the required exp to get to the next level isn't met returns // If the required exp to get to the next level isn't met returns
// the current level plus progress towards the next (unused exp/need) // the current level plus progress towards the next (unused exp/need)
// Otherwise increments the level and substracts the used exp from exp var // Otherwise increments the level and substracts the used exp from exp var
if ((exp - need) < 0) { if ((exp - need) < 0) {
return Math.round((level + (exp / need)) * 100) / 100; return Math.round((level + (exp / need)) * 100) / 100
} }
level += 1; level += 1
exp -= need; exp -= need
} }
// Returns the level cap - currently 1000 // Returns the level cap - currently 1000
// If changed here, also change in for loop above // If changed here, also change in for loop above
return 1000; return 1000
} }
/* /*
Code used from the hypixel-guild-bot project https://github.com/SimplyNo/hypixel-guild-bot Code used from the hypixel-guild-bot project https://github.com/SimplyNo/hypixel-guild-bot
*/ */
function scaledGEXP(input) { function scaledGEXP(input) {
if (input <= 200000) return Number(input); if (input <= 200000) return Number(input)
if (input <= 700000) return Number(Math.round(((input - 200000) / 10) + 200000)); if (input <= 700000) return Number(Math.round(((input - 200000) / 10) + 200000))
if (input > 700000) return Number(Math.round(((input - 700000) / 33) + 250000)); if (input > 700000) return Number(Math.round(((input - 700000) / 33) + 250000))
} }
module.exports = { guildLevel, scaledGEXP } module.exports = { guildLevel, scaledGEXP }

View File

@@ -1,36 +1,36 @@
/* /*
Code used from the slothpixel project https://github.com/slothpixel/core Code used from the slothpixel project https://github.com/slothpixel/core
*/ */
const BASE = 10000; const BASE = 10000
const GROWTH = 2500; const GROWTH = 2500
const HALF_GROWTH = 0.5 * GROWTH; const HALF_GROWTH = 0.5 * GROWTH
const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH; const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH
const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX; const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX
const GROWTH_DIVIDES_2 = 2 / GROWTH; const GROWTH_DIVIDES_2 = 2 / GROWTH
function getLevel(exp) { function getLevel(exp) {
return exp <= 1 ? 1 : Math.floor(1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp)); return exp <= 1 ? 1 : Math.floor(1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp))
} }
function hypixelLevel(exp) { function hypixelLevel(exp) {
return getLevel(exp) + getPercentageToNextLevel(exp); return getLevel(exp) + getPercentageToNextLevel(exp)
} }
function getTotalExpToLevel(level) { function getTotalExpToLevel(level) {
const lv = Math.floor(level); const const lv = Math.floor(level); const
x0 = getTotalExpToFullLevel(lv); x0 = getTotalExpToFullLevel(lv)
if (level === lv) return x0; if (level === lv) return x0
return (getTotalExpToFullLevel(lv + 1) - x0) * (level % 1) + x0; return (getTotalExpToFullLevel(lv + 1) - x0) * (level % 1) + x0
} }
function getTotalExpToFullLevel(level) { function getTotalExpToFullLevel(level) {
return (HALF_GROWTH * (level - 2) + BASE) * (level - 1); return (HALF_GROWTH * (level - 2) + BASE) * (level - 1)
} }
function getPercentageToNextLevel(exp) { function getPercentageToNextLevel(exp) {
const lv = getLevel(exp); const lv = getLevel(exp)
const x0 = getTotalExpToLevel(lv); const x0 = getTotalExpToLevel(lv)
return (exp - x0) / (getTotalExpToLevel(lv + 1) - x0); return (exp - x0) / (getTotalExpToLevel(lv + 1) - x0)
} }

View File

@@ -2,16 +2,16 @@
Code used from the slothpixel project https://github.com/slothpixel/core Code used from the slothpixel project https://github.com/slothpixel/core
*/ */
function skywarsLevel(xp) { function skywarsLevel(xp) {
let xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000]; let xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000]
let exactLevel = 0 let exactLevel = 0
if (xp >= 15000) { if (xp >= 15000) {
exactLevel = (xp - 15000) / 10000 + 12; exactLevel = (xp - 15000) / 10000 + 12
return exactLevel; return exactLevel
} else { } else {
for (i = 0; i < xps.length; i++) { for (i = 0; i < xps.length; i++) {
if (xp < xps[i]) { if (xp < xps[i]) {
exactLevel = i + (xp - xps[i - 1]) / (xps[i] - xps[i - 1]); exactLevel = i + (xp - xps[i - 1]) / (xps[i] - xps[i - 1])
return exactLevel; return exactLevel
} }
} }
} }

View File

@@ -1,5 +1,5 @@
function formatUuid(uuid) { function formatUuid(uuid) {
return uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, '$1-$2-$3-$4-$5') return uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5")
} }
module.exports = { formatUuid } module.exports = { formatUuid }

View File

@@ -1,9 +1,9 @@
const { skywarsLevel } = require('./functions/skywars.js') const { skywarsLevel } = require("./functions/skywars.js")
const { bedwarsLevel } = require('./functions/bedwars.js') const { bedwarsLevel } = require("./functions/bedwars.js")
const { hypixelLevel } = require('./functions/hypixel.js') const { hypixelLevel } = require("./functions/hypixel.js")
const { formatUuid } = require('./functions/uuid.js') const { formatUuid } = require("./functions/uuid.js")
const { guildLevel, scaledGEXP } = require('./functions/guild.js') const { guildLevel, scaledGEXP } = require("./functions/guild.js")
const { getUUID, getIGN, getPlayer, getGuild, getHeadURL } = require('./functions/account.js') const { getUUID, getIGN, getPlayer, getGuild, getHeadURL } = require("./functions/account.js")
module.exports = { module.exports = {
skywarsLevel, skywarsLevel,