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 beatNum = await getBeatenGameCount(userDatabaseEntry);
|
||||||
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
||||||
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
||||||
const coverUrl = await getCoverURL(game.cover);
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(0xFFD700)
|
.setColor(0xFFD700)
|
||||||
.setAuthor({ name: `${interaction.user.displayName} beat a new game!`, iconURL: interaction.user.avatarURL() })
|
.setAuthor({ name: `${interaction.user.displayName} beat a new game!`, iconURL: interaction.user.avatarURL() })
|
||||||
.setTitle(`${game.name} beaten!`)
|
.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.`)
|
.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() })
|
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
if (game.cover) {
|
||||||
|
const coverUrl = await getCoverURL(game.cover);
|
||||||
|
embed.setThumbnail(`${coverUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.followUp({ embeds: [embed] });
|
await interaction.followUp({ embeds: [embed] });
|
||||||
|
|
||||||
if (beatNum == 100) {
|
if (beatNum == 100) {
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -33,17 +33,20 @@ module.exports = {
|
||||||
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
||||||
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
||||||
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
||||||
const coverUrl = await getCoverURL(game.cover);
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(0xFF0000)
|
.setColor(0xFF0000)
|
||||||
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
|
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
|
||||||
.setTitle(`${game.name} deleted!`)
|
.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.`)
|
.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() })
|
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
if (game.cover) {
|
||||||
|
const coverUrl = await getCoverURL(game.cover);
|
||||||
|
embed.setThumbnail(`${coverUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
return interaction.followUp({ embeds: [embed] });
|
return interaction.followUp({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,17 +33,20 @@ module.exports = {
|
||||||
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
||||||
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
||||||
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
||||||
const coverUrl = await getCoverURL(game.cover);
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(0xFF0000)
|
.setColor(0xFF0000)
|
||||||
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
|
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
|
||||||
.setTitle(`${game.name} deleted!`)
|
.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.`)
|
.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() })
|
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
if (game.cover) {
|
||||||
|
const coverUrl = await getCoverURL(game.cover);
|
||||||
|
embed.setThumbnail(`${coverUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
return interaction.followUp({ embeds: [embed] });
|
return interaction.followUp({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,17 +33,20 @@ module.exports = {
|
||||||
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
||||||
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
||||||
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
||||||
const coverUrl = await getCoverURL(game.cover);
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(0xFF0000)
|
.setColor(0xFF0000)
|
||||||
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
|
.setAuthor({ name: `${interaction.user.displayName} deleted a game!`, iconURL: interaction.user.avatarURL() })
|
||||||
.setTitle(`${game.name} deleted!`)
|
.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.`)
|
.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() })
|
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
if (game.cover) {
|
||||||
|
const coverUrl = await getCoverURL(game.cover);
|
||||||
|
embed.setThumbnail(`${coverUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
return interaction.followUp({ embeds: [embed] });
|
return interaction.followUp({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,17 +43,20 @@ module.exports = {
|
||||||
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
||||||
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
||||||
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
||||||
const coverUrl = await getCoverURL(game.cover);
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(0x43ABEC)
|
.setColor(0x43ABEC)
|
||||||
.setAuthor({ name: `${interaction.user.displayName} is planning to beat a game!`, iconURL: interaction.user.avatarURL() })
|
.setAuthor({ name: `${interaction.user.displayName} is planning to beat a game!`, iconURL: interaction.user.avatarURL() })
|
||||||
.setTitle(`${game.name}!`)
|
.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.`)
|
.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() })
|
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
if (game.cover) {
|
||||||
|
const coverUrl = await getCoverURL(game.cover);
|
||||||
|
embed.setThumbnail(`${coverUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.followUp({ embeds: [embed] });
|
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 });
|
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()
|
||||||
.setColor(0x6441a5)
|
.setColor(0x6441a5)
|
||||||
.setAuthor({ name: `${user.displayName}`, iconURL: user.avatarURL() })
|
.setAuthor({ name: `${user.displayName}`, iconURL: user.avatarURL() })
|
||||||
.setTitle(`${user.displayName}'s planned games to play`)
|
.setTitle(`${user.displayName}'s planned games`)
|
||||||
.setDescription(desc)
|
.setDescription(desc)
|
||||||
.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();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
const { getCoverURL, getGameJson } = require('../../igdbHelperFunctions.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 = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
@ -26,17 +26,22 @@ module.exports = {
|
||||||
if (!res) return interaction.reply({ content: 'No game found.', ephemeral: true });
|
if (!res) return interaction.reply({ content: 'No game found.', ephemeral: true });
|
||||||
const game = res[0];
|
const game = res[0];
|
||||||
|
|
||||||
const coverUrl = await getCoverURL(game.cover);
|
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
||||||
const num = await getBeatenGameCount(userDatabaseEntry);
|
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
||||||
|
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(0xFFD700)
|
.setColor(0xFFD700)
|
||||||
.setAuthor({ name: `${user.displayName}'s most recent beat game!`, iconURL: user.avatarURL() })
|
.setAuthor({ name: `${user.displayName}'s most recent beat game!`, iconURL: user.avatarURL() })
|
||||||
.setTitle(game.name)
|
.setTitle(game.name)
|
||||||
.setThumbnail(`${coverUrl}`)
|
|
||||||
.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()
|
||||||
.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] });
|
return interaction.reply({ embeds: [embed] });
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,17 +46,20 @@ module.exports = {
|
||||||
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
const beatNum = await getBeatenGameCount(userDatabaseEntry);
|
||||||
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
const planNum = await getPlanningGameCount(userDatabaseEntry);
|
||||||
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
const playNum = await getPlayingGameCount(userDatabaseEntry);
|
||||||
const coverUrl = await getCoverURL(game.cover);
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(0x00C921)
|
.setColor(0x00C921)
|
||||||
.setAuthor({ name: `${interaction.user.displayName} has started playing a new game!`, iconURL: interaction.user.avatarURL() })
|
.setAuthor({ name: `${interaction.user.displayName} has started playing a new game!`, iconURL: interaction.user.avatarURL() })
|
||||||
.setTitle(`${game.name}!`)
|
.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.`)
|
.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() })
|
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
if (game.cover) {
|
||||||
|
const coverUrl = await getCoverURL(game.cover);
|
||||||
|
embed.setThumbnail(`${coverUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.followUp({ embeds: [embed] });
|
await interaction.followUp({ embeds: [embed] });
|
||||||
},
|
},
|
||||||
};
|
};
|
Loading…
Reference in New Issue