Compare commits

..

No commits in common. "b3f78a3f257d0b869272ea74b2f22d48013bb6d1" and "6d2668f5cb83ee7d9279d8aad52e23e76516dcbf" have entirely different histories.

10 changed files with 42 additions and 68 deletions

View File

@ -49,20 +49,17 @@ module.exports = {
const beatNum = await getBeatenGameCount(userDatabaseEntry);
const planNum = await getPlanningGameCount(userDatabaseEntry);
const playNum = await getPlayingGameCount(userDatabaseEntry);
const coverUrl = await getCoverURL(game.cover);
const embed = new EmbedBuilder()
.setColor(0xFFD700)
.setAuthor({ name: `${interaction.user.displayName} beat a new game!`, iconURL: interaction.user.avatarURL() })
.setTitle(`${game.name} beaten!`)
.setThumbnail(`${coverUrl}`)
.setDescription(`${interaction.user.displayName} has ${planNum} games planned, they are playing ${playNum} games, they have beaten ${beatNum} games, they have ${100 - beatNum} games remaining.`)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp();
if (game.cover) {
const coverUrl = await getCoverURL(game.cover);
embed.setThumbnail(`${coverUrl}`);
}
await interaction.followUp({ embeds: [embed] });
if (beatNum == 100) {

View File

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

View File

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

View File

@ -33,20 +33,17 @@ module.exports = {
const beatNum = await getBeatenGameCount(userDatabaseEntry);
const planNum = await getPlanningGameCount(userDatabaseEntry);
const playNum = await getPlayingGameCount(userDatabaseEntry);
const coverUrl = await getCoverURL(game.cover);
const embed = new EmbedBuilder()
.setColor(0xFF0000)
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
.setTitle(`${game.name} deleted!`)
.setThumbnail(`${coverUrl}`)
.setDescription(`${interaction.user.displayName} has ${planNum} games planned, they are playing ${playNum} games, they have beaten ${beatNum} games, they have ${100 - beatNum} games remaining.`)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp();
if (game.cover) {
const coverUrl = await getCoverURL(game.cover);
embed.setThumbnail(`${coverUrl}`);
}
return interaction.followUp({ embeds: [embed] });
}

View File

@ -33,20 +33,17 @@ module.exports = {
const beatNum = await getBeatenGameCount(userDatabaseEntry);
const planNum = await getPlanningGameCount(userDatabaseEntry);
const playNum = await getPlayingGameCount(userDatabaseEntry);
const coverUrl = await getCoverURL(game.cover);
const embed = new EmbedBuilder()
.setColor(0xFF0000)
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
.setTitle(`${game.name} deleted!`)
.setThumbnail(`${coverUrl}`)
.setDescription(`${interaction.user.displayName} has ${planNum} games planned, they are playing ${playNum} games, they have beaten ${beatNum} games, they have ${100 - beatNum} games remaining.`)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp();
if (game.cover) {
const coverUrl = await getCoverURL(game.cover);
embed.setThumbnail(`${coverUrl}`);
}
return interaction.followUp({ embeds: [embed] });
}

View File

@ -33,20 +33,17 @@ module.exports = {
const beatNum = await getBeatenGameCount(userDatabaseEntry);
const planNum = await getPlanningGameCount(userDatabaseEntry);
const playNum = await getPlayingGameCount(userDatabaseEntry);
const coverUrl = await getCoverURL(game.cover);
const embed = new EmbedBuilder()
.setColor(0xFF0000)
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
.setTitle(`${game.name} deleted!`)
.setThumbnail(`${coverUrl}`)
.setDescription(`${interaction.user.displayName} has ${planNum} games planned, they are playing ${playNum} games, they have beaten ${beatNum} games, they have ${100 - beatNum} games remaining.`)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp();
if (game.cover) {
const coverUrl = await getCoverURL(game.cover);
embed.setThumbnail(`${coverUrl}`);
}
return interaction.followUp({ embeds: [embed] });
}

View File

@ -43,20 +43,17 @@ module.exports = {
const beatNum = await getBeatenGameCount(userDatabaseEntry);
const planNum = await getPlanningGameCount(userDatabaseEntry);
const playNum = await getPlayingGameCount(userDatabaseEntry);
const coverUrl = await getCoverURL(game.cover);
const embed = new EmbedBuilder()
.setColor(0x43ABEC)
.setAuthor({ name: `${interaction.user.displayName} is planning to beat a game!`, iconURL: interaction.user.avatarURL() })
.setTitle(`${game.name}!`)
.setThumbnail(`${coverUrl}`)
.setDescription(`${interaction.user.displayName} has ${planNum} games planned, they are playing ${playNum} games, they have beaten ${beatNum} games, they have ${100 - beatNum} games remaining.`)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp();
if (game.cover) {
const coverUrl = await getCoverURL(game.cover);
embed.setThumbnail(`${coverUrl}`);
}
await interaction.followUp({ embeds: [embed] });
},
};

View File

@ -21,23 +21,22 @@ module.exports = {
if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true });
const databaseEntries = await getPlanningGames(userDatabaseEntry.id);
if (!databaseEntries || databaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true });
let desc = '';
if (!databaseEntries || databaseEntries.length == 0) {
desc = `${user.displayName} currently has no planned games.`;
} else {
for (let i = 0; i < databaseEntries.length; i++) {
const gameid = await checkGameStorageId(databaseEntries[i].gameId);
const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`);
const game = res[0];
desc = desc.concat('#', (i + 1), ' \t', game.name, '\n');
}
for (let i = 0; i < databaseEntries.length; i++) {
const gameid = await checkGameStorageId(databaseEntries[i].gameId);
const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`);
const game = res[0];
desc = desc.concat('-\t', game.name, '\n');
}
const embed = new EmbedBuilder()
.setColor(0x6441a5)
.setAuthor({ name: `${user.displayName}`, iconURL: user.avatarURL() })
.setTitle(`${user.displayName}'s planned games`)
.setTitle(`${user.displayName}'s planned games to play`)
.setDescription(desc)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp();

