當前位置: 首頁>>代碼示例>>Golang>>正文


Golang api.Event類代碼示例

本文整理匯總了Golang中api.Event的典型用法代碼示例。如果您正苦於以下問題:Golang Event類的具體用法?Golang Event怎麽用?Golang Event使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Event類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: newEventPING

func newEventPING(line string, server string) *api.Event {
	event := new(api.Event)
	event.Raw = line
	event.Type = api.E_PING
	event.Data = server
	return event
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:7,代碼來源:event.go

示例2: newEventPART

func newEventPART(line string, user string, channel string) *api.Event {
	event := new(api.Event)
	event.Raw = line
	event.Type = api.E_PART
	event.Channel = channel
	event.User = user
	return event
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:8,代碼來源:event.go

示例3: newEventNOTICE

func newEventNOTICE(line string, message string, cmd_id int) *api.Event {
	event := new(api.Event)
	event.Raw = line
	event.Type = api.E_NOTICE
	event.Data = message
	event.CmdId = cmd_id
	return event
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:8,代碼來源:event.go

示例4: newEventNICK

func newEventNICK(line string, user string, newuser string) *api.Event {
	event := new(api.Event)
	event.Raw = line
	event.Type = api.E_NICK
	event.Data = newuser
	event.User = user
	return event
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:8,代碼來源:event.go

示例5: newEventQUIT

func newEventQUIT(line string, user string, msg string) *api.Event {
	event := new(api.Event)
	event.Raw = line
	event.Type = api.E_QUIT
	event.Data = msg
	event.User = user
	return event
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:8,代碼來源:event.go

示例6: newEventJOIN

func newEventJOIN(line string, user string, channel string) *api.Event {
	event := new(api.Event)
	event.Raw = line
	event.Type = api.E_JOIN
	event.Channel = channel
	event.Data = channel
	event.User = user
	return event
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:9,代碼來源:event.go

示例7: newEventKICK

func newEventKICK(line string, user string, channel string, target string, msg string) *api.Event {
	event := new(api.Event)
	event.Raw = line
	event.Type = api.E_KICK
	event.Data = target
	event.Channel = channel
	event.User = user
	return event
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:9,代碼來源:event.go

示例8: newEventPRIVMSG

func newEventPRIVMSG(line string, user string, channel string, msg string) *api.Event {
	event := new(api.Event)
	event.Raw = line
	event.Type = api.E_PRIVMSG
	event.Data = msg
	if strings.Index(channel, "#") == 0 {
		event.Channel = channel
	}
	event.User = user
	return event
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:11,代碼來源:event.go

示例9: HandleEvent

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)
}
開發者ID:episeclab,項目名稱:gorobot,代碼行數:19,代碼來源:grobot.go


注:本文中的api.Event類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。