From 82354dcfea3e99aee40eeadd2ab37d57a9c9168d Mon Sep 17 00:00:00 2001 From: VinceC <33974776+VinceC3@users.noreply.github.com> Date: Sun, 24 Nov 2024 01:27:14 -0600 Subject: [PATCH] Update componentBuilders.js button update --- src/utils/componentBuilders.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/utils/componentBuilders.js b/src/utils/componentBuilders.js index d70993d..1f4d62c 100644 --- a/src/utils/componentBuilders.js +++ b/src/utils/componentBuilders.js @@ -1,20 +1,23 @@ -// src/utils/componentBuilders.js const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); -function createMatchActionRow(matchId) { - return new ActionRowBuilder() - .addComponents( - new ButtonBuilder() - .setLabel('View Match Details') - .setStyle(ButtonStyle.Link) - .setURL(`https://www.vrbattles.gg/matches/${matchId}`), - new ButtonBuilder() - .setLabel('Join VRBattles Discord') - .setStyle(ButtonStyle.Link) - .setURL('https://discord.gg/j3DKVATPGQ') - ); +function createMatchActionRow(gameName) { + // Encode the game name for the URL + const encodedGameName = encodeURIComponent(gameName); + const matchhubUrl = `https://www.vrbattles.gg/games/${encodedGameName}`; + + return new ActionRowBuilder() + .addComponents( + new ButtonBuilder() + .setLabel('View Matchhub') + .setStyle(ButtonStyle.Link) + .setURL(matchhubUrl), + new ButtonBuilder() + .setLabel('Join VRBattles Discord') + .setStyle(ButtonStyle.Link) + .setURL('https://discord.gg/j3DKVATPGQ') + ); } module.exports = { - createMatchActionRow -}; + createMatchActionRow +}; \ No newline at end of file