Ejemplo n.º 1
0
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.")
}
Ejemplo n.º 2
0
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>.")
}
Ejemplo n.º 3
0
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)
	}
}
Ejemplo n.º 4
0
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]")
}
Ejemplo n.º 5
0
func Init() {
	kc = karma.Init()

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

	bot.Command(karmaCmd, "karma", "karma <thing>  -- "+
		"Retrieve the karma score of <thing>.")
}
Ejemplo n.º 6
0
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")
}
Ejemplo n.º 7
0
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.")
}
Ejemplo n.º 8
0
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))))
}