29 lines
506 B
Go
29 lines
506 B
Go
package main
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"TerraOceanBot/discord"
|
|
"TerraOceanBot/server"
|
|
)
|
|
|
|
func main() {
|
|
token, _ := ioutil.ReadFile("token.txt")
|
|
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
|
|
}
|