diff --git a/.gitignore b/.gitignore index 02b14ff..d7a9f2f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ vendor/ glide.lock .idea/ config.json -logs/ \ No newline at end of file +logs/ +coverage-all.out \ No newline at end of file diff --git a/twitch/bot.go b/twitch/bot.go index 37c3da7..687c417 100644 --- a/twitch/bot.go +++ b/twitch/bot.go @@ -32,7 +32,7 @@ func NewBot(ircAddress string, ircUser string, ircToken string, logger logging.L return Bot{ Messages: make(chan Message), ircAddress: ircAddress, - ircUser: ircUser, + ircUser: strings.ToLower(ircUser), ircToken: ircToken, log: logger, rClient: rClient, @@ -54,7 +54,10 @@ func (bot *Bot) CreateConnection() { bot.log.Debugf("new IRC connection %s", conn.RemoteAddr()) fmt.Fprintf(*mainConn, "PASS %s\r\n", bot.ircToken) fmt.Fprintf(*mainConn, "NICK %s\r\n", bot.ircUser) + fmt.Fprint(*mainConn, "CAP REQ :twitch.tv/tags") + fmt.Fprint(*mainConn, "CAP REQ :twitch.tv/commands") fmt.Fprintf(*mainConn, "JOIN %s\r\n", "#" + bot.ircUser) + go bot.joinDefault() reader := bufio.NewReader(conn) @@ -91,6 +94,8 @@ func (bot *Bot) joinDefault() { func (bot *Bot) parseMessage(msg string) { + bot.log.Debug(msg) + if !strings.Contains(msg, ".tmi.twitch.tv PRIVMSG ") { return }