diff --git a/EXAMPLE.env b/EXAMPLE.env index 4f78a64..1572ec2 100644 --- a/EXAMPLE.env +++ b/EXAMPLE.env @@ -1,4 +1,5 @@ DISCORD_BOT_TOKEN=asghjkhagsahjklsg.asgkljajkgslasklgjkaslglgaslgasl SOLANA_PRICE_CHANNEL_ID=90812589702150978578625187125 -ANNOUNCEMENTS_CHANNEL_ID=187290509872150987215 \ No newline at end of file +ANNOUNCEMENTS_CHANNEL_ID=187290509872150987215 +IMAGE_URL=https://image.com/image.png \ No newline at end of file diff --git a/main.js b/main.js index 79fcf8b..31d55f0 100644 --- a/main.js +++ b/main.js @@ -40,7 +40,7 @@ async function immediatePriceCheckAndAnnounce() { const lastKnownPrice = solanaData ? solanaData.price : null; const currentPrice = await fetchSolanaPrice(); - if (currentPrice && lastKnownPrice !== null && (parseFloat(currentPrice) - lastKnownPrice >= 5)) { + if (currentPrice && lastKnownPrice !== null && (parseFloat(currentPrice) - lastKnownPrice >= 2.5)) { const announcementsChannel = await client.channels.fetch(announcementsChannelId); await announcementsChannel.send(`@everyone Significant Solana price increase detected! Previous recorded price: $${lastKnownPrice}. Current price: $${currentPrice}.`); } @@ -60,10 +60,13 @@ async function checkPriceContinuously() { const solanaPriceChannel = await client.channels.fetch(solanaPriceChannelId); const embed = new EmbedBuilder() - .setColor(0x0099ff) - .setTitle('Solana (SOL) Price') - .setDescription(`$${price}`) - .setTimestamp(); + .setColor(0x0099ff) + .setThumbnail('https://solana.com/src/img/branding/solanaLogoMark.png') + .setTitle('Solana (SOL) Price Update') + .setDescription(`**Current Price: \`$${price}\`**`) + .addFields({ name: '💰 Current Price', value: `**\`$${price}\`**`, inline: false }) + .setTimestamp() + .setImage(process.env.IMAGE_URL) if (lastPriceMessageId) { try { @@ -79,7 +82,7 @@ async function checkPriceContinuously() { lastPriceMessageId = sentMessage.id; } - if (lastKnownPriceAtStartup !== null && (parseFloat(price) - lastKnownPriceAtStartup >= 5)) { + if (lastKnownPriceAtStartup !== null && (parseFloat(price) - lastKnownPriceAtStartup >= 2.5)) { const announcementsChannel = await client.channels.fetch(announcementsChannelId); await announcementsChannel.send(`@everyonle Solana price has increased significantly! Current price: $${price}`); lastKnownPriceAtStartup = parseFloat(price);