This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
PermissionGacha/main.go

36 lines
609 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)
err = dg.Open()
if err != nil {
fmt.Println("Error opening Discord session:", err)
}
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()
}