//MessageHandler processes messages recieved from chat server.
MessageHandler processes messages recieved from chat server.
// MessageHandler processes messages recieved from chat server .
func (bot *Hitbot) MessageHandler() {
	for {
		_, p, err := bot.conn.ReadMessage()
		if err != nil {
			return
		}
		if string(p[:3]) == "2::" {
			bot.conn.WriteMessage(websocket.TextMessage, []byte("2::"))
			continue
		} else if string(p[:3]) == "1::" {
			log.Print("Connection successful!")
			for _, channel := range bot.channels {
				bot.joinChannel(channel)
			}
			continue
		} else if string(p[:4]) == "5:::" {
			bot.parseMessage(p[4:])
		}
	}
}
func ( bot * Hitbot ) MessageHandler ( ) { for { _ , p , err := bot . conn . ReadMessage ( ) if err != nil { return } if string ( p [ : 3 ] ) == " " { bot . conn . WriteMessage ( websocket . TextMessage , [ ] byte ( " " ) ) continue } else if string ( p [ : 3 ] ) == " " { log . Print ( " " ) for _ , channel := range bot . channels { bot . joinChannel ( channel ) } continue } else if string ( p [ : 4 ] ) == " " { bot . parseMessage ( p [ 4 : ] ) } } }
MessageHandler processes messages recieved from chat server.
MessageHandler processes messages recieved from chat server .
//log.Printf("Message: %v", string(p)) //debug info //log.Print("Ping!")