Skip to content

Commit

Permalink
moved changes from store > random-store cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
StarManTheGamer committed Jul 20, 2023
1 parent 62b436c commit 01caed1
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/commands/random/randomStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ export async function randomStore (message: Message, args: string[]) {
const data = randomData.data
const creator = data.creator

let thumbnailURL = data.thumbnail

// Check if the asset type is "audio" and set a specific link as the thumbnail
if (data.type.toLowerCase() === 'audio') {
thumbnailURL = 'https://c0.ptacdn.com/static/images/placeholders/audio.88cff071.png'
}

const embed = new MessageEmbed({
title: data.name + ' ' + (data.isLimited === true ? emojiUtils.star : ''),
description: data.description === '' ? 'No description set.' : data.description,
url: `https://polytoria.com/store/${data.id}`,
thumbnail: {
url: `${data.thumbnail}`
url: thumbnailURL
},
color: '#ff5454',
fields: [
Expand All @@ -39,6 +46,17 @@ export async function randomStore (message: Message, args: string[]) {
value: creator.name,
inline: true
},
{
name: 'Created At',
value: dateUtils.atomTimeToDisplayTime(data.createdAt),
inline: true
}
]
})

const assetType = data.type.toLowerCase()
if (!['audio', 'decal', 'meshes'].includes(assetType)) {
embed.fields.push(
{
name: 'Price',
value: data.price.toString(),
Expand All @@ -48,14 +66,9 @@ export async function randomStore (message: Message, args: string[]) {
name: 'Sales',
value: data.sales.toString(),
inline: true
},
{
name: 'Created At',
value: dateUtils.atomTimeToDisplayTime(data.createdAt),
inline: true
}
]
})
)
}

return await message.channel.send({ embeds: [embed] })
}

0 comments on commit 01caed1

Please sign in to comment.