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: []