requesting irc tags
This commit is contained in:
parent
98b2dd2d48
commit
d69e2b2147
2 changed files with 8 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,4 +3,5 @@ vendor/
|
||||||
glide.lock
|
glide.lock
|
||||||
.idea/
|
.idea/
|
||||||
config.json
|
config.json
|
||||||
logs/
|
logs/
|
||||||
|
coverage-all.out
|
|
@ -32,7 +32,7 @@ func NewBot(ircAddress string, ircUser string, ircToken string, logger logging.L
|
||||||
return Bot{
|
return Bot{
|
||||||
Messages: make(chan Message),
|
Messages: make(chan Message),
|
||||||
ircAddress: ircAddress,
|
ircAddress: ircAddress,
|
||||||
ircUser: ircUser,
|
ircUser: strings.ToLower(ircUser),
|
||||||
ircToken: ircToken,
|
ircToken: ircToken,
|
||||||
log: logger,
|
log: logger,
|
||||||
rClient: rClient,
|
rClient: rClient,
|
||||||
|
@ -54,7 +54,10 @@ func (bot *Bot) CreateConnection() {
|
||||||
bot.log.Debugf("new IRC connection %s", conn.RemoteAddr())
|
bot.log.Debugf("new IRC connection %s", conn.RemoteAddr())
|
||||||
fmt.Fprintf(*mainConn, "PASS %s\r\n", bot.ircToken)
|
fmt.Fprintf(*mainConn, "PASS %s\r\n", bot.ircToken)
|
||||||
fmt.Fprintf(*mainConn, "NICK %s\r\n", bot.ircUser)
|
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)
|
fmt.Fprintf(*mainConn, "JOIN %s\r\n", "#" + bot.ircUser)
|
||||||
|
|
||||||
go bot.joinDefault()
|
go bot.joinDefault()
|
||||||
|
|
||||||
reader := bufio.NewReader(conn)
|
reader := bufio.NewReader(conn)
|
||||||
|
@ -91,6 +94,8 @@ func (bot *Bot) joinDefault() {
|
||||||
|
|
||||||
func (bot *Bot) parseMessage(msg string) {
|
func (bot *Bot) parseMessage(msg string) {
|
||||||
|
|
||||||
|
bot.log.Debug(msg)
|
||||||
|
|
||||||
if !strings.Contains(msg, ".tmi.twitch.tv PRIVMSG ") {
|
if !strings.Contains(msg, ".tmi.twitch.tv PRIVMSG ") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue