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

46 lines
899 B
Go

package main
import (
"fmt"
"io/ioutil"
"os"
"os/signal"
"strings"
"syscall"
"github.com/bwmarrin/discordgo"
"PermissionGacha/db"
"PermissionGacha/modules/active"
"PermissionGacha/modules/commands"
"PermissionGacha/modules/level"
"PermissionGacha/modules/starboard"
)
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(active.Reward)
dg.AddHandler(commands.Parse)
dg.AddHandler(commands.ListenPrestigeReact)
dg.AddHandler(starboard.ReactListener)
err = dg.Open()
if err != nil {
fmt.Println("Error opening Discord session:", err)
return
}
go level.ScheduleUpdates(dg)
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
dg.Close()
db.Close()
}