43 lines
849 B
Go
43 lines
849 B
Go
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"
|
|
)
|
|
|
|
func main() {
|
|
dg, err := discordgo.New(config.BotToken)
|
|
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()
|
|
}
|