From 707acc99e28132e919bd907c4dbde3f7fc69733f Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 24 Dec 2023 23:41:23 -0600 Subject: [PATCH] Catch SIGTERM, only show CTRL+C in development mode --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 89357a0..e5d7896 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "net/http/cookiejar" "os" "os/signal" + "syscall" "time" "github.com/bwmarrin/discordgo" @@ -208,7 +209,11 @@ func main() { stop := make(chan os.Signal, 1) signal.Notify(stop, os.Interrupt) - log.Info().Msg("Press Ctrl+C to exit") + signal.Notify(stop, syscall.SIGTERM) + + if isDevelopment { + log.Info().Msg("Press Ctrl+C to exit") + } <-stop log.Warn().Msg("Gracefully shutting down")