From fa3be9473db226e1c33e4ff3894e001939319c20 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 19 Mar 2023 16:51:40 +0100 Subject: [PATCH] Added small patches --- commands/config.js | 4 ++-- commands/update.js | 28 +++++++++++++++++----------- commands/verify.js | 19 ++++++++++--------- config/options.json | 2 +- deploy-commands.js | 2 +- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/commands/config.js b/commands/config.js index 7b35c4e..7e4ad61 100644 --- a/commands/config.js +++ b/commands/config.js @@ -56,7 +56,7 @@ module.exports = { await channel.send({ embeds: [{ title: 'Guild Application', - description: "You can apply for the staff team by clicking the button below.", + description: "You can apply for guild by clicking the button below.", color: embedColor, footer: { text: interaction.guild.name + " | Developed by @Taken#0002", @@ -86,7 +86,7 @@ module.exports = { await channel.send({ embeds: [{ title: 'Staff Application', - description: "You can apply for the guild by clicking the button below.", + description: "You can apply for the staff team by clicking the button below.", color: embedColor, footer: { text: interaction.guild.name + " | Developed by @Taken#0002", diff --git a/commands/update.js b/commands/update.js index ed8d93c..f790cd4 100644 --- a/commands/update.js +++ b/commands/update.js @@ -4,7 +4,7 @@ const fetch = require('axios'); const verify = require('../schemas/verifySchema.js') const mongoose = require('mongoose'); const { color, hypixelGuildID } = require('../config/options.json'); -const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff } = require('../config/roles.json'); +const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json'); module.exports = { name: 'update', @@ -20,6 +20,8 @@ module.exports = { await interaction.deferReply(); + const user1 = interaction.user; + const user = interaction.guild.members.cache.get(user1.id); const verifyData = await verify.findOne({ userID: user.id }) const memberRoles = interaction.member.roles.cache; const roleManage = interaction.member.roles; @@ -29,8 +31,6 @@ module.exports = { return } - const user1 = interaction.options.getUser('user'); - const user = interaction.guild.members.cache.get(user1.id); const slothPixel = "https://api.slothpixel.me/api/players/"; const guildAPI = "https://api.slothpixel.me/api/guilds/" const mojangAPI = "https://api.mojang.com/user/profile/" @@ -46,7 +46,7 @@ module.exports = { const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank; if (guildCheck.data.id !== hypixelGuildID) { - interaction.reply({ + interaction.editReply({ embeds: [{ description: "Updating is only available for members of the guild.", color: embedColor, @@ -63,13 +63,14 @@ module.exports = { } if (guildRank === 'Guild Master') { - await roleManage.remove(gm || manager || moderator || beast || member || trialmember || guildRole || guildStaff) + await roleManage.remove(gm || manager || moderator || beast || member || trialmember || guildRole || guildStaff || defaultMember) await roleManage.add(guildRole) await roleManage.add(guildStaff) await roleManage.add(gm) + await roleManage.add(defaultMember) await verify.findOneAndUpdate({ userID: user.id }) - interaction.reply({ + interaction.editReply({ embeds: [{ description: "Your rank has been updated to `Guild Master`", color: embedColor, @@ -89,9 +90,10 @@ module.exports = { await roleManage.add(guildRole) await roleManage.add(guildStaff) await roleManage.add(manager) + await roleManage.add(defaultMember) await verify.findOneAndUpdate({ userID: user.id }) - interaction.reply({ + interaction.editReply({ embeds: [{ description: "Your rank has been updated to `Manager`", color: embedColor, @@ -111,9 +113,10 @@ module.exports = { await roleManage.add(guildRole) await roleManage.add(guildStaff) await roleManage.add(moderator) + await roleManage.add(defaultMember) await verify.findOneAndUpdate({ userID: user.id }) - interaction.reply({ + interaction.editReply({ embeds: [{ description: "Your rank has been updated to `Moderator`", color: embedColor, @@ -133,9 +136,10 @@ module.exports = { await roleManage.remove(gm || manager || moderator || beast || member || trialmember || guildRole) await roleManage.add(guildRole) await roleManage.add(beast) + await roleManage.add(defaultMember) await verify.findOneAndUpdate({ userID: user.id }) - interaction.reply({ + interaction.editReply({ embeds: [{ description: "Your rank has been updated to `Beast`.", color: embedColor, @@ -155,9 +159,10 @@ module.exports = { await roleManage.remove(gm || manager || moderator || beast || member || trialmember || guildRole) await roleManage.add(guildRole) await roleManage.add(member) + await roleManage.add(defaultMember) await verify.findOneAndUpdate({ userID: user.id }) - interaction.reply({ + interaction.editReply({ embeds: [{ description: "Your rank has been updated to `Member`.", color: embedColor, @@ -177,9 +182,10 @@ module.exports = { await roleManage.remove(gm || manager || moderator || beast || member || trialmember || guildRole) await roleManage.add(guildRole) await roleManage.add(trialmember) + await roleManage.add(defaultMember) await verify.findOneAndUpdate({ userID: user.id }) - interaction.reply({ + interaction.editReply({ embeds: [{ description: "Your rank has been updated to `Trial Member`.", color: embedColor, diff --git a/commands/verify.js b/commands/verify.js index 20b92d9..3305d2c 100644 --- a/commands/verify.js +++ b/commands/verify.js @@ -25,9 +25,10 @@ module.exports = { await interaction.deferReply(); - const user1 = interaction.options.getUser('user'); - const user = interaction.guild.members.cache.get(user1.id); - const fullUsername = user1.username + "#" + user1.discriminator + const user1 = interaction.user; + const user = await interaction.guild.members.fetch(user1.id); + + const fullUsername = user.user.username + "#" + user.user.discriminator const ign = interaction.options.getString('ign'); const mojang = "https://api.mojang.com/users/profiles/minecraft/" const slothPixel = "https://api.slothpixel.me/api/players/"; @@ -46,29 +47,29 @@ module.exports = { const guildRank = GuildMembers.find(member => member.uuid === hypixelCheck.data.uuid).rank; if (!ign) { - interaction.reply('Please provide a player\'s IGN.') + interaction.editReply('Please provide a player\'s IGN.') return } if (!userUUID) { - interaction.reply('That player doesn\'t exist. [Mojang]') + interaction.editReply('That player doesn\'t exist. [Mojang]') return } if (!hypixelCheck.data.uuid) { - interaction.reply('That player doesn\'t exist. [Hypixel]') + interaction.editReply('That player doesn\'t exist. [Hypixel]') return } if (hypixelCheck.data.links.DISCORD !== fullUsername) { - interaction.reply('Your Discord tag does not match your in-game tag.') + interaction.editReply('Your Discord tag does not match your in-game tag.') return } const verifyData = await verify.findOne({ userID: user.id }) if (verifyData) { - interaction.reply('You are already verified.') + interaction.editReply('You are already verified.') return } @@ -115,7 +116,7 @@ module.exports = { await newVerify.save() - await interaction.reply({ + await interaction.editReply({ embeds: [{ title: interaction.guild.name, description: "You have successfully verified `" + fullUsername + "` with the account `" + hypixelCheck.data.username + "`.", diff --git a/config/options.json b/config/options.json index c93f3c5..7879f18 100644 --- a/config/options.json +++ b/config/options.json @@ -1,5 +1,5 @@ { "color": "#eeaadb", - "applicationsCategory": "568796159997509653", + "applicationsChannel": "776705352456470550", "hypixelGuildID": "5a353a170cf2e529044f2935" } \ No newline at end of file diff --git a/deploy-commands.js b/deploy-commands.js index 68c1165..a79741e 100644 --- a/deploy-commands.js +++ b/deploy-commands.js @@ -2,7 +2,7 @@ const { REST, Routes } = require('discord.js'); const { clientId, realguildId, testguildId, token } = require('./config.json'); const fs = require('node:fs'); -const guildId = testguildId; +const guildId = realguildId; const commands = []; // Grab all the command files from the commands directory you created earlier