Compare commits

..

2 Commits

Author SHA1 Message Date
baz cf7939a815 Fix time out 2023-12-31 23:30:06 +00:00
baz 5b5a8d914d Fix time out 2023-12-31 23:29:08 +00:00
2 changed files with 8 additions and 6 deletions

View File

@ -8,6 +8,8 @@ module.exports = {
.setDescription('Show the list of games you have beaten.') .setDescription('Show the list of games you have beaten.')
.addUserOption(option => option.setName('user').setDescription('The user to check')), .addUserOption(option => option.setName('user').setDescription('The user to check')),
async execute(interaction) { async execute(interaction) {
await interaction.reply({ content: 'Searching for user...', ephemeral: true });
let user = interaction.user; let user = interaction.user;
const userOption = interaction.options.getUser('user'); const userOption = interaction.options.getUser('user');
@ -16,9 +18,7 @@ module.exports = {
} }
const userDatabaseEntry = await getUserRegistration(user); const userDatabaseEntry = await getUserRegistration(user);
if (!userDatabaseEntry) return interaction.reply({ content: `Issue checking registration with "${user.username}".`, ephemeral: true }); if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true });
await interaction.reply({ content: `Searching for ${user.username}...`, ephemeral: true });
const beatenGamesDatabaseEntries = await getGames(userDatabaseEntry.id); const beatenGamesDatabaseEntries = await getGames(userDatabaseEntry.id);
if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true }); if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true });

View File

@ -8,6 +8,8 @@ module.exports = {
.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('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) {
await interaction.reply({ content: 'Searching for user...', ephemeral: true });
const beatGameNumber = interaction.options.getNumber('beatgamenumber'); const beatGameNumber = interaction.options.getNumber('beatgamenumber');
const userDatabaseEntry = await getUserRegistration(interaction.user); const userDatabaseEntry = await getUserRegistration(interaction.user);
@ -25,7 +27,7 @@ module.exports = {
const gameDatabaseEntry = await checkGameStorageId(result.gameId); const gameDatabaseEntry = await checkGameStorageId(result.gameId);
const body = `where id = ${ gameDatabaseEntry.igdb_id }; fields *;`; const body = `where id = ${ gameDatabaseEntry.igdb_id }; fields *;`;
const res = await getGameJson(body); const res = await getGameJson(body);
if (!res) return interaction.reply({ content: 'No game found.', ephemeral: true }); if (!res) return interaction.followUp({ content: 'No game found.', ephemeral: true });
const game = res[0]; const game = res[0];
const num = await getBeatenGameCount(userDatabaseEntry); const num = await getBeatenGameCount(userDatabaseEntry);
@ -40,9 +42,9 @@ module.exports = {
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() }) .setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp(); .setTimestamp();
return interaction.reply({ embeds: [embed] }); return interaction.followUp({ embeds: [embed] });
} }
return interaction.reply({ content: 'Unable to delete entry / No entry found.', ephemeral: true }); return interaction.followUp({ content: 'Unable to delete entry / No entry found.', ephemeral: true });
}, },
}; };