From eca3207d4eeb14bdd5d90c178128570026f7c82a Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Thu, 10 Aug 2023 22:16:23 -0400 Subject: [PATCH 1/5] Remove excess console.log --- modules/functions.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/functions.js b/modules/functions.js index 82f3e49..64eec3c 100755 --- a/modules/functions.js +++ b/modules/functions.js @@ -1145,7 +1145,6 @@ const functions = { return errorId; }, async sendHeartbeat(url) { - console.log(url); https.get(url, async (response) => { let data = ''; -- 2.45.2 From 314b793042162daf79e1e7683527c4c1a968fe8b Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Thu, 10 Aug 2023 22:18:28 -0400 Subject: [PATCH 2/5] Versioning --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0bcb61..86a974d 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "silvanus", - "version": "1.2.7", + "version": "1.2.8", "description": "Grow A Tree Companion Bot", "main": "main.js", "scripts": { -- 2.45.2 From 046369532338ba8b683f56ed0936494276c37cc2 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sun, 27 Aug 2023 19:34:15 -0400 Subject: [PATCH 3/5] Improved logging --- Dockerfile | 3 +-- main.js | 2 ++ modules/functions.js | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3562b0d..56dbc78 100755 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,4 @@ WORKDIR /usr/src/app COPY package.json ./ RUN npm install COPY . . -# CMD ["/bin/sh", "-c", "node main.js 2> /logs/silvanus.err 1> /logs/silvanus.log"] -CMD ["/bin/sh", "-c", "node main.js 2> /logs/error/$(date +%Y-%m-%d_%H-%M-%S).txt 1> /logs/status/$(date +%Y-%m-%d_%H-%M-%S).txt"] +CMD ["/bin/sh", "-c", "node main.js 2>&1 > /logs/$(date +%Y-%m-%d_%H-%M-%S).txt"] diff --git a/main.js b/main.js index 1778c9c..2886ce8 100755 --- a/main.js +++ b/main.js @@ -52,6 +52,8 @@ client.once('ready', async () => { fn.sendHeartbeat(heartbeatUrl); }, 30000); if (isDev) console.log("Heartbeat interval set."); + } else { + if (isDev) console.log("No heartbeat URL set, will not send heartbeats for uptime monitoring."); } }); diff --git a/modules/functions.js b/modules/functions.js index 64eec3c..c10491e 100755 --- a/modules/functions.js +++ b/modules/functions.js @@ -1146,11 +1146,13 @@ const functions = { }, async sendHeartbeat(url) { https.get(url, async (response) => { + if (isDev) console.log("Sent Heartbeat Request: " + url); let data = ''; response.on('data', (chunk) => data += chunk); response.on('end', () => { + if (isDev) console.log("Received Heartbeat Response: " + data); parsedData = JSON.parse(data); if ( !(parsedData.ok) ) console.error("Heartbeat failed"); }); -- 2.45.2 From fb43d09d1327e5620b63e25316a017dfb1bfd534 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sun, 27 Aug 2023 20:27:11 -0400 Subject: [PATCH 4/5] Fix debug mode detection --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 2886ce8..6727767 100755 --- a/main.js +++ b/main.js @@ -28,7 +28,7 @@ const fn = require('./modules/functions.js'); const strings = require('./data/strings.json'); const dbfn = require('./modules/dbfn.js'); const { GuildInfo } = require('./modules/CustomClasses.js'); -const isDev = process.env.DEBUG; +const isDev = process.env.DEBUG === "true"; let statusChannel; client.once('ready', async () => { -- 2.45.2 From 825ec725d15df6490c0005438ca65e7db24d447a Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 2 Sep 2023 09:42:10 -0400 Subject: [PATCH 5/5] Timer planning --- TODO.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/TODO.md b/TODO.md index ddbfebb..1de4969 100755 --- a/TODO.md +++ b/TODO.md @@ -1,10 +1,3 @@ -## In Progress -☑ Switch `/setup` to ask for the tree and leaderboard channels -* Switch `/compare` to check for newer trees and leaderboards when run **and** on every refresh - -## Future Ideas -* Go through and comment the code - ## Variable Structures guildInfo = { @@ -21,7 +14,18 @@ guildInfo = { reminderOptIn: 0, } -## Expected Behaviors +## New Table Planning +Table: `silvanus`.timers -* Run `/compare` before `/setup`: `/compare` will search the current channel for tree and leaderboard messages, then create a comparison embed. If it can't find `/tree` or `/top trees` messages, it'll return an error saying as much. -* Run `/compare` after `/setup`: ``/compare` will search the current channel for tree and leaderboard messages, then create a comparison embed. If it can't find `/tree` or `/top trees` messages, it'll just use old data silently (odds are `/compare` is being run from another channel, that's fine) +id | INT | NOT NULL | AUTO INCREMENT | PRIMARY KEY +status | VARCHAR(10) | NOT NULL | DEFAULT "WAITING" +dc_timecode | INT | NOT NULL | Discord timecode +guild_id | INT UNSIGNED | NOT NULL | Discord guild ID for referencing `silvanus`.guildInfo + + +Table: `silvanus`.auto_role_status + +id | INT | NOT NULL | AUTO INCREMENT | PRIMARY KEY +user_id | INT UNSIGNED | NOT NULL +guild_id | INT UNSIGNED | NOT NULL +status | VARCHAR(10) | NOT NULL | DEFAULT "REMOVED" | OPTION: {"REMOVED", "ADDED"} \ No newline at end of file -- 2.45.2