示例#1
0
func Init() {
	rc = reminders.Init()

	// Set up the handlers and commands.
	bot.HandleFunc(load, "connected")
	bot.HandleFunc(tellCheck, "privmsg", "action", "join", "nick")

	bot.CommandFunc(tell, "tell", "tell <nick> <msg>  -- "+
		"Stores a message for the (absent) nick.")
	bot.CommandFunc(list, "remind list",
		"remind list  -- Lists reminders set by or for your nick.")
	bot.CommandFunc(del, "remind del",
		"remind del <N>  -- Deletes (previously listed) reminder N.")
	bot.CommandFunc(set, "remind", "remind <nick> <msg> "+
		"in|at|on <time>  -- Reminds nick about msg at time.")
}
示例#2
0
func Init() {
	mc = markov.Init()

	bot.HandleFunc(recordMarkov, "privmsg")

	bot.CommandFunc(randomCmd, "markov", "markov <user>  -- "+
		"Generate random sentece for given <user>.")
}
示例#3
0
func Init() {
	kc = karma.Init()

	bot.HandleFunc(recordKarma, "privmsg", "action")

	bot.CommandFunc(karmaCmd, "karma", "karma <thing>  -- "+
		"Retrieve the karma score of <thing>.")
}
示例#4
0
func Init() {
	fc = factoids.Init()

	bot.HandleFunc(insert, "privmsg")
	bot.HandleFunc(lookup, "privmsg", "action")

	bot.PluginFunc(replaceIdentifiers)

	bot.CommandFunc(chance, "chance of that is",
		"chance  -- Sets trigger chance of the last displayed factoid value.")
	bot.CommandFunc(forget, "delete that",
		"delete  -- Forgets the last displayed factoid value.")
	bot.CommandFunc(forget, "forget that",
		"forget  -- Forgets the last displayed factoid value.")
	bot.CommandFunc(info, "fact info",
		"fact info <key>  -- Displays some stats about factoid <key>.")
	bot.CommandFunc(literal, "literal",
		"literal <key>  -- Displays the factoid values stored for <key>.")
	bot.CommandFunc(replace, "replace that with",
		"replace  -- Replaces the last displayed factoid value.")
	bot.CommandFunc(search, "fact search",
		"fact search <regexp>  -- Searches for factoids matching <regexp>.")
}
示例#5
0
文件: urldriver.go 项目: pzsz/sp0rkle
func Init() {
	uc = urls.Init()

	if err := os.MkdirAll(*urlCacheDir, 0700); err != nil {
		logging.Fatal("Couldn't create URL cache dir: %v", err)
	}

	bot.HandleFunc(urlScan, "privmsg")

	bot.CommandFunc(find, "urlfind", "urlfind <regex>  -- "+
		"searches for previously mentioned URLs matching <regex>")
	bot.CommandFunc(find, "url find", "url find <regex>  -- "+
		"searches for previously mentioned URLs matching <regex>")
	bot.CommandFunc(find, "urlsearch", "urlsearch <regex>  -- "+
		"searches for previously mentioned URLs matching <regex>")
	bot.CommandFunc(find, "url search", "url search <regex>  -- "+
		"searches for previously mentioned URLs matching <regex>")

	bot.CommandFunc(find, "randurl", "randurl  -- displays a random URL")
	bot.CommandFunc(find, "random url", "random url  -- displays a random URL")

	bot.CommandFunc(shorten, "shorten that", "shorten that  -- "+
		"shortens the last mentioned URL.")
	bot.CommandFunc(shorten, "shorten", "shorten <url>  -- shortens <url>")

	bot.CommandFunc(cache, "cache that", "cache that  -- "+
		"caches the last mentioned URL.")
	bot.CommandFunc(cache, "cache", "cache <url>  -- caches <url>")
	bot.CommandFunc(cache, "save that", "save that  -- "+
		"caches the last mentioned URL.")
	bot.CommandFunc(cache, "save", "save <url>  -- caches <url>")

	// This serves "shortened" urls
	http.Handle(shortenPath, http.StripPrefix(shortenPath,
		http.HandlerFunc(shortenedServer)))

	// This serves "cached" urls
	http.Handle(cachePath, http.StripPrefix(cachePath,
		http.FileServer(http.Dir(*urlCacheDir))))
}
示例#6
0
func Init() {
	sc = seen.Init()

	bot.HandleFunc(smoke, "privmsg", "action")
	bot.HandleFunc(recordLines, "privmsg", "action")
	bot.HandleFunc(recordPrivmsg, "privmsg", "action")
	bot.HandleFunc(recordJoin, "join", "part")
	bot.HandleFunc(recordNick, "nick", "quit")
	bot.HandleFunc(recordKick, "kick")

	bot.CommandFunc(seenCmd, "seen", "seen <nick> [action]  -- "+
		"display the last time <nick> was seen on IRC [doing action]")
	bot.CommandFunc(lines, "lines", "lines [nick]  -- "+
		"display how many lines you [or nick] has said in the channel")
	bot.CommandFunc(topten, "topten", "topten  -- "+
		"display the nicks who have said the most in the channel")
	bot.CommandFunc(topten, "top10", "top10  -- "+
		"display the nicks who have said the most in the channel")
}