示例#1
0
func (robot *Grobot) HandleEvent(serv *Server, event *api.Event) {
	switch event.Type {
	case api.E_KICK:
		if serv.Config.Nickname == event.Data && robot.Config.AutoRejoinOnKick {
			serv.JoinChannel(event.Channel)
		}
	case api.E_PING:
		serv.SendMeRaw[api.PRIORITY_HIGH] <- fmt.Sprintf("PONG :%s\r\n", event.Data)
	case api.E_NOTICE:
		robot.HandleNotice(serv, event)
	case api.E_DISCONNECT:
		serv.Disconnect()
	case api.E_PRIVMSG:
		if _, ok := serv.Config.Channels[event.Channel]; ok == true {
			event.AdminCmd = serv.Config.Channels[event.Channel].Master
		}
	}
	robot.SendEvent(event)
}