1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 09:32:50 +00:00

feat(Bot): add restart command - update discordgo

This commit is contained in:
2020-08-12 23:12:24 -05:00
parent b308123cff
commit 52341faea9
7 changed files with 93 additions and 56 deletions

View File

@@ -2,6 +2,8 @@ package main
import (
"os"
"os/signal"
"syscall"
"github.com/mgerb/go-discord-bot/server/bot"
"github.com/mgerb/go-discord-bot/server/config"
@@ -33,9 +35,19 @@ func init() {
func main() {
// start the bot
bot.Start(config.Config.Token)
// start the web server
webserver.Start()
go func() {
webserver.Start()
}()
// start the bot
go func() {
bot.Start(config.Config.Token)
}()
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
bot.Stop()
}