39 lines
692 B
Go
39 lines
692 B
Go
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)
|
|
dg.AddHandler(checkPrestigeReact)
|
|
dg.AddHandler(listenToStarboardReact)
|
|
err = dg.Open()
|
|
if err != nil {
|
|
fmt.Println("Error opening Discord session:", err)
|
|
return
|
|
}
|
|
go listenToLevelUpdate(dg)
|
|
|
|
sc := make(chan os.Signal, 1)
|
|
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
|
|
<-sc
|
|
|
|
dg.Close()
|
|
db.Close()
|
|
}
|