コード例 #1
0
ファイル: decisiondriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	bot.Rewrite(randPlugin)
	bot.Rewrite(decidePlugin)

	bot.Command(randCmd, "rand", "rand <range>  -- "+
		"choose a random number in range [lo-]hi")
	bot.Command(decideCmd, "decide", "decide <options>  -- "+
		"choose one of the (space, pipe, quote) delimited options at random")
	bot.Command(decideCmd, "choose", "choose <options>  -- "+
		"choose one of the (space, pipe, quote) delimited options at random")
}
コード例 #2
0
ファイル: factdriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	fc = factoids.Init()

	bot.Handle(insert, client.PRIVMSG)
	bot.Handle(lookup, client.PRIVMSG, client.ACTION)

	bot.Rewrite(replaceIdentifiers)

	bot.Command(chance, "chance of that is",
		"chance  -- Sets trigger chance of the last displayed factoid value.")
	bot.Command(edit, "that =~",
		"=~ s/regex/replacement/ -- Edits the last factoid value using regex.")
	bot.Command(forget, "delete that",
		"delete  -- Forgets the last displayed factoid value.")
	bot.Command(forget, "forget that",
		"forget  -- Forgets the last displayed factoid value.")
	bot.Command(info, "fact info",
		"fact info <key>  -- Displays some stats about factoid <key>.")
	bot.Command(literal, "literal",
		"literal <key>  -- Displays the factoid values stored for <key>.")
	bot.Command(replace, "replace that with",
		"replace  -- Replaces the last displayed factoid value.")
	bot.Command(search, "fact search",
		"fact search <regexp>  -- Searches for factoids matching <regexp>.")
}
コード例 #3
0
ファイル: statsdriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	sc = stats.Init()

	bot.Handle(recordStats, client.PRIVMSG, client.ACTION)

	bot.Command(statsCmd, "lines", "lines [nick]  -- "+
		"display how many lines you [or nick] has said in the channel")
	bot.Command(statsCmd, "stats", "stats [nick]  -- "+
		"display how many lines you [or nick] has said in the channel")
	bot.Command(topten, "topten", "topten  -- "+
		"display the nicks who have said the most in the channel")
	bot.Command(topten, "top10", "top10  -- "+
		"display the nicks who have said the most in the channel")
}
コード例 #4
0
ファイル: karmadriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	kc = karma.Init()

	bot.Handle(recordKarma, client.PRIVMSG, client.ACTION)

	bot.Command(karmaCmd, "karma", "karma <thing>  -- "+
		"Retrieve the karma score of <thing>.")
}
コード例 #5
0
ファイル: seendriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	sc = seen.Init()

	bot.Handle(smoke, client.PRIVMSG, client.ACTION)
	bot.Handle(recordPrivmsg, client.PRIVMSG, client.ACTION)
	bot.Handle(recordJoin, client.JOIN, client.PART)
	bot.Handle(recordNick, client.NICK, client.QUIT)
	bot.Handle(recordKick, client.KICK)

	bot.Command(seenCmd, "seen", "seen <nick> [action]  -- "+
		"display the last time <nick> was seen on IRC [doing action]")
}
コード例 #6
0
ファイル: reminddriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	rc = reminders.Init()
	if push.Enabled() {
		pc = pushes.Init()
	}

	// Set up the handlers and commands.
	bot.Handle(load, client.CONNECTED)
	bot.Handle(unload, client.DISCONNECTED)
	bot.Handle(tellCheck,
		client.PRIVMSG, client.ACTION, client.JOIN, client.NICK)

	bot.Command(tell, "tell", "tell <nick> <msg>  -- "+
		"Stores a message for the (absent) nick.")
	bot.Command(tell, "ask", "ask <nick> <msg>  -- "+
		"Stores a message for the (absent) nick.")
	bot.Command(list, "remind list",
		"remind list  -- Lists reminders set by or for your nick.")
	bot.Command(del, "remind del",
		"remind del <N>  -- Deletes (previously listed) reminder N.")
	bot.Command(set, "remind", "remind <nick> <msg> "+
		"in|at|on <time>  -- Reminds nick about msg at time.")
	bot.Command(snooze, "snooze", "snooze [duration]  -- "+
		"Resets the previously-triggered reminder.")
}
コード例 #7
0
ファイル: quotedriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	qc = quotes.Init()

	bot.Rewrite(quotePlugin)
	bot.Command(add, "qadd", "qadd <quote>  -- Adds a quote to the db.")
	bot.Command(add, "quote add",
		"quote add <quote>  -- Adds a quote to the db.")
	bot.Command(add, "add quote",
		"add quote <quote>  -- Adds a quote to the db.")
	bot.Command(del, "qdel", "qdel #<qID>  -- Deletes a quote from the db.")
	bot.Command(del, "quote del",
		"quote del #<qID>  -- Deletes a quote from the db.")
	bot.Command(del, "del quote",
		"del quote #<qID>  -- Deletes a quote from the db.")
	bot.Command(fetch, "quote #", "quote #<qID>  -- Displays quote <qID>.")
	bot.Command(lookup, "quote",
		"quote <regex>  -- Displays quotes matching <regex>")
}
コード例 #8
0
ファイル: calcdriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	bot.Command(calculate, "calc", "calc <expr>  -- does maths for you")
	bot.Command(date, "date", "date <time/date> [in <zone>] -- "+
		"works out the absolute time for <time/date> [in <zone>]")
	bot.Command(netmask, "netmask", "netmask <ip/cidr>|<ip> <mask>"+
		"  -- calculate IPv4 / IPv6 netmasks")
	bot.Command(chr, "chr", "chr <int>  -- "+
		"prints the character represented by <int> in various formats")
	bot.Command(ord, "ord", "ord <char>  -- "+
		"prints the numeric and UTF-8 representations of <char>")
	bot.Command(convertBase, "base", "base <from>to<to> <num>  -- "+
		"converts <num> from base <from> to base <to>")
	bot.Command(length, "length", "length <string>  -- "+
		"prints the length of <string>")
}
コード例 #9
0
ファイル: markovdriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	mc = markov.Init()

	bot.Handle(recordMarkov, client.PRIVMSG, client.ACTION)
	bot.Rewrite(insultPlugin)

	bot.Command(enableMarkov, "markov me", "markov me  -- "+
		"Enable recording of your public messages to generate chains.")
	bot.Command(disableMarkov, "don't markov me", "don't markov me  -- "+
		"Disable (and delete) recording of your public messages.")
	bot.Command(disableMarkov, "don't markov me, bro", "don't markov me  -- "+
		"Disable (and delete) recording of your public messages.")
	bot.Command(randomCmd, "markov", "markov <nick>  -- "+
		"Generate random sentence for given <nick>.")
	bot.Command(insult, "insult", "insult <nick>  -- Insult <nick> at random.")
	bot.Command(learn, "learn", "learn <tag> <sentence>  -- "+
		"Learns a sentence for a particular.")
}
コード例 #10
0
ファイル: netdriver.go プロジェクト: gundalow/sp0rkle
func Init() {
	bot.Command(urbanDictionary, "ud", "ud <term>  -- "+
		"Look up <term> on UrbanDictionary.")

	mcConf = conf.Ns("mc")
	srv := mcConf.String(mcServer)
	if srv != "" {
		if st, err := pollServer(srv); err == nil {
			logging.Info("Starting MC poller for '%s'", srv)
			bot.Poll(st)
			bot.Handle(func(ctx *bot.Context) {
				st.Topic(ctx)
			}, "332")
		} else {
			logging.Error("Not starting MC poller: %v", err)
		}
	}
	bot.Command(mcSet, "mc set", "mc set <key> <value>  -- "+
		"Set minecraft server polling config vars.")
	// TODO(fluffle): Polling can only be en/disabled at reconnect.
	//	bot.Command(mcPoll, "mc poll", "mc poll start|stop  -- "+
	//		"Enable or disable minecraft server polling.")

	if *githubToken != "" {
		rc = reminders.Init()
		gh = githubClient()

		bot.Handle(githubWatcher, client.PRIVMSG)

		bot.Command(githubCreateIssue, "file bug:", "file bug: <title>. "+
			"<descriptive body>  -- Files a bug on GitHub. Abusers will be hurt.")
		bot.Command(githubCreateIssue, "file bug", "file bug <title>. "+
			"<descriptive body>  -- Files a bug on GitHub. Abusers will be hurt.")
		bot.Command(githubCreateIssue, "report bug", "report bug <title>. "+
			"<descriptive body>  -- Files a bug on GitHub. Abusers will be hurt.")
		bot.Command(githubUpdateIssue, "update bug #", "update bug #<number> "+
			"<comment>  -- Adds a comment to bug <number>. Abusers will be hurt.")
	}

	if push.Enabled() {
		pc = pushes.Init()
		bot.Command(pushEnable, "push enable", "push enable  -- "+
			"Start the OAuth flow to enable pushbullet notifications.")
		bot.Command(pushDisable, "push disable", "push disable  -- "+
			"Disable pushbullet notifications and delete tokens.")
		bot.Command(pushConfirm, "push auth", "push auth <pin>  -- "+
			"Confirm pushed PIN to finish pushbullet auth dance.")
		bot.Command(pushAddAlias, "push add alias", "push add alias  -- "+
			"Add a push alias for your nick.")
		bot.Command(pushDelAlias, "push del alias", "push del alias  -- "+
			"Delete a push alias for your nick.")

		http.HandleFunc("/oauth/auth", pushAuthHTTP)
		http.HandleFunc("/oauth/device", pushDeviceHTTP)
		http.HandleFunc("/oauth/success", pushSuccessHTTP)
		http.HandleFunc("/oauth/failure", pushFailureHTTP)
	}
}
コード例 #11
0
ファイル: urldriver.go プロジェクト: gundalow/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.Handle(urlScan, client.PRIVMSG)

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

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

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

	bot.Command(cache, "cache that", "cache that  -- "+
		"caches the last mentioned URL.")
	bot.Command(cache, "cache", "cache <url>  -- caches <url>")
	bot.Command(cache, "save that", "save that  -- "+
		"caches the last mentioned URL.")
	bot.Command(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))))
}