This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
2019-11-17 14:47:34 +07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"strings"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
token, _ := ioutil.ReadFile("token.txt")
|
|
|
|
|
|
|
|
dg, err := discordgo.New(strings.TrimSpace(string(token)))
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error creating Discord session:", err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
dg.AddHandler(messageCreate)
|
2019-11-19 08:12:16 +07:00
|
|
|
dg.AddHandler(checkPrestigeReact)
|
2019-11-17 14:47:34 +07:00
|
|
|
err = dg.Open()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error opening Discord session:", err)
|
|
|
|
}
|
2019-11-18 07:30:21 +07:00
|
|
|
go listenToLevelUpdate(dg)
|
2019-11-17 14:47:34 +07:00
|
|
|
|
|
|
|
sc := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
|
|
|
|
<-sc
|
|
|
|
|
|
|
|
dg.Close()
|
|
|
|
db.Close()
|
|
|
|
}
|