From 3b34e0c92631443386daf5f78f9543d4de133f9e Mon Sep 17 00:00:00 2001 From: Kath <55346310+Kathund@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:46:09 +0800 Subject: [PATCH 01/14] fix weight in join (#259) --- src/minecraft/handlers/ChatHandler.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/minecraft/handlers/ChatHandler.js b/src/minecraft/handlers/ChatHandler.js index ab4e44d4..6f373ea5 100644 --- a/src/minecraft/handlers/ChatHandler.js +++ b/src/minecraft/handlers/ChatHandler.js @@ -86,7 +86,8 @@ class StateHandler extends eventHandler { const [player, profile] = await Promise.all([hypixel.getPlayer(uuid), getLatestProfile(uuid)]); let meetRequirements = false; - const weight = getWeight(profile.profile, profile.uuid)?.weight?.senither?.total || 0; + const weightData = getWeight(profile.profile, profile.uuid); + const weight = weightData?.senither?.total || 0; const skyblockLevel = (profile.profile?.leveling?.experience || 0) / 100 ?? 0; const bwLevel = player.stats.bedwars.level; From d3e1efba4cf3db6a84ec2204144a89d0293dcdaf Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 5 Aug 2024 19:47:08 +0800 Subject: [PATCH 02/14] Add minister perk and hidden election --- src/minecraft/commands/mayorCommand.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/minecraft/commands/mayorCommand.js b/src/minecraft/commands/mayorCommand.js index 72141835..8248d8e0 100644 --- a/src/minecraft/commands/mayorCommand.js +++ b/src/minecraft/commands/mayorCommand.js @@ -1,4 +1,5 @@ const minecraftCommand = require("../../contracts/minecraftCommand.js"); +const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); const axios = require("axios"); class MayorCommand extends minecraftCommand { @@ -21,19 +22,18 @@ class MayorCommand extends minecraftCommand { throw "Request to Hypixel API failed. Please try again!"; } - if (data.current.candidates.length === 0) { - this.send( - `/gc [MAYOR] ${data.mayor.name} is the current mayor of Skyblock! Perks: ${data.mayor.perks - .map((perk) => perk.name) - .join(", ")}`, - ); - } else { - const currentLeader = data.current.candidates.sort((a, b) => b.votes - a.votes)[0]; - this.send( - `/gc [MAYOR] ${data.mayor.name} is the current mayor of Skyblock! Perks: ${data.mayor.perks - .map((perk) => perk.name) - .join(", ")} | Current Election: ${currentLeader.name}`, - ); + this.send( + `/gc [MAYOR] ${data.mayor.name} is the current mayor of Skyblock! Perks: ${data.mayor.perks + .map((perk) => perk.name) + .join(", ")}, ${data.mayor.minister.perk[0].name}`, + ); + await delay(500); + if (data.current.candidates.length > 0) { + const currentLeader = data.current.candidates.sort((a, b) => (b.votes || 0) - (a.votes || 0))[0]; + if (!currentLeader) return; + const totalVotes = data.current.candidates.reduce((total, candidate) => total + (candidate.votes || 0), 0); + const percentage = ((currentLeader.votes || 0) / totalVotes) * 100; + this.send(`/gc [MAYOR] Current Election: ${currentLeader.name} has ${percentage.toFixed(2)}% of the votes.`); } } catch (error) { this.send(`/gc [ERROR] ${error}`); From a40970a9391cacccaf0392b8d1f8faf271ec35b3 Mon Sep 17 00:00:00 2001 From: Jacob <55346310+Kathund@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:48:37 +0800 Subject: [PATCH 03/14] Fix Updating Guild Status (#261) * Fix Updating Guild Status * Update ChatHandler.js * Update ChatHandler.js --- src/minecraft/handlers/ChatHandler.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/minecraft/handlers/ChatHandler.js b/src/minecraft/handlers/ChatHandler.js index 6f373ea5..1af4668f 100644 --- a/src/minecraft/handlers/ChatHandler.js +++ b/src/minecraft/handlers/ChatHandler.js @@ -3,15 +3,15 @@ const { getLatestProfile } = require("../../../API/functions/getLatestProfile.js const updateRolesCommand = require("../../discord/commands/updateCommand.js"); const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); const hypixel = require("../../contracts/API/HypixelRebornAPI.js"); -const { getUUID, getUsername } = require("../../contracts/API/mowojangAPI.js"); +const { getUUID } = require("../../contracts/API/mowojangAPI.js"); const eventHandler = require("../../contracts/EventHandler.js"); const getWeight = require("../../../API/stats/weight.js"); +const { isUuid } = require("../../../API/utils/uuid.js"); const messages = require("../../../messages.json"); const { EmbedBuilder } = require("discord.js"); const config = require("../../../config.json"); const Logger = require("../../Logger.js"); const { readFileSync } = require("fs"); -const { isUuid } = require("../../../API/utils/uuid.js"); class StateHandler extends eventHandler { constructor(minecraft, command, discord) { @@ -1066,7 +1066,7 @@ class StateHandler extends eventHandler { async updateUser(player) { try { if (isUuid(player) === false) { - player = await getUsername(player); + player = await getUUID(player); } if (config.verification.enabled === false) { @@ -1082,12 +1082,12 @@ class StateHandler extends eventHandler { return; } - const linkedUser = linked.find((user) => user.uuid === player); + const linkedUser = Object.values(linked).find((u) => player) if (linkedUser === undefined) { return; } - const user = await guild.members.fetch(linkedUser.id); + const user = await guild.members.fetch(linkedUser); await updateRolesCommand.execute(null, user); } catch { // From a7d56e718847d9445672282539c6e9deeccd0567 Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 9 Aug 2024 19:28:51 +0800 Subject: [PATCH 04/14] Imgur Url "fix" --- .eslintrc | 3 ++- src/discord/DiscordManager.js | 5 +++++ src/minecraft/commands/auctionHouseCommand.js | 3 ++- src/minecraft/commands/chickenCommand.js | 3 ++- src/minecraft/commands/dinosaurCommand.js | 3 ++- src/minecraft/commands/duckCommand.js | 4 ++-- src/minecraft/commands/kittyCommand.js | 3 ++- src/minecraft/commands/picketCommand.js | 3 ++- src/minecraft/commands/rabbitCommand.js | 4 ++-- src/minecraft/commands/raccoonCommand.js | 3 ++- src/minecraft/commands/renderArmorCommand.js | 3 ++- src/minecraft/commands/renderEquipmentCommand.js | 3 ++- src/minecraft/commands/renderItemsCommand.js | 3 ++- src/minecraft/commands/renderPetCommand.js | 3 ++- 14 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.eslintrc b/.eslintrc index a93ce935..2c0a4d7e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -12,7 +12,8 @@ "globals": { "bot": true, "client": true, - "guild": true + "guild": true, + "imgurUrl": true }, "rules": { "curly": ["warn", "multi-line", "consistent"], diff --git a/src/discord/DiscordManager.js b/src/discord/DiscordManager.js index e25413c8..c246c787 100644 --- a/src/discord/DiscordManager.js +++ b/src/discord/DiscordManager.js @@ -22,6 +22,7 @@ class DiscordManager extends CommunicationBridge { } connect() { + global.imgurUrl = ""; global.client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent], }); @@ -108,6 +109,10 @@ class DiscordManager extends CommunicationBridge { Logger.errorMessage(`Channel ${chat} not found!`); return; } + if (username === bot.username && message.endsWith("Check Discord Bridge for image.")) { + channel.send(imgurUrl); + imgurUrl = ""; + } switch (mode) { case "bot": diff --git a/src/minecraft/commands/auctionHouseCommand.js b/src/minecraft/commands/auctionHouseCommand.js index ada204ae..11730739 100644 --- a/src/minecraft/commands/auctionHouseCommand.js +++ b/src/minecraft/commands/auctionHouseCommand.js @@ -90,7 +90,8 @@ class AuctionHouseCommand extends minecraftCommand { string += string === "" ? upload.data.link : " | " + upload.data.link; } - this.send(`/gc ${`${username}'s Active Auctions: ${string}`}`); + imgurUrl = string; + this.send(`/gc $${username}'s Active Auctions: Check Discord Bridge for image.`); } catch (error) { console.log(error); this.send(`/gc [ERROR] ${error}`); diff --git a/src/minecraft/commands/chickenCommand.js b/src/minecraft/commands/chickenCommand.js index 39c9f49e..433f6843 100644 --- a/src/minecraft/commands/chickenCommand.js +++ b/src/minecraft/commands/chickenCommand.js @@ -25,7 +25,8 @@ class ChickenCommand extends minecraftCommand { throw "An error occured while fetching the image. Please try again later."; } - this.send(`/gc Funny Chicken: ${data.url}`); + imgurUrl = data.url; + this.send('/gc Funny Chicken: Check Discord Bridge for image.'); } catch (error) { this.send(`/gc [ERROR] ${error ?? "Something went wrong.."}`); } diff --git a/src/minecraft/commands/dinosaurCommand.js b/src/minecraft/commands/dinosaurCommand.js index b21507a9..0da5106c 100644 --- a/src/minecraft/commands/dinosaurCommand.js +++ b/src/minecraft/commands/dinosaurCommand.js @@ -25,7 +25,8 @@ class DinosaurCommand extends minecraftCommand { throw "An error occured while fetching the image. Please try again later."; } - this.send(`/gc Funny dino: ${data.url}`); + imgurUrl = data.url; + this.send("/gc Funny dino: Check Discord Bridge for image."); } catch (error) { this.send(`/gc [ERROR] ${error ?? "Something went wrong.."}`); } diff --git a/src/minecraft/commands/duckCommand.js b/src/minecraft/commands/duckCommand.js index 27fc8f6d..c6ec3360 100644 --- a/src/minecraft/commands/duckCommand.js +++ b/src/minecraft/commands/duckCommand.js @@ -24,8 +24,8 @@ class DuckCommand extends minecraftCommand { // eslint-disable-next-line no-throw-literal throw "An error occured while fetching the image. Please try again later."; } - - this.send(`/gc Funny Duck: ${data.url}`); + imgurUrl = data.url; + this.send("/gc Funny Duck: Check Discord Bridge for image."); } catch (error) { this.send(`/gc [ERROR] ${error ?? "Something went wrong.."}`); } diff --git a/src/minecraft/commands/kittyCommand.js b/src/minecraft/commands/kittyCommand.js index ef555e0f..e8ce290d 100644 --- a/src/minecraft/commands/kittyCommand.js +++ b/src/minecraft/commands/kittyCommand.js @@ -24,7 +24,8 @@ class KittyCommand extends minecraftCommand { const link = data[0].url; const upload = await uploadImage(link); - this.send(`/gc Cute Cat: ${upload.data.link}`); + imgurUrl = upload.data.link; + this.send(`/gc Cute Cat: Check Discord Bridge for image.`); } catch (error) { this.send(`/gc [ERROR] ${error ?? "Something went wrong.."}`); } diff --git a/src/minecraft/commands/picketCommand.js b/src/minecraft/commands/picketCommand.js index 960d4612..c912bbe0 100644 --- a/src/minecraft/commands/picketCommand.js +++ b/src/minecraft/commands/picketCommand.js @@ -25,7 +25,8 @@ class PicketCommand extends minecraftCommand { throw "An error occured while fetching the image. Please try again later."; } - this.send(`/gc PICKET!! ${data.url}`); + imgurUrl = data.url; + this.send("/gc PICKET!! Check Discord Bridge for image."); } catch (error) { this.send(`/gc [ERROR] ${error ?? "Something went wrong.."}`); } diff --git a/src/minecraft/commands/rabbitCommand.js b/src/minecraft/commands/rabbitCommand.js index 5514d90c..b12cd6e5 100644 --- a/src/minecraft/commands/rabbitCommand.js +++ b/src/minecraft/commands/rabbitCommand.js @@ -24,8 +24,8 @@ class RabbitCommand extends minecraftCommand { // eslint-disable-next-line no-throw-literal throw "An error occured while fetching the image. Please try again later."; } - - this.send(`/gc Funny rabbit: ${data.url}`); + imgurUrl = data.url; + this.send("/gc Funny rabbit: Check Discord Bridge for image."); } catch (error) { this.send(`/gc [ERROR] ${error ?? "Something went wrong.."}`); } diff --git a/src/minecraft/commands/raccoonCommand.js b/src/minecraft/commands/raccoonCommand.js index 143849ba..c000c8e4 100644 --- a/src/minecraft/commands/raccoonCommand.js +++ b/src/minecraft/commands/raccoonCommand.js @@ -25,7 +25,8 @@ class RaccoonCommand extends minecraftCommand { throw "An error occured while fetching the image. Please try again later."; } - this.send(`/gc Funny Raccoon: ${data.url}`); + imgurUrl = data.url; + this.send("/gc Funny Raccoon: Check Discord Bridge for image."); } catch (error) { this.send(`/gc [ERROR] ${error ?? "Something went wrong.."}`); } diff --git a/src/minecraft/commands/renderArmorCommand.js b/src/minecraft/commands/renderArmorCommand.js index d76a8739..bcc6d35f 100644 --- a/src/minecraft/commands/renderArmorCommand.js +++ b/src/minecraft/commands/renderArmorCommand.js @@ -59,7 +59,8 @@ class ArmorCommand extends minecraftCommand { response += response.split(" | ").length == 4 ? link : `${link} | `; } - this.send(`/gc ${username}'s Armor: ${response}`); + imgurUrl = response; + this.send(`/gc ${username}'s Armor: Check Discord Bridge for image.`); } catch (error) { this.send(`/gc [ERROR] ${error}`); } diff --git a/src/minecraft/commands/renderEquipmentCommand.js b/src/minecraft/commands/renderEquipmentCommand.js index 7186186d..d5e9ad35 100644 --- a/src/minecraft/commands/renderEquipmentCommand.js +++ b/src/minecraft/commands/renderEquipmentCommand.js @@ -54,7 +54,8 @@ class EquipmentCommand extends minecraftCommand { response += response.split(" | ").length == 4 ? link : `${link} | `; } - this.send(`/gc ${username}'s Equipment: ${response}`); + imgurUrl = response; + this.send(`/gc ${username}'s Equipment: Check Discord Bridge for image.`); } catch (error) { this.send(`/gc [ERROR] ${error}`); } diff --git a/src/minecraft/commands/renderItemsCommand.js b/src/minecraft/commands/renderItemsCommand.js index d7907b00..d4cf177c 100644 --- a/src/minecraft/commands/renderItemsCommand.js +++ b/src/minecraft/commands/renderItemsCommand.js @@ -72,7 +72,8 @@ class RenderCommand extends minecraftCommand { const upload = await uploadImage(renderedItem); - this.send(`/gc ${username}'s item at slot ${itemNumber}: ${upload.data.link}`); + imgurUrl = upload.data.link; + this.send(`/gc ${username}'s item at slot ${itemNumber}: Check Discord Bridge for image.`); } catch (error) { console.log(error); this.send(`/gc [ERROR] ${error}`); diff --git a/src/minecraft/commands/renderPetCommand.js b/src/minecraft/commands/renderPetCommand.js index b6df286a..995401af 100644 --- a/src/minecraft/commands/renderPetCommand.js +++ b/src/minecraft/commands/renderPetCommand.js @@ -46,7 +46,8 @@ class RenderCommand extends minecraftCommand { const upload = await uploadImage(renderedItem); - return this.send(`/gc ${username}'s Active Pet: ${upload.data.link ?? "Something went Wrong.."}`); + imgurUrl = upload.data.link ?? "Something went Wrong.."; + return this.send(`/gc ${username}'s Active Pet: Check Discord Bridge for image.`); } catch (error) { console.log(error); this.send(`/gc [ERROR] ${error}`); From 93cd22d74db4677e1f354cab723858da1fdddc9e Mon Sep 17 00:00:00 2001 From: Jacob <55346310+Kathund@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:54:55 +0800 Subject: [PATCH 05/14] Adjust Phrasing of !warpout (#265) --- src/minecraft/commands/warpoutCommand.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/minecraft/commands/warpoutCommand.js b/src/minecraft/commands/warpoutCommand.js index 022596a6..df3d873c 100644 --- a/src/minecraft/commands/warpoutCommand.js +++ b/src/minecraft/commands/warpoutCommand.js @@ -33,24 +33,20 @@ class warpoutCommand extends minecraftCommand { if (message.includes("You cannot invite that player since they're not online.")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; - - this.send(`/gc ${user} is not online!`); + this.send(`/gc ${user} is online!`); } else if (message.includes("You cannot invite that player!")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; - this.send(`/gc ${user} has party requests disabled!`); } else if (message.includes("invited") && message.includes("to the party! They have 60 seconds to accept.")) { - this.send(`/gc Succesfully invited ${user} to the party!`); + this.send(`/gc Partying ${user}...`); } else if (message.includes(" joined the party.")) { - this.send(`/gc ${user} joined the party! Warping them out of the game..`); this.send("/p warp"); } else if (message.includes("warped to your server")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; - this.send(`/gc ${user} warped out of the game! Disbanding party..`); + this.send(`/gc Successfully warped ${user}!`); this.send("/p disband"); - await delay(1500); this.send("\u00a7"); } else if (message.includes(" cannot warp from Limbo")) { @@ -62,7 +58,6 @@ class warpoutCommand extends minecraftCommand { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; this.send(`/gc ${user} is not allowed on my server! Disbanding party..`); - this.send("/p leave"); await delay(1500); this.send("\u00a7"); @@ -70,7 +65,6 @@ class warpoutCommand extends minecraftCommand { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; this.send(`/gc Somehow I'm not allowed to invite players? Disbanding party..`); - this.send("/p disband"); await delay(1500); this.send("\u00a7"); @@ -78,7 +72,6 @@ class warpoutCommand extends minecraftCommand { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; this.send(`/gc Somehow I'm not allowed to disband this party? Leaving party..`); - this.send("/p leave"); await delay(1500); this.send("\u00a7"); @@ -90,18 +83,15 @@ class warpoutCommand extends minecraftCommand { } else if (message.includes("Couldn't find a player with that name!")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; - this.send(`/gc Couldn't find a player with that name!`); this.send("/p disband"); } else if (message.includes("You cannot party yourself!")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; - this.send(`/gc I cannot party yourself!`); } else if (message.includes("didn't warp correctly!")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; - this.send(`/gc ${user} didn't warp correctly! Please try again..`); this.send("/p disband"); } @@ -113,7 +103,7 @@ class warpoutCommand extends minecraftCommand { bot.removeListener("message", warpoutListener); if (this.isOnCooldown === true) { - this.send("/gc Party timed out"); + this.send("/gc Party expired."); this.send("/p disband"); this.send("\u00a7"); From 50b2e277c31230d3f88763b01b41f92192ccf953 Mon Sep 17 00:00:00 2001 From: raaaaaven <168305416+raaaaaven@users.noreply.github.com> Date: Sun, 11 Aug 2024 21:39:54 +0100 Subject: [PATCH 06/14] wording (#267) --- src/discord/commands/blacklistCommand.js | 2 +- src/minecraft/commands/warpoutCommand.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/discord/commands/blacklistCommand.js b/src/discord/commands/blacklistCommand.js index 3e6854b1..ccae4366 100644 --- a/src/discord/commands/blacklistCommand.js +++ b/src/discord/commands/blacklistCommand.js @@ -3,7 +3,7 @@ const { SuccessEmbed } = require("../../contracts/embedHandler.js"); module.exports = { name: "blacklist", - description: "Demotes the given user by one guild rank.", + description: "Ignore add or remove the given user.", moderatorOnly: true, requiresBot: true, options: [ diff --git a/src/minecraft/commands/warpoutCommand.js b/src/minecraft/commands/warpoutCommand.js index df3d873c..c3caf671 100644 --- a/src/minecraft/commands/warpoutCommand.js +++ b/src/minecraft/commands/warpoutCommand.js @@ -33,7 +33,7 @@ class warpoutCommand extends minecraftCommand { if (message.includes("You cannot invite that player since they're not online.")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; - this.send(`/gc ${user} is online!`); + this.send(`/gc ${user} is offline!`); } else if (message.includes("You cannot invite that player!")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; From 02febde897c2c286607110918acc49b132d45046 Mon Sep 17 00:00:00 2001 From: Baltraz Date: Mon, 19 Aug 2024 22:42:06 +0200 Subject: [PATCH 07/14] Update updateCommand.js (#269) Fix never taking the passed in user into account (Fixes forceUpdate and forceLink) --- src/discord/commands/updateCommand.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/discord/commands/updateCommand.js b/src/discord/commands/updateCommand.js index 6957bcc9..4b4bad50 100644 --- a/src/discord/commands/updateCommand.js +++ b/src/discord/commands/updateCommand.js @@ -27,6 +27,7 @@ module.exports = { if (user !== undefined) { interaction.user = user; + interaction.member = await guild.members.fetch(interaction.user.id); } if (!interaction.member) { From b60c14b301395a8764432e3f757582b619e38b1d Mon Sep 17 00:00:00 2001 From: Baltraz Date: Mon, 19 Aug 2024 22:44:22 +0200 Subject: [PATCH 08/14] Update verifyCommand.js (#270) Fix user not being passed into updateCommand causing the executor of the command to be updated. --- src/discord/commands/verifyCommand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/discord/commands/verifyCommand.js b/src/discord/commands/verifyCommand.js index b7eb110a..1bc665ab 100644 --- a/src/discord/commands/verifyCommand.js +++ b/src/discord/commands/verifyCommand.js @@ -92,7 +92,7 @@ module.exports = { throw new HypixelDiscordChatBridgeError("The update command does not exist. Please contact an administrator."); } - await updateRolesCommand.execute(interaction); + await updateRolesCommand.execute(interaction, user); } catch (error) { console.log(error); // eslint-disable-next-line no-ex-assign From 1c1d9a628f8f3c063e3b262ab1d8e4ed875720d5 Mon Sep 17 00:00:00 2001 From: Baltraz Date: Mon, 19 Aug 2024 23:04:16 +0200 Subject: [PATCH 09/14] Update updateCommand.js (#271) Make Role Updates Async to Fix Potential Race Condition --- src/discord/commands/updateCommand.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/discord/commands/updateCommand.js b/src/discord/commands/updateCommand.js index 4b4bad50..1e3a5f6d 100644 --- a/src/discord/commands/updateCommand.js +++ b/src/discord/commands/updateCommand.js @@ -48,7 +48,7 @@ module.exports = { } if (interaction.member.roles.cache.has(role)) { - interaction.member.roles.remove(role, "Updated Roles"); + await interaction.member.roles.remove(role, "Updated Roles"); } } @@ -58,7 +58,7 @@ module.exports = { } if (!interaction.member.roles.cache.has(config.verification.verifiedRole)) { - interaction.member.roles.add(config.verification.verifiedRole, "Updated Roles"); + await interaction.member.roles.add(config.verification.verifiedRole, "Updated Roles"); } const [hypixelGuild, player] = await Promise.all([ @@ -72,29 +72,29 @@ module.exports = { const guildMember = hypixelGuild.members.find((m) => m.uuid === uuid); if (guildMember) { - interaction.member.roles.add(config.verification.guildMemberRole, "Updated Roles"); + await interaction.member.roles.add(config.verification.guildMemberRole, "Updated Roles"); if (config.verification.ranks.length > 0 && guildMember.rank) { const rank = config.verification.ranks.find((r) => r.name.toLowerCase() == guildMember.rank.toLowerCase()); if (rank) { for (const role of config.verification.ranks) { if (interaction.member.roles.cache.has(role.role)) { - interaction.member.roles.remove(role.role, "Updated Roles"); + await interaction.member.roles.remove(role.role, "Updated Roles"); } } - interaction.member.roles.add(rank.role, "Updated Roles"); + await interaction.member.roles.add(rank.role, "Updated Roles"); } } } else { if (interaction.member.roles.cache.has(config.verification.guildMemberRole)) { - interaction.member.roles.remove(config.verification.guildMemberRole, "Updated Roles"); + await interaction.member.roles.remove(config.verification.guildMemberRole, "Updated Roles"); } if (config.verification.ranks.length > 0) { for (const role of config.verification.ranks) { if (interaction.member.roles.cache.has(role.role)) { - interaction.member.roles.remove(role.role, "Updated Roles"); + await interaction.member.roles.remove(role.role, "Updated Roles"); } } } From 4926194c7fb99dd7773a78b9cb827ec029d11bd8 Mon Sep 17 00:00:00 2001 From: Baltraz Date: Sun, 25 Aug 2024 13:42:07 +0200 Subject: [PATCH 10/14] Update verifyCommand.js (#272) Change it so users can have their discord set ingame in either format and linking will work eg. discord = testuser ingame can be set to testUser, TeStUsEr, etc any variation will work --- src/discord/commands/verifyCommand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/discord/commands/verifyCommand.js b/src/discord/commands/verifyCommand.js index 1bc665ab..1025f87c 100644 --- a/src/discord/commands/verifyCommand.js +++ b/src/discord/commands/verifyCommand.js @@ -62,7 +62,7 @@ module.exports = { throw new HypixelDiscordChatBridgeError("This player does not have a Discord linked."); } - if (discordUsername !== interaction.user.username && bypassChecks !== true) { + if (discordUsername != interaction.user.username && bypassChecks !== true) { throw new HypixelDiscordChatBridgeError( `The player '${nickname}' has linked their Discord account to a different account ('${discordUsername}').`, ); From 05c86145c4490099498651a51531a5141c92f0f1 Mon Sep 17 00:00:00 2001 From: Baltraz Date: Wed, 28 Aug 2024 16:39:35 +0200 Subject: [PATCH 11/14] Update verifyCommand.js (#273) change for people not able to link their discord correctly ingame --- src/discord/commands/verifyCommand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/discord/commands/verifyCommand.js b/src/discord/commands/verifyCommand.js index 1025f87c..4adae6e3 100644 --- a/src/discord/commands/verifyCommand.js +++ b/src/discord/commands/verifyCommand.js @@ -62,7 +62,7 @@ module.exports = { throw new HypixelDiscordChatBridgeError("This player does not have a Discord linked."); } - if (discordUsername != interaction.user.username && bypassChecks !== true) { + if (discordUsername?.toLowerCase() != interaction.user.username && bypassChecks !== true) { throw new HypixelDiscordChatBridgeError( `The player '${nickname}' has linked their Discord account to a different account ('${discordUsername}').`, ); From 2afc15cffa3317fe43c055c626f41f783c2cd0e1 Mon Sep 17 00:00:00 2001 From: Baltraz Date: Thu, 5 Sep 2024 11:10:13 +0200 Subject: [PATCH 12/14] Update updateCommand.js (#274) * Update updateCommand.js Fix duel stats not being in place and thus erroring * Update updateCommand.js --- src/discord/commands/updateCommand.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/discord/commands/updateCommand.js b/src/discord/commands/updateCommand.js index 1e3a5f6d..4745aeff 100644 --- a/src/discord/commands/updateCommand.js +++ b/src/discord/commands/updateCommand.js @@ -131,14 +131,14 @@ module.exports = { skywarsWLRatio: player.stats.skywars.WLRatio, skywarsPlayedGames: player.stats.skywars.playedGames, - duelsTitle: player.stats.duels.division, - duelsKills: player.stats.duels.kills, - duelsDeaths: player.stats.duels.deaths, - duelsKDRatio: player.stats.duels.KDRatio, - duelsWins: player.stats.duels.wins, - duelsLosses: player.stats.duels.losses, - duelsWLRatio: player.stats.duels.WLRatio, - duelsPlayedGames: player.stats.duels.playedGames, + duelsTitle: player.stats?.duels?.division || 0, + duelsKills: player.stats?.duels?.kills || 0, + duelsDeaths: player.stats?.duels?.deaths || 0, + duelsKDRatio: player.stats?.duels?.KDRatio || 0, + duelsWins: player.stats?.duels?.wins || 0, + duelsLosses: player.stats?.duels?.losses || 0, + duelsWLRatio: player.stats?.duels?.WLRatio || 0, + duelsPlayedGames: player.stats?.duels?.playedGames || 0, level: player.level, rank: player.rank, From 8020135df72563665565aace68194ed3944d2020 Mon Sep 17 00:00:00 2001 From: jstunk <35247841+jstunk@users.noreply.github.com> Date: Thu, 5 Sep 2024 05:10:45 -0400 Subject: [PATCH 13/14] Update warpoutCommand.js (#275) wording --- src/minecraft/commands/warpoutCommand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/minecraft/commands/warpoutCommand.js b/src/minecraft/commands/warpoutCommand.js index c3caf671..db1c7ec0 100644 --- a/src/minecraft/commands/warpoutCommand.js +++ b/src/minecraft/commands/warpoutCommand.js @@ -88,7 +88,7 @@ class warpoutCommand extends minecraftCommand { } else if (message.includes("You cannot party yourself!")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; - this.send(`/gc I cannot party yourself!`); + this.send(`/gc I cannot party myself!`); } else if (message.includes("didn't warp correctly!")) { bot.removeListener("message", warpoutListener); this.isOnCooldown = false; From 29e833b57e66ea02fa48da94d5314546568331b7 Mon Sep 17 00:00:00 2001 From: Baltraz Date: Thu, 5 Sep 2024 20:01:28 +0200 Subject: [PATCH 14/14] Update mayorCommand.js (#276) --- src/minecraft/commands/mayorCommand.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/minecraft/commands/mayorCommand.js b/src/minecraft/commands/mayorCommand.js index 8248d8e0..046e8cf8 100644 --- a/src/minecraft/commands/mayorCommand.js +++ b/src/minecraft/commands/mayorCommand.js @@ -25,13 +25,13 @@ class MayorCommand extends minecraftCommand { this.send( `/gc [MAYOR] ${data.mayor.name} is the current mayor of Skyblock! Perks: ${data.mayor.perks .map((perk) => perk.name) - .join(", ")}, ${data.mayor.minister.perk[0].name}`, + .join(", ")}, Minister Perk: ${data.mayor.minister.perk.name}`, ); await delay(500); - if (data.current.candidates.length > 0) { - const currentLeader = data.current.candidates.sort((a, b) => (b.votes || 0) - (a.votes || 0))[0]; + if (data.mayor.election.candidates.length > 0) { + const currentLeader = data.mayor.election.candidates.sort((a, b) => (b.votes || 0) - (a.votes || 0))[0]; if (!currentLeader) return; - const totalVotes = data.current.candidates.reduce((total, candidate) => total + (candidate.votes || 0), 0); + const totalVotes = data.mayor.election.candidates.reduce((total, candidate) => total + (candidate.votes || 0), 0); const percentage = ((currentLeader.votes || 0) / totalVotes) * 100; this.send(`/gc [MAYOR] Current Election: ${currentLeader.name} has ${percentage.toFixed(2)}% of the votes.`); }