1
0

"talkback" function (random answers based on a set of patterns)

This commit is contained in:
2020-12-08 10:49:51 +01:00
parent 2c767fa8ff
commit cdb4b6f454
4 changed files with 39 additions and 9 deletions

View File

@ -3,7 +3,7 @@ package main
import (
"ariona.fr/git/gator/gogodiscordo/core"
"fmt"
"log"
"os"
"os/signal"
"syscall"
@ -15,7 +15,7 @@ func main() {
core.ConfigRegister.LoadConf()
discord, err := discordgo.New("Bot " + core.ConfigRegister.Token)
if err != nil {
fmt.Println("error creating Discord session, ", err)
log.Println("error creating Discord session, ", err)
return
}
@ -36,15 +36,16 @@ func main() {
core.MessageHelp)
discord.AddHandler(core.MessageHandler)
discord.AddHandler(core.MessageTalkback)
err = discord.Open()
if err != nil {
fmt.Println("error opening connection, ", err)
log.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.")
log.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