1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-10 17:12:48 +00:00

added logger

This commit is contained in:
2018-04-09 23:24:19 -05:00
parent 0fe7468506
commit 3e0cd3c948
10 changed files with 245 additions and 4 deletions

View File

@@ -3,18 +3,26 @@ package bot
import (
"github.com/bwmarrin/discordgo"
"github.com/mgerb/go-discord-bot/server/bothandlers"
"github.com/mgerb/go-discord-bot/server/config"
log "github.com/sirupsen/logrus"
)
func Start(token string) {
// Start the bot
func Start(token string) *discordgo.Session {
// initialize connection
session := connect(token)
// add bot handlers
addHandler(session, bothandlers.SoundsHandler)
if config.Config.Logger {
addHandler(session, bothandlers.LoggerHandler)
}
// start listening for commands
startListener(session)
return session
}
func addHandler(session *discordgo.Session, handler interface{}) {