fix: timer logic

This commit is contained in:
Siwoo Jeon 2025-04-05 11:38:59 +09:00
parent eb13bb4379
commit 2eac1b12e4
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA
2 changed files with 3 additions and 7 deletions

View file

@ -4,7 +4,7 @@ import "time"
var StartedAt *time.Time
func TimeStart() {
func init() {
now := time.Now()
StartedAt = &now
}

View file

@ -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()
}