Skip to content

Commit

Permalink
Merge pull request #88 from Jesmaster/release-v2.1.5
Browse files Browse the repository at this point in the history
Release v2.1.5
  • Loading branch information
Jesmaster authored Nov 25, 2022
2 parents 6bdb5b3 + fcd3edc commit f110881
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions commands/bgg-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = {
.setTitle(username + '\'s collection')
.setURL(collection_url)
.setDescription(collection_url)
.setAuthor({ name: user.username, url: user.avatarURL(), iconURL: user.displayAvatarURL() })
.setAuthor(user ? { name: user.username, url: user.avatarURL(), iconURL: user.displayAvatarURL() } : null)
.addFields(
{
name: 'Total',
Expand Down Expand Up @@ -176,7 +176,7 @@ module.exports = {
}

if (isObject && !hasErrors && result.items['$'].totalitems > 0) {
interaction.editReply({ embeds: [this.collectionToEmbed(result, username, interaction.member.user)] });
interaction.editReply({ embeds: [this.collectionToEmbed(result, username, interaction?.member?.user)] });
}
else {
interaction.editReply(`No results found for "${username}".`);
Expand Down
12 changes: 6 additions & 6 deletions commands/bgg-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
value: 'suggest',
})
),
cache_ttl: 1000 * 60 * 60 * 24,
cache_ttl: 1000 * 60 * 60 * 24 * 7,
/**
* Preforms BGG API search call.
* @return {Promise<JSON>}
Expand Down Expand Up @@ -165,7 +165,7 @@ module.exports = {
.setURL(`https://boardgamegeek.com/${item['$'].type}/${item['$'].id}`)
.setThumbnail(item.thumbnail[0])
.setDescription(he.decode(item.description[0]).substring(0, 200)+'...')
.setAuthor({ name: user.username, url: user.avatarURL(), iconURL: user.displayAvatarURL() })
.setAuthor(user ? { name: user.username, url: user.avatarURL(), iconURL: user.displayAvatarURL() } : null)
.addFields(
{
name: ':hash: Number of Players',
Expand All @@ -189,7 +189,7 @@ module.exports = {
if(bggSearchResult.found) {
const result = await this.bggThing(bggSearchResult.thing_id);
await interaction.reply({
embeds: [this.itemToSearchEmbed(result.items.item[0], interaction.member.user)]
embeds: [this.itemToSearchEmbed(result.items.item[0], interaction?.member?.user)]
});
}
else {
Expand All @@ -214,7 +214,7 @@ module.exports = {
.setThumbnail(item.thumbnail[0])
.setDescription(he.decode(item.description[0]).substring(0, 200)+'...')
.setFooter({ text: '( πŸ‘ Interested | πŸ“– Can Teach | ❌ End Suggestion )'})
.setAuthor({ name: user.username, url: user.avatarURL(), iconURL: user.displayAvatarURL() })
.setAuthor(user ? { name: user.username, url: user.avatarURL(), iconURL: user.displayAvatarURL() } : null)
.addFields(
{
name: ':hash: Number of Players',
Expand Down Expand Up @@ -250,7 +250,7 @@ module.exports = {
if(bggSearchResult.found) {
this.bggThing(bggSearchResult.thing_id)
.then(result => {
let embed = this.itemToSuggestEmbed(result.items.item[0], interaction.member.user);
let embed = this.itemToSuggestEmbed(result.items.item[0], interaction?.member?.user);
interaction.reply({ embeds: [embed], fetchReply: true }).then(embedMessage => {
try {
embedMessage.react("πŸ‘");
Expand Down Expand Up @@ -312,7 +312,7 @@ module.exports = {
});

const deleteFilter = (reaction, user) => {
return reaction.emoji.name == '❌' && user.id === interaction.member.user.id;
return reaction.emoji.name == '❌' && user.id === interaction?.member?.user?.id;
};
const deleteCollector = embedMessage.createReactionCollector({ filter: deleteFilter });
deleteCollector.on('collect', () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discord-bgg-bot",
"version": "2.1.4",
"version": "2.1.5",
"description": "Board Game Geek Discord Bot",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit f110881

Please sign in to comment.