// handles `s p1 [, p2] func getSpecificFighters(m *irc.Message) { if m.IsChannelMsg() && m.Parameters[0] == settings.Channel && strings.HasPrefix(m.Trail, "`s ") { data := createFightCard(m.Trail[3:]) opts := &Options{LooseSearch: true} announceFightCard(data, opts) } }
// handles `s commands to get the current fight card func manualFightCard(m *irc.Message) { if m.IsChannelMsg() && m.Parameters[0] == settings.Channel && m.Trail == "`s" { if data, err := spicerack.GetSecretData(settings.TheShiznit); err == nil { announceFightCard(data, nil) } } }
func getUntieredCount(m *irc.Message) { if m.IsChannelMsg() && m.Parameters[0] == settings.Channel && m.Trail == "`u" { db := spicerack.Db(settings.DbUser, settings.DbPass, settings.DbName) defer db.Close() if count, err := db.GetUntieredCount(); err != nil { client.Privmsg(settings.Channel, COUNT_MESSAGE_BAD) } else { client.Privmsg(settings.Channel, fmt.Sprintf(COUNT_MESSAGE_GOOD, count)) } } }
// NickServ registration/confirmation func nickServ(m *irc.Message) { if m.Nick == BOT_ADMIN && strings.HasPrefix(m.Trail, "`") { switch m.Trail[1:2] { case "r": client.Privmsg("NickServ", fmt.Sprintf("register %s %s", settings.Pass, settings.BotEmail)) case "c": token := m.Trail[3:] client.Privmsg("NickServ", fmt.Sprintf("confirm %s", token)) } } else if !m.IsChannelMsg() { // log any private messages the bot gets, why not? log("<%s>: %s", m.Nick, m.Trail) } }
// handles `wl command to announce detailed win/loss page w/ user&pass. func showWLInfo(m *irc.Message) { if m.IsChannelMsg() && m.Parameters[0] == settings.Channel && m.Trail == "`wl" { msg := fmt.Sprintf(WL_MESSAGE, settings.WlAddr, settings.WlUser, settings.WlPass) client.Privmsg(settings.Channel, msg) } }