Change list outputs to use embed instead

This commit is contained in:
baz 2024-02-14 19:17:02 +00:00
parent fa786d66fe
commit b3f78a3f25
3 changed files with 27 additions and 24 deletions

View File

@ -21,16 +21,17 @@ module.exports = {
if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true }); if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true });
const beatenGamesDatabaseEntries = await getBeatenGames(userDatabaseEntry.id); const beatenGamesDatabaseEntries = await getBeatenGames(userDatabaseEntry.id);
if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true });
let desc = ''; let desc = '';
for (let i = 0; i < beatenGamesDatabaseEntries.length; i++) { if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) {
const gameid = await checkGameStorageId(beatenGamesDatabaseEntries[i].gameId); desc = `${user.displayName} has not beaten any games yet.`;
const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); } else {
const game = res[0]; for (let i = 0; i < beatenGamesDatabaseEntries.length; i++) {
const gameid = await checkGameStorageId(beatenGamesDatabaseEntries[i].gameId);
desc = desc.concat('#', (i + 1), ' \t', game.name, '\n'); const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`);
const game = res[0];
desc = desc.concat('#', (i + 1), ' \t', game.name, '\n');
}
} }
const embed = new EmbedBuilder() const embed = new EmbedBuilder()

View File

@ -21,16 +21,17 @@ module.exports = {
if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true }); if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true });
const databaseEntries = await getPlayingGames(userDatabaseEntry.id); const databaseEntries = await getPlayingGames(userDatabaseEntry.id);
if (!databaseEntries || databaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true });
let desc = ''; let desc = '';
for (let i = 0; i < databaseEntries.length; i++) { if (!databaseEntries || databaseEntries.length == 0) {
const gameid = await checkGameStorageId(databaseEntries[i].gameId); desc = `${user.displayName} is currently playing no games.`;
const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); } else {
const game = res[0]; for (let i = 0; i < databaseEntries.length; i++) {
const gameid = await checkGameStorageId(databaseEntries[i].gameId);
desc = desc.concat('-\t', game.name, '\n'); const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`);
const game = res[0];
desc = desc.concat('#', (i + 1), ' \t', game.name, '\n');
}
} }
const embed = new EmbedBuilder() const embed = new EmbedBuilder()

View File

@ -21,16 +21,17 @@ module.exports = {
if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true }); if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true });
const databaseEntries = await getPlanningGames(userDatabaseEntry.id); const databaseEntries = await getPlanningGames(userDatabaseEntry.id);
if (!databaseEntries || databaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true });
let desc = ''; let desc = '';
for (let i = 0; i < databaseEntries.length; i++) { if (!databaseEntries || databaseEntries.length == 0) {
const gameid = await checkGameStorageId(databaseEntries[i].gameId); desc = `${user.displayName} currently has no planned games.`;
const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); } else {
const game = res[0]; for (let i = 0; i < databaseEntries.length; i++) {
const gameid = await checkGameStorageId(databaseEntries[i].gameId);
desc = desc.concat('-\t', game.name, '\n'); const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`);
const game = res[0];
desc = desc.concat('#', (i + 1), ' \t', game.name, '\n');
}
} }
const embed = new EmbedBuilder() const embed = new EmbedBuilder()