TerraOceanPlugin/GoBot/main.go

29 lines
506 B
Go

package main
import (
"io/ioutil"
2019-10-12 15:49:28 +07:00
"os"
"os/signal"
"syscall"
2019-10-12 09:45:43 +07:00
"TerraOceanBot/discord"
"TerraOceanBot/server"
)
func main() {
token, _ := ioutil.ReadFile("token.txt")
2019-10-12 15:49:28 +07:00
endGracefully := make(chan bool)
go discord.StartBot(string(token), endGracefully)
go server.StartServer(8080)
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
//Notification to end
endGracefully <- true
//Wait for it to actually end
endGracefully <- true
}