requesting irc tags

This commit is contained in:
gempir 2017-03-09 20:24:47 +01:00
parent 98b2dd2d48
commit d69e2b2147
2 changed files with 8 additions and 2 deletions

3
.gitignore vendored
View file

@ -3,4 +3,5 @@ vendor/
glide.lock
.idea/
config.json
logs/
logs/
coverage-all.out

View file

@ -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
}