1
0
Files
gogodiscordo/main.go

41 lines
977 B
Go

package main
import (
"ariona.fr/git/gator/gogodisco/core"
"fmt"
"os"
"os/signal"
"syscall"
"github.com/bwmarrin/discordgo"
)
func main() {
core.Config.LoadConf()
discord, err := discordgo.New("Bot " + core.Config.Token)
if err != nil {
fmt.Println("error creating Discord session, ", err)
return
}
core.SetCommand([]string{"/ggd audio", "/gogodisco audio"}, core.MessageAudio, discord)
core.SetCommand([]string{"/ggd ping", "/gogodisco ping"}, core.MessagePing, discord)
core.SetCommand([]string{"/ggd help", "/gogodisco help"}, core.MessageHelp, discord)
err = discord.Open()
if err != nil {
fmt.Println("error opening connection, ", err)
return
}
// Wait here until CTRL-C or other term signal is received.
fmt.Println("Bot is now running. Press CTRL-C to exit.")
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
// Cleanly close down the Discord session.
discord.Close()
}