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.") }
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) } }
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.") }