View File

@ -1,6 +1,6 @@
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { getCoverURL, getGameJson } = require('../../igdbHelperFunctions.js');
const { getUserRegistration, getRecentBeatenGameEntry, getBeatenGameCount, getPlanningGameCount, getPlayingGameCount } = require('../../databaseHelperFunctions.js');
const { getUserRegistration, getRecentBeatenGameEntry, getBeatenGameCount } = require('../../databaseHelperFunctions.js');
module.exports = {
data: new SlashCommandBuilder()
@ -26,22 +26,17 @@ module.exports = {
if (!res) return interaction.reply({ content: 'No game found.', ephemeral: true });
const game = res[0];
const beatNum = await getBeatenGameCount(userDatabaseEntry);
const planNum = await getPlanningGameCount(userDatabaseEntry);
const playNum = await getPlayingGameCount(userDatabaseEntry);
const coverUrl = await getCoverURL(game.cover);
const num = await getBeatenGameCount(userDatabaseEntry);
const embed = new EmbedBuilder()
.setColor(0xFFD700)
.setAuthor({ name: `${user.displayName}'s most recent beat game!`, iconURL: user.avatarURL() })
.setTitle(game.name)
.setThumbnail(`${coverUrl}`)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp()
.setDescription(`${interaction.user.displayName} has ${planNum} games planned, they are playing ${playNum} games, they have beaten ${beatNum} games, they have ${100 - beatNum} games remaining.`);
if (game.cover) {
const coverUrl = await getCoverURL(game.cover);
embed.setThumbnail(`${coverUrl}`);
}
.setDescription(`${interaction.user.displayName} has beaten ${num} games, they have ${100 - num} games remaining.`);
return interaction.reply({ embeds: [embed] });
},

View File

@ -46,20 +46,17 @@ module.exports = {
const beatNum = await getBeatenGameCount(userDatabaseEntry);
const planNum = await getPlanningGameCount(userDatabaseEntry);
const playNum = await getPlayingGameCount(userDatabaseEntry);
const coverUrl = await getCoverURL(game.cover);
const embed = new EmbedBuilder()
.setColor(0x00C921)
.setAuthor({ name: `${interaction.user.displayName} has started playing a new game!`, iconURL: interaction.user.avatarURL() })
.setTitle(`${game.name}!`)
.setThumbnail(`${coverUrl}`)
.setDescription(`${interaction.user.displayName} has ${planNum} games planned, they are playing ${playNum} games, they have beaten ${beatNum} games, they have ${100 - beatNum} games remaining.`)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp();
if (game.cover) {
const coverUrl = await getCoverURL(game.cover);
embed.setThumbnail(`${coverUrl}`);
}
await interaction.followUp({ embeds: [embed] });
},
};