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


Golang Bot.HandleFunc方法代碼示例

本文整理匯總了Golang中github.com/nickvanw/ircx.Bot.HandleFunc方法的典型用法代碼示例。如果您正苦於以下問題:Golang Bot.HandleFunc方法的具體用法?Golang Bot.HandleFunc怎麽用?Golang Bot.HandleFunc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/nickvanw/ircx.Bot的用法示例。


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

示例1: RegisterHandlers

func RegisterHandlers(bot *ircx.Bot) {
	bot.HandleFunc(irc.RPL_WELCOME, RegisterConnect)
	bot.HandleFunc(irc.PING, PingHandler)
	bot.HandleFunc(irc.PRIVMSG, MsgHandler)
	bot.HandleFunc(irc.JOIN, JoinHandler)
	bot.HandleFunc(irc.PART, PartHandler)
}
開發者ID:progrium,項目名稱:twitchsay,代碼行數:7,代碼來源:twitchsay.go

示例2: RegisterHandlers

func RegisterHandlers(bot *ircx.Bot) {
	bot.HandleFunc(irc.RPL_WELCOME, RegisterConnect)
	bot.HandleFunc(irc.PING, PingHandler)
}
開發者ID:mycroft,項目名稱:go-snippets,代碼行數:4,代碼來源:main.go

示例3: registerHandlers

func registerHandlers(bot *ircx.Bot) {
	bot.HandleFunc(irc.RPL_WELCOME, onWelcome)
	bot.HandleFunc(irc.PING, onPing)
	bot.HandleFunc(irc.PRIVMSG, onPrivmsg)
}
開發者ID:mvdan,項目名稱:gibot,代碼行數:5,代碼來源:main.go

示例4: performRegistrations

func performRegistrations(bot *ircx.Bot) {
	bot.HandleFunc(irc.RPL_WELCOME, registerConnect)
	bot.HandleFunc(irc.PING, pingHandler)
	bot.HandleFunc(irc.PRIVMSG, MessageHandler)
	bot.HandleFunc(irc.NOTICE, MessageHandler)
	bot.HandleFunc(irc.JOIN, JoinHandler)
	bot.HandleFunc(irc.QUIT, LeaveHandler)
	bot.HandleFunc(irc.PART, LeaveHandler)
	bot.HandleFunc(irc.NICK, NickHandler)
	bot.HandleFunc(irc.ERR_UNKNOWNCOMMAND, unknownCommandHandler)
	bot.HandleFunc(irc.RPL_WHOREPLY, WhoisHandler)
	// non standard RPL_WHOISACCOUNT
	bot.HandleFunc("330", WhoisHandler)
	bot.HandleFunc("354", WhoisHandler)
	bot.HandleFunc("353", WhoisHandler)
	bot.HandleFunc(irc.ERR_NOLOGIN, loginErrHandler)
	// ACCOUNT-NOTIFY
	bot.HandleFunc("ACCOUNT", AccountHandler)

	registerCommand(commands.CommandStruct{
		Name:    "google",
		Usage:   "<query>",
		Summary: "Queries google for search results.",
		Handle:  commands.Search,
	})
	registerCommand(commands.CommandStruct{
		Name:    "yt",
		Usage:   "<query>",
		Summary: "Queries Youtube for videos.",
		Handle:  commands.SearchYoutube,
	})
	registerCommand(commands.CommandStruct{
		Name:    "quit",
		Usage:   "",
		Summary: "Forces the bot to quit (SEE ALSO: restart)",
		Handle:  commands.Quit,
	})
	registerCommand(commands.CommandStruct{
		Name:    "trust",
		Usage:   "<nick>",
		Summary: "Makes the bot trust a nick (SEE ALSO: doubt, trusted)",
		Handle:  commands.Trust,
	})
	registerCommand(commands.CommandStruct{
		Name:    "doubt",
		Usage:   "<nick>",
		Summary: "Makes the bot no longer trust a nick (SEE ALSO: trust, trusted",
		Handle:  commands.Doubt,
	})
	registerCommand(commands.CommandStruct{
		Name:    "alias",
		Usage:   "<command>",
		Summary: "Creates an alias which can be used to run a command",
		Handle:  commands.Alias,
	})
	registerCommand(commands.CommandStruct{
		Name:    "join",
		Usage:   "<channel>",
		Summary: "Makes the bot join a channel (SEE ALSO: leave)",
		Handle:  commands.Join,
	})
	registerCommand(commands.CommandStruct{
		Name:    "leave",
		Usage:   "<channel>",
		Summary: "Makes the bot leave a channel (SEE ALSO: join)",
		Handle:  commands.Leave,
	})
	registerCommand(commands.CommandStruct{
		Name:    "restart",
		Usage:   "",
		Summary: "Forces the bot to restart (SEE ALSO: quit)",
		Handle:  commands.Restart,
	})
	registerCommand(commands.CommandStruct{
		Name:    "trusted",
		Usage:   "",
		Summary: "Displays a list of trusted users (SEE ALSO: trust, doubt)",
		Handle:  commands.Trusted,
	})
	registerCommand(commands.CommandStruct{
		Name:    "weather",
		Usage:   "<city>, [state]",
		Summary: "Queries for weather in a given city (SEE ALSO: temp)",
		Handle:  commands.Weather,
	})
	registerCommand(commands.CommandStruct{
		Name:    "temperature",
		Usage:   "<city>, state",
		Summary: "Queries for temperature in a given city (SEE ALSO: weather)",
		Handle:  commands.Temperature,
	})
	registerCommand(commands.CommandStruct{
		Name:    "raw",
		Usage:   "<numeric> <recipient>:[message]",
		Summary: "Forces the bot to perform the given raw command",
		Handle:  commands.Raw,
	})
	registerCommand(commands.CommandStruct{
		Name:    "topic",
		Usage:   "<message>",
//.........這裏部分代碼省略.........
開發者ID:cosban,項目名稱:muggy,代碼行數:101,代碼來源:bot.go


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