Compare commits
2 Commits
6d2668f5cb
...
b3f78a3f25
Author | SHA1 | Date |
---|---|---|
baz | b3f78a3f25 | |
baz | fa786d66fe |
|
@ -49,17 +49,20 @@ 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) {
|
||||
|
|
|
@ -21,16 +21,17 @@ 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 = '';
|
||||
|
||||
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');
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
|
|
|
@ -21,16 +21,17 @@ 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 = '';
|
||||
|
||||
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');
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
|
|
|
@ -33,17 +33,20 @@ 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] });
|
||||
}
|
||||
|
||||
|
|
|
@ -33,17 +33,20 @@ 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] });
|
||||
}
|
||||
|
||||
|
|
|
@ -33,17 +33,20 @@ 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] });
|
||||
}
|
||||
|
||||
|
|
|
@ -43,17 +43,20 @@ 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] });
|
||||
},
|
||||
};
|
|
@ -21,22 +21,23 @@ 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 = '';
|
||||
|
||||
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');
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x6441a5)
|
||||
.setAuthor({ name: `${user.displayName}`, iconURL: user.avatarURL() })
|
||||
.setTitle(`${user.displayName}'s planned games to play`)
|
||||
.setTitle(`${user.displayName}'s planned games`)
|
||||
.setDescription(desc)
|
||||
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
|
||||
.setTimestamp();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||
const { getCoverURL, getGameJson } = require('../../igdbHelperFunctions.js');
|
||||
const { getUserRegistration, getRecentBeatenGameEntry, getBeatenGameCount } = require('../../databaseHelperFunctions.js');
|
||||
const { getUserRegistration, getRecentBeatenGameEntry, getBeatenGameCount, getPlanningGameCount, getPlayingGameCount } = require('../../databaseHelperFunctions.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
|
@ -26,17 +26,22 @@ module.exports = {
|
|||
if (!res) return interaction.reply({ content: 'No game found.', ephemeral: true });
|
||||
const game = res[0];
|
||||
|
||||
const coverUrl = await getCoverURL(game.cover);
|
||||
const num = await getBeatenGameCount(userDatabaseEntry);
|
||||
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
||||
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
||||
const playNum = await getPlayingGameCount(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 beaten ${num} games, they have ${100 - num} games remaining.`);
|
||||
.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}`);
|
||||
}
|
||||
|
||||
return interaction.reply({ embeds: [embed] });
|
||||
},
|
||||
|
|
|
@ -46,17 +46,20 @@ 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] });
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue