From e5df703c265e27be58198e6f6b62f6806b75842b Mon Sep 17 00:00:00 2001 From: baz Date: Sat, 18 Nov 2023 00:35:28 +0000 Subject: [PATCH] Create beatGame command --- commands/100-games/beatGame.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 commands/100-games/beatGame.js diff --git a/commands/100-games/beatGame.js b/commands/100-games/beatGame.js new file mode 100644 index 0000000..fdcfcd1 --- /dev/null +++ b/commands/100-games/beatGame.js @@ -0,0 +1,19 @@ +const { SlashCommandBuilder } = require('discord.js'); + +module.exports = { + data: new SlashCommandBuilder() + .setName('beatgame') + .setDescription('Log a game that you have beat towards the 100 game challenge!') + .addStringOption(option => option.setName('gamename').setDescription('The name of the game.')) + .addNumberOption(option => option.setName('gameid').setDescription('The IGDB game id.')) + .addStringOption(option => option.setName('datestarted').setDescription('The date you started playing the game (today if empty).')) + .addStringOption(option => option.setName('datebeaten').setDescription('The date you beat the game (today if empty).')), + 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!'); + if (gameid) return interaction.reply(`Game ID "${gameid}" has been beaten, Game logged!`); + return interaction.reply(`Game "${gamename}" has been beaten, Game logged!`); + }, +}; \ No newline at end of file