Пример #1
0
// 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)
	}
}
Пример #2
0
// 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)
		}
	}
}
Пример #3
0
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))
		}
	}
}
Пример #4
0
// 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)
	}
}
Пример #5
0
// 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)
	}
}