Play video when losing and gaining
This commit is contained in:
		
							
								
								
									
										21
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								main.js
									
									
									
									
									
								
							| @@ -104,7 +104,10 @@ function calculateProfitStatus(tokenData) { | ||||
|  | ||||
| const updateStatsMessage = async (tokenData) => { | ||||
|   const statsChannel = await discordClient.channels.fetch(statsChannelId); | ||||
|   if (!statsChannel) return; | ||||
|   if (!statsChannel) { | ||||
|     console.log("Stats channel not found."); | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   if (statsMessageId) { | ||||
|     try { | ||||
| @@ -216,13 +219,14 @@ const setSourceVisibility = (sourceName, visible) => { | ||||
|   ws.send(JSON.stringify(message)); | ||||
| }; | ||||
|  | ||||
| const updateOBSTextVisibility = (makingMoney) => { | ||||
|   if (obsVisibilityState.makingMoney !== makingMoney) { | ||||
|     setSourceVisibility("TextGreen", makingMoney); | ||||
|     setSourceVisibility("TextRed", !makingMoney); | ||||
| const updateOBSTextVisibility = () => { | ||||
|   const makingMoney = obsVisibilityState.makingMoney; | ||||
|  | ||||
|     obsVisibilityState.makingMoney = makingMoney; | ||||
|   } | ||||
|   setSourceVisibility("TextGreen", makingMoney); | ||||
|   setSourceVisibility("TextRed", !makingMoney); | ||||
|  | ||||
|   setSourceVisibility("Making", makingMoney); | ||||
|   setSourceVisibility("Losing", !makingMoney); | ||||
| }; | ||||
|  | ||||
| const checkStatusAndUpdateOBS = async () => { | ||||
| @@ -241,6 +245,8 @@ const checkStatusAndUpdateOBS = async () => { | ||||
|         priceChange: pair.priceChange.m5 | ||||
|       }; | ||||
|        | ||||
|       obsVisibilityState.makingMoney = tokenData.profitStatus; | ||||
|  | ||||
|       const priceFormatted = tokenData.price ? `$${parseFloat(tokenData.price).toFixed(8)}` : 'N/A'; | ||||
|  | ||||
|       console.log(`Price Change (Last 5 Minutes): ${pair.priceChange.m5}%`); | ||||
| @@ -250,6 +256,7 @@ const checkStatusAndUpdateOBS = async () => { | ||||
|       setSourceVisibility("TextRed", !tokenData.profitStatus); | ||||
|  | ||||
|       updateStatsMessage(tokenData); | ||||
|       updateOBSTextVisibility(); | ||||
|     } else { | ||||
|       console.log('No pairs data found for the token address.'); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user