This commit is contained in:
unintendedfraud
2023-08-27 08:59:55 +02:00
parent 8caaf94b6c
commit 33be66d1e7
+10
View File
@@ -4,6 +4,9 @@ import (
"fmt" "fmt"
"hal/env" "hal/env"
"hal/handlers" "hal/handlers"
"os"
"os/signal"
"syscall"
discordbot "github.com/bwmarrin/discordgo" discordbot "github.com/bwmarrin/discordgo"
) )
@@ -31,6 +34,13 @@ func main() {
} }
fmt.Println("before .Close") 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() dgclient.Close()
fmt.Println("after .Close") fmt.Println("after .Close")