From 08d023076b52bf5a798bdd795c0ea647ada3f48f Mon Sep 17 00:00:00 2001 From: Izwzyzx <184772711+Izwzyzx@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:47:25 -0500 Subject: [PATCH] Fixed reconnection starting duplicate timers --- CHANGELOG.md | 1 + Onequestionmark.hx | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd1c92..89467c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Release Version 1.2 +- Fixed reconnection starting duplicate timers - Added system to prevent MOTD from chosing the same daily result consecutively - Added support for MOTDs matching only the date - General purpose functions have been split off into IzzComLib diff --git a/Onequestionmark.hx b/Onequestionmark.hx index bed2635..6f18d85 100644 --- a/Onequestionmark.hx +++ b/Onequestionmark.hx @@ -23,6 +23,7 @@ class Onequestionmark { static var motdTimer:Timer; static var saveTimer:Timer; static var saveQueue:Array = []; + static var timerInit:Bool = false; static function main() { @@ -69,6 +70,8 @@ class Onequestionmark { Sys.println('[${timestamp()}] Did not find echobox-db.json, generating'); File.saveContent("echobox-db.json", Json.stringify(echoboxDB, "\t")); } + + saveSystem(); // Start the bot Bot = new DiscordClient(settings.token, [3276799], settings.debug); @@ -92,8 +95,10 @@ class Onequestionmark { botInfo = Endpoints.getCurrentUser(); - startMotd(); - saveSystem(); + if (timerInit == false) { + timerInit = true; + startMotd(); + } }