diff --git a/src/blockchain.ts b/src/blockchain.ts index a6f7871..9f3e884 100644 --- a/src/blockchain.ts +++ b/src/blockchain.ts @@ -20,19 +20,19 @@ export const subToBlockHeaders = (setDiscordStatus: () => Promise) => { web3.eth.subscribe('newBlockHeaders', (error, blockHeader) => { if (error) console.error(error); - // Set status every 10 blocks - const shouldSetStatus = blockHeader.number % 10 === 0; + const shouldLogWei = blockHeader.number % 10 === 0; // Get the gas price for this block web3.eth.getGasPrice((error, gasPrice) => { if (error) console.error(error); - if (shouldSetStatus) console.log('Gas price in wei:', gasPrice); + if (shouldLogWei) console.log('Gas price in wei:', gasPrice); redisClient.set('gas-price', Math.round(Number(gasPrice))) }); - - if (shouldSetStatus) setDiscordStatus() + + // Set status every block + setDiscordStatus() }); } diff --git a/src/handlers.ts b/src/handlers.ts index d4ef482..5ce1aef 100644 --- a/src/handlers.ts +++ b/src/handlers.ts @@ -13,7 +13,7 @@ const handleGasCommand = async (interaction: ChatInputCommandInteraction): Promi const embed = new EmbedBuilder() .setColor('#0099ff') .setTitle('Current Gas Prices') - .setDescription(`⚡${gasPrices.fast} ⦚⦚ 🚶${gasPrices.average} ⦚⦚ 🐢${gasPrices.slow}`) + .setDescription(`⚡ ${gasPrices.fast} ⦚⦚ 🚶 ${gasPrices.average} ⦚⦚ 🐢 ${gasPrices.slow}`) await interaction.reply({ embeds: [embed] }); };