From 0da00e5efb511bfdb987a98fd5c26b7b2522b13c Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Mon, 28 Oct 2024 22:32:48 -0600 Subject: [PATCH] Move stuff --- index.js | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/index.js b/index.js index 9705d54..e295583 100644 --- a/index.js +++ b/index.js @@ -47,27 +47,24 @@ async function getPreviousDayData() { SELECT COUNT(*) AS call_count FROM cdr WHERE MONTH(calldate) = MONTH(?) AND YEAR(calldate) = YEAR(?); SELECT COUNT(*) AS call_count FROM cdr; `, [startTime, endTime, previousDay, previousDay, previousDay], (err, res) => { - if (err) { - console.error(err) - process.exit(1) - } - callsMade = res[0] - recordForToday = res[1] - monthlyTotal = res[2] - totalCalls = res[3] - }); - - await connection.end(); - console.log(callsMade) - console.log(recordForToday) - return { - "Calls Made": callsMade[0].call_count, - "Record for Today of the Year": recordForToday[0].call_count, - "Monthly Total": monthlyTotal[0].call_count, - "Total Calls Ever Placed": totalCalls[0].call_count, - "System Uptime": getSystemUptime(), - "All Time Record": null, // Placeholder - }; + if (err) { + console.error(err) + process.exit(1) + } + callsMade = res[0] + recordForToday = res[1] + monthlyTotal = res[2] + totalCalls = res[3] + connection.end(); + return { + "Calls Made": callsMade[0].call_count, + "Record for Today of the Year": recordForToday[0].call_count, + "Monthly Total": monthlyTotal[0].call_count, + "Total Calls Ever Placed": totalCalls[0].call_count, + "System Uptime": getSystemUptime(), + "All Time Record": null, // Placeholder + }; + }); } function getSystemUptime() { @@ -118,7 +115,7 @@ async function sendSummary() { previousDayEnd.setHours(23, 59, 59, 999); let embed = { - title: `Summary from to `, + title: `Summary from to `, color: 0x1E90FF, fields: []