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

43 lines
849 B
Go

2019-11-17 14:47:34 +07:00
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"github.com/bwmarrin/discordgo"
"PermissionGacha/db"
"PermissionGacha/modules/active"
"PermissionGacha/modules/commands"
"PermissionGacha/modules/config"
"PermissionGacha/modules/level"
"PermissionGacha/modules/starboard"
2019-11-17 14:47:34 +07:00
)
func main() {
dg, err := discordgo.New(config.BotToken)
2019-11-17 14:47:34 +07:00
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)
2019-11-17 14:47:34 +07:00
err = dg.Open()
if err != nil {
fmt.Println("Error opening Discord session:", err)
2019-11-20 08:14:36 +07:00
return
2019-11-17 14:47:34 +07:00
}
go level.ScheduleUpdates(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()
}