Make responses ephemeral
This commit is contained in:
parent
b2adab3ec8
commit
c039f3e2e4
|
@ -12,12 +12,12 @@ module.exports = {
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
|
|
||||||
const userDatabaseEntry = await getUserRegistration(interaction.user);
|
const userDatabaseEntry = await getUserRegistration(interaction.user);
|
||||||
if (!userDatabaseEntry) return interaction.reply(`Issue checking registration with "${interaction.user.username}".`);
|
if (!userDatabaseEntry) return interaction.reply({ content: `Issue checking registration with "${interaction.user.username}".`, ephemeral: true });
|
||||||
|
|
||||||
const gamename = interaction.options.getString('gamename');
|
const gamename = interaction.options.getString('gamename');
|
||||||
const gameid = interaction.options.getNumber('gameid');
|
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 (!gamename && !gameid) return interaction.reply({ content: 'No gamename or gameid supplied, please supply an option to register a game!', ephemeral: true });
|
||||||
|
|
||||||
let body = '';
|
let body = '';
|
||||||
|
|
||||||
|
@ -32,15 +32,15 @@ module.exports = {
|
||||||
|
|
||||||
const res = await getGameJson(body);
|
const res = await getGameJson(body);
|
||||||
|
|
||||||
if (!res[0]) return interaction.reply('No game found for the options supplied.');
|
if (!res[0]) return interaction.reply({ content: 'No game found for the options supplied.', ephemeral: true});
|
||||||
|
|
||||||
const game = res[0];
|
const game = res[0];
|
||||||
const release_date = game.first_release_date;
|
const release_date = game.first_release_date;
|
||||||
if (!release_date || (release_date * 1000) > Date.now()) return interaction.reply(`${game.name} is not yet released.`);
|
if (!release_date || (release_date * 1000) > Date.now()) return interaction.reply({ content: `${game.name} is not yet released.`, ephemeral: true });
|
||||||
|
|
||||||
const gameDatabaseEntry = await checkGameStorage(game);
|
const gameDatabaseEntry = await checkGameStorage(game);
|
||||||
|
|
||||||
if (!(await createBeatenGameEntry(userDatabaseEntry, gameDatabaseEntry))) return interaction.reply(`${game.name} already beaten.`);
|
if (!(await createBeatenGameEntry(userDatabaseEntry, gameDatabaseEntry))) return interaction.reply({ content: `${game.name} already beaten.`, ephemeral: true });
|
||||||
|
|
||||||
const num = await getBeatenGameCount(userDatabaseEntry);
|
const num = await getBeatenGameCount(userDatabaseEntry);
|
||||||
const coverUrl = await getCoverURL(game.cover);
|
const coverUrl = await getCoverURL(game.cover);
|
||||||
|
|
|
@ -11,7 +11,7 @@ module.exports = {
|
||||||
const databaseEntryId = interaction.options.getNumber('databaseentryid');
|
const databaseEntryId = interaction.options.getNumber('databaseentryid');
|
||||||
const beatGameNumber = interaction.options.getNumber('beatgamenumber');
|
const beatGameNumber = interaction.options.getNumber('beatgamenumber');
|
||||||
|
|
||||||
if (!databaseEntryId && !beatGameNumber) return interaction.reply('No parameters supplied');
|
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;
|
||||||
|
@ -26,6 +26,6 @@ module.exports = {
|
||||||
return interaction.reply(`${game.name} successfully deleted`);
|
return interaction.reply(`${game.name} successfully deleted`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return interaction.reply('Unable to delete entry / No entry found.');
|
return interaction.reply({ content: 'Unable to delete entry / No entry found.', ephemeral: true });
|
||||||
},
|
},
|
||||||
};
|
};
|
|
@ -12,7 +12,7 @@ module.exports = {
|
||||||
const gamename = interaction.options.getString('gamename');
|
const gamename = interaction.options.getString('gamename');
|
||||||
const gameid = interaction.options.getNumber('gameid');
|
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 (!gamename && !gameid) return interaction.reply({ content: 'No gamename or gameid supplied, please supply an option to register a game!', ephemeral: true });
|
||||||
|
|
||||||
let body = '';
|
let body = '';
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ module.exports = {
|
||||||
|
|
||||||
const games = await getGameJson(body);
|
const games = await getGameJson(body);
|
||||||
|
|
||||||
if (!games[0]) return interaction.followUp('No game found.');
|
if (!games[0]) return interaction.followUp({ content: 'No game found.', ephemeral: true });
|
||||||
|
|
||||||
await games.sort((a, b) => parseInt(b.total_rating_count) - parseInt(a.total_rating_count));
|
await games.sort((a, b) => parseInt(b.total_rating_count) - parseInt(a.total_rating_count));
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const leaderboard = await getLeaderboardEntries();
|
const leaderboard = await getLeaderboardEntries();
|
||||||
|
|
||||||
if (!leaderboard) return interaction.reply('There was a problem!');
|
if (!leaderboard) return interaction.reply({ content: 'There was a problem!', ephemeral: true });
|
||||||
|
|
||||||
await leaderboard.sort((a, b) => parseInt(b.count) - parseInt(a.count));
|
await leaderboard.sort((a, b) => parseInt(b.count) - parseInt(a.count));
|
||||||
let desc = '';
|
let desc = '';
|
||||||
|
|
|
@ -9,13 +9,13 @@ module.exports = {
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const gamename = interaction.options.getString('gamename');
|
const gamename = interaction.options.getString('gamename');
|
||||||
await interaction.reply(`Searching for ${gamename}...`);
|
await interaction.reply({ content: `Searching for ${gamename}...`, ephemeral: true });
|
||||||
|
|
||||||
let games = await searchGamesWithMinimumReview(gamename);
|
let games = await searchGamesWithMinimumReview(gamename);
|
||||||
|
|
||||||
if (games.length == 0) games = await searchGamesWithoutMinimumReview(gamename);
|
if (games.length == 0) games = await searchGamesWithoutMinimumReview(gamename);
|
||||||
|
|
||||||
if (games.length == 0) return interaction.followUp('No games found.');
|
if (games.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true });
|
||||||
|
|
||||||
await games.sort((a, b) => parseInt(b.total_rating_count) - parseInt(a.total_rating_count));
|
await games.sort((a, b) => parseInt(b.total_rating_count) - parseInt(a.total_rating_count));
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const { SlashCommandBuilder } = require('discord.js');
|
const { SlashCommandBuilder } = require('discord.js');
|
||||||
const { checkUserRegistration } = require('../../databaseHelperFunctions.js');
|
const { getUserRegistration } = require('../../databaseHelperFunctions.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
@ -10,8 +10,8 @@ module.exports = {
|
||||||
// interaction.user is the object representing the user who ran the command
|
// interaction.user is the object representing the user who ran the command
|
||||||
// interaction.member is the GuildMember object, which represents the user in the specific guild
|
// interaction.member is the GuildMember object, which represents the user in the specific guild
|
||||||
|
|
||||||
if (checkUserRegistration(interaction.user)) return interaction.reply(`User "${interaction.user.username}" is registered`);
|
if (getUserRegistration(interaction.user)) return interaction.reply(`User "${interaction.user.username}" is registered`);
|
||||||
|
|
||||||
return interaction.reply(`Issue checking registration with "${interaction.user.username}".`);
|
return interaction.reply({ content: `Issue checking registration with "${interaction.user.username}".`, ephemeral: true });
|
||||||
},
|
},
|
||||||
};
|
};
|
Loading…
Reference in New Issue