Compare commits
	
		
			No commits in common. "13b08256276daa0bd5fdb075b224a079b60d6dd3" and "9bc73d263035097169615c9448323dd9cff353cc" have entirely different histories.
		
	
	
		
			13b0825627
			...
			9bc73d2630
		
	
		
| @ -1,23 +1,25 @@ | |||||||
| const { SlashCommandBuilder } = require('discord.js'); | const { SlashCommandBuilder } = require('discord.js'); | ||||||
| const { getUserRegistration, deleteBeatenGameNum, checkGameStorageId } = require('../../databaseHelperFunctions.js'); | const { deleteBeatenGameId, getUserRegistration, deleteBeatenGameNum, checkGameStorageId } = require('../../databaseHelperFunctions.js'); | ||||||
| 
 | 
 | ||||||
| module.exports = { | module.exports = { | ||||||
|     data: new SlashCommandBuilder() |     data: new SlashCommandBuilder() | ||||||
|         .setName('deletegame') |         .setName('deletegameentry') | ||||||
|         .setDescription('Delete a game that you have beaten from the 100 game challenge!') |         .setDescription('Delete a game that you have beaten from the 100 game challenge!') | ||||||
|  |         .addNumberOption(option => option.setName('databaseentryid').setDescription('The beat game id.').setMinValue(1)) | ||||||
|         .addNumberOption(option => option.setName('beatgamenumber').setDescription('Index of the game to delete in the list of beaten games.').setMinValue(1).setMaxValue(100)), |         .addNumberOption(option => option.setName('beatgamenumber').setDescription('Index of the game to delete in the list of beaten games.').setMinValue(1).setMaxValue(100)), | ||||||
|     async execute(interaction) { |     async execute(interaction) { | ||||||
|  |         const databaseEntryId = interaction.options.getNumber('databaseentryid'); | ||||||
|         const beatGameNumber = interaction.options.getNumber('beatgamenumber'); |         const beatGameNumber = interaction.options.getNumber('beatgamenumber'); | ||||||
| 
 | 
 | ||||||
|  |         if (!databaseEntryId && !beatGameNumber) return interaction.reply({ content: 'No parameters supplied.', ephemeral: true }); | ||||||
|  | 
 | ||||||
|         const userDatabaseEntry = await getUserRegistration(interaction.user); |         const userDatabaseEntry = await getUserRegistration(interaction.user); | ||||||
|         let result; |         let result; | ||||||
| 
 |         if (databaseEntryId) { | ||||||
|         if (beatGameNumber) { |             result = await deleteBeatenGameId(databaseEntryId, userDatabaseEntry); | ||||||
|  |         } else if (beatGameNumber) { | ||||||
|             result = await deleteBeatenGameNum(beatGameNumber, userDatabaseEntry); |             result = await deleteBeatenGameNum(beatGameNumber, userDatabaseEntry); | ||||||
|         } |         } | ||||||
|         else { |  | ||||||
|             // TODO: Delete most recent game entry.
 |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         if (result) { |         if (result) { | ||||||
|             const game = await checkGameStorageId(result.gameId); |             const game = await checkGameStorageId(result.gameId); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user