From 2eac1b12e4c97a5c14664047eba6b079a664fab6 Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Sat, 5 Apr 2025 11:38:59 +0900 Subject: [PATCH] fix: timer logic --- configs/time.go | 2 +- main.go | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/configs/time.go b/configs/time.go index 852bef5..a206f9d 100644 --- a/configs/time.go +++ b/configs/time.go @@ -4,7 +4,7 @@ import "time" var StartedAt *time.Time -func TimeStart() { +func init() { now := time.Now() StartedAt = &now } diff --git a/main.go b/main.go index cf7aece..b3032a3 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,6 @@ import ( ) func main() { - configs.TimeStart() config := configs.Config dg, err := discordgo.New("Bot " + config.Bot.Token) @@ -40,15 +39,12 @@ func main() { dg.Open() defer func() { - if err := databases.Client.Disconnect(context.TODO()); err != nil { - panic(err) - } + dg.Close() + databases.Client.Disconnect(context.TODO()) }() log.Println("[goMuffin] 봇이 실행되고 있어요. 버전:", configs.MUFFIN_VERSION) sc := make(chan os.Signal, 1) signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt) <-sc - - dg.Close() }