statbot/processor_levelup.go

42 lines
1.3 KiB
Go

package main
type levelUpStatProcessor struct{}
func (p *levelUpStatProcessor) GetName() string {
return "LevelUp Statistics"
}
func (p *levelUpStatProcessor) GetStatKeys() []string {
return []string{
"levelup-*",
}
}
func (p *levelUpStatProcessor) ProcessMessage(m *Message) {}
func (p *levelUpStatProcessor) ProcessAdminMessage(m *Message) {}
func (p *levelUpStatProcessor) ProcessBotMessage(m *Message) {}
func (p *levelUpStatProcessor) ProcessUserMessage(m *Message) {}
func (p *levelUpStatProcessor) ProcessAdminUserMessage(m *Message) {}
func (p *levelUpStatProcessor) ProcessBotUserMessage(m *Message) {}
func (p *levelUpStatProcessor) ProcessChannelMessage(m *Message) {
// levelup XP, for now, is awarded like this:
// Message in #random: 1 xp
// Message in #general: 2 xp
// Message in any other channel: 3 xp + 1 xp for that channel
chnl, err := getChannelInfo(m.Channel)
if err == nil {
if chnl.Name == "random" {
addUserStat(m.User, "levelup-xp", 1)
} else if chnl.Name == "general" {
addUserStat(m.User, "levelup-xp", 2)
} else {
addUserStat(m.User, "levelup-xp", 3)
addUserStat(m.User, "levelup-xp-"+chnl.Name, 1)
}
}
}
func (p *levelUpStatProcessor) ProcessAdminChannelMessage(m *Message) {}
func (p *levelUpStatProcessor) ProcessBotChannelMessage(m *Message) {}