initial commit
This commit is contained in:
38
main.go
Normal file
38
main.go
Normal file
@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"ariona.fr/git/gator/gogodisco/core"
|
||||
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var c config.Config
|
||||
c.LoadConf()
|
||||
|
||||
discord, err := discordgo.New("Bot " + c.Token)
|
||||
if err != nil {
|
||||
fmt.Println("error creating Discord session, ", err)
|
||||
return
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user