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


Golang ircx.Bot類代碼示例

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


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

func main() {
	conf = configure()
	var bot *ircx.Bot
	if len(serverpass) > 0 {
		bot = ircx.WithLoginTLS(server, name, name, serverpass, nil)
	} else {
		bot = ircx.Classic(server, name)
	}

	performRegistrations(bot)

	if err := bot.Connect(); err != nil {
		log.Fatal(err)
	}
	messages.WriteLoop()
	fmt.Printf("Connecting...\n")
	bot.HandleLoop()
}
開發者ID:cosban,項目名稱:muggy,代碼行數:18,代碼來源:bot.go

示例3: RegisterHandlers

func RegisterHandlers(bot *ircx.Bot) {
	bot.AddCallback(irc.RPL_WELCOME, ircx.Callback{Handler: ircx.HandlerFunc(RegisterConnect)})
	bot.AddCallback(irc.PING, ircx.Callback{Handler: ircx.HandlerFunc(PingHandler)})

	maildirproxy := NewMaildirproxy(*server)
	bot.AddCallback(irc.PRIVMSG, ircx.Callback{Handler: ircx.HandlerFunc(maildirproxy.PrivmsgHandler)})
}
開發者ID:carriercomm,項目名稱:bot-19,代碼行數:7,代碼來源:bot.go

示例4: RegisterHandlers

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

示例5: 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

示例6: 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

示例7: RegisterHandlers

func RegisterHandlers(bot *ircx.Bot) {
	bot.AddCallback(irc.RPL_WELCOME, ircx.Callback{Handler: ircx.HandlerFunc(RegisterConnect)})
	bot.AddCallback(irc.PING, ircx.Callback{Handler: ircx.HandlerFunc(PingHandler)})
}
開發者ID:gloob,項目名稱:irc_bot,代碼行數:4,代碼來源:irc.go


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