From 23e7efd1862f0f82c4cd5cb0b24cf3f560f2f473 Mon Sep 17 00:00:00 2001 From: Michael McCarty Date: Sat, 14 Feb 2026 15:25:18 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fix=20file=20path=20and=20watche?= =?UTF-8?q?r=20handling=20for=20config=20and=20status=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 8237e0ec..ee7225cb 100644 --- a/main.go +++ b/main.go @@ -31,8 +31,8 @@ import ( "github.com/natefinch/lumberjack/v3" ) -const configFileName = "./.config.json" -const statusMessagesFileName = "./ttbb-data/status-messages.json" +const configFileName = ".config.json" +const statusMessagesFileName = "ttbb-data/status-messages.json" // Admin Slash Command Constants // const boostBotHomeGuild string = "766330702689992720" @@ -1079,17 +1079,20 @@ func main() { return } log.Println("event:", event) - if event.Has(fsnotify.Write) { + if event.Has(fsnotify.Write) || event.Has(fsnotify.Rename) { switch event.Name { case configFileName: log.Println("modified file:", event.Name) - err := config.ReadConfig(event.Name) - if err != nil { - log.Println(err.Error()) + _ = config.ReadConfig(event.Name) + if event.Has(fsnotify.Rename) { + _ = watcher.Add(event.Name) } case statusMessagesFileName: log.Println("modified file:", event.Name) ei.LoadStatusMessages(event.Name) + if event.Has(fsnotify.Rename) { + _ = watcher.Add(event.Name) + } } } case err, ok := <-watcher.Errors: