diff --git a/src/app/Features/3Commas/API/index.ts b/src/app/Features/3Commas/API/index.ts index ad7e8166..7cab7e6f 100644 --- a/src/app/Features/3Commas/API/index.ts +++ b/src/app/Features/3Commas/API/index.ts @@ -1,7 +1,7 @@ import { update, run, query } from '@/app/Features/Database/database'; const { bots, getAccountDetail, deals, getAccountSummary } = require('./api'); const { getProfileConfigAll } = require('@/utils/config') -import { findAndNotifyNewDeals } from '@/app/Features/Notifications/notifications' +import { findAndNotifyNewDeals } from '@/electron/Notifications/notifications' import { Type_Deals_API, Type_Query_Accounts, Type_API_bots, Type_UpdateFunction } from '@/types/3Commas' import { Type_Profile } from '@/types/config' diff --git a/src/app/Features/Notifications/notifications.ts b/src/electron/Notifications/notifications.ts similarity index 93% rename from src/app/Features/Notifications/notifications.ts rename to src/electron/Notifications/notifications.ts index 0dd98b32..18fb2c39 100644 --- a/src/app/Features/Notifications/notifications.ts +++ b/src/electron/Notifications/notifications.ts @@ -88,9 +88,10 @@ function findAndNotifyNewDeals(data: Type_Deals_API[], lastSyncTime: number, sum const totalProfit = data.map(deal => deal.final_profit).reduce((sum, profit) => sum + profit); const pairs = data.map(deal => deal.pair) const moneyBags = ("💰".repeat(data.length)) + const ifRich = (+totalProfit > 0) ? "rich" : "poor" try { - showNotification(`${data.length} Deals Closed, you're rich`, `Profit: ${parseNumber(totalProfit, 5)} - Pairs: ${pairs.join(', ')}. ${moneyBags} `); + showNotification(`${data.length} Deals Closed, you're ${ifRich}`, `Profit: ${parseNumber(totalProfit, 5)} - Pairs: ${pairs.join(', ')}. ${moneyBags} `); // add the deal IDs to the notified deal array dealsNotified.push(...data.map(deal => deal.id)) @@ -101,9 +102,11 @@ function findAndNotifyNewDeals(data: Type_Deals_API[], lastSyncTime: number, sum } for (let deal of data) { - const notificationTitle = 'Deal Closed, profit was had.'; + const {bot_name, pair, final_profit, final_profit_percentage, from_currency, id, created_at, closed_at} = deal; + const ifRich = (+final_profit > 0) ? "had" : "lost" + const notificationTitle = `Deal Closed, profit was ${ifRich}.`; // deal length: