Can't access messages
geostyx opened this issue · comments
Jacob Hands commented
I feel dumb, and I'm sure I'm missing something obvious, but I can't seem to actually access IRC messages using the example.
My version of func main()
from example/main.go
:
(Trying to use it on irc.twitch.tv.)
func main() {
bot := ircx.WithLogin(*server, *name, *name, *pass)
if err := bot.Connect(); err != nil {
log.Panicln("Unable to dial IRC Server ", err)
} else {
fmt.Println("Connected!")
}
RegisterHandlers(bot)
bot.HandleLoop()
bot.ReadLoop() // Tried putting go in front of these but it didn't really help....
for d := range bot.Data { // Thought this might be a way to do it....
fmt.Println("d: ", d)
}
fmt.Println(bot)
log.Println("Exiting..")
}
Nick Van Wiggeren commented
Hi @geostyx!
ircx
is designed to work with callbacks - before you connect to an IRC server, you register the server events' method, and then call connect. An example of all of this can be found here: https://github.com/nickvanw/ircx/blob/master/example/main.go#L26-L49