From 33be66d1e75e6c45762c6ed22c05b68062338064 Mon Sep 17 00:00:00 2001 From: unintendedfraud Date: Sat, 26 Aug 2023 13:17:53 +0200 Subject: [PATCH] f --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index fd9d52e..207b301 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,9 @@ import ( "fmt" "hal/env" "hal/handlers" + "os" + "os/signal" + "syscall" discordbot "github.com/bwmarrin/discordgo" ) @@ -31,6 +34,13 @@ func main() { } fmt.Println("before .Close") + + // Wait here until CTRL-C or other term signal is received. + fmt.Println("Bot is now running. Press CTRL-C to exit.") + sc := make(chan os.Signal, 1) + signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt) + <-sc + dgclient.Close() fmt.Println("after .Close")