From 4403ee88575187227eec768bc001a9986ff488b5 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Mon, 28 Oct 2024 22:12:22 -0600 Subject: [PATCH] Whoops 2 --- index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 1613645..aceb8b1 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ require("dotenv").config() const Discord = require('discord.js'); +const { connect } = require("http2"); const mysql = require('mysql'); const fs = require('fs').promises; @@ -34,26 +35,27 @@ async function getPreviousDayData() { password: process.env.DATABASE_PASSWORD, database: process.env.DATABASE_NAME, }); - - const [callsMade] = await connection.execute(` + await connection.connect(); + + const [callsMade] = await connection.query(` SELECT COUNT(*) AS call_count FROM cdr WHERE calldate BETWEEN ? AND ? `, [startTime, endTime]); - const [recordForToday] = await connection.execute(` + const [recordForToday] = await connection.query(` SELECT COUNT(*) AS call_count FROM cdr WHERE DATE(calldate) = DATE(?) `, [previousDay]); - const [monthlyTotal] = await connection.execute(` + const [monthlyTotal] = await connection.query(` SELECT COUNT(*) AS call_count FROM cdr WHERE MONTH(calldate) = MONTH(?) AND YEAR(calldate) = YEAR(?) `, [previousDay, previousDay]); - const [totalCalls] = await connection.execute(` + const [totalCalls] = await connection.query(` SELECT COUNT(*) AS call_count FROM cdr `);