From 5129ed1c1875873967cfdbae0908b9c40912912a Mon Sep 17 00:00:00 2001 From: baz Date: Thu, 30 Nov 2023 23:46:40 +0000 Subject: [PATCH] Create gameDetails.js --- commands/100-games/gameDetails.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 commands/100-games/gameDetails.js diff --git a/commands/100-games/gameDetails.js b/commands/100-games/gameDetails.js new file mode 100644 index 0000000..f53779e --- /dev/null +++ b/commands/100-games/gameDetails.js @@ -0,0 +1,27 @@ +const { SlashCommandBuilder, EmbedBuilder } = require('discord.js'); + +module.exports = { + data: new SlashCommandBuilder() + .setName('gamedetails') + .setDescription('Get the details of a given game.') + .addStringOption(option => option.setName('gamename').setDescription('The name of the game.')) + .addNumberOption(option => option.setName('gameid').setDescription('The IGDB game id.').setMinValue(0)), + async execute(interaction) { + const gamename = interaction.options.getString('gamename'); + const gameid = interaction.options.getNumber('gameid'); + + if (!gamename && !gameid) return interaction.reply('No gamename or gameid supplied, please supply an option to register a game!'); + + const embed = new EmbedBuilder() + .setColor(0x6441a5); + + + if (gameid) { + embed.setTitle(gameid); + } else if (gamename) { + embed.setTitle(gamename); + } + + return interaction.reply({ embeds: [embed] }); + }, +}; \ No newline at end of file