Fixing a counter crash; trying to get more info on zombie downtime users

This commit is contained in:
Chris Sexton 2013-01-29 16:27:38 -05:00
parent 66a149f2e8
commit 18dcb5884d
2 changed files with 9 additions and 2 deletions

View File

@ -116,6 +116,10 @@ func (p *CounterPlugin) Message(message bot.Message) bool {
return true return true
} else if len(parts) == 1 { } else if len(parts) == 1 {
if len(parts[0]) < 3 {
return false
}
subject := strings.ToLower(nick) subject := strings.ToLower(nick)
itemName := strings.ToLower(parts[0])[:len(parts[0])-2] itemName := strings.ToLower(parts[0])[:len(parts[0])-2]

View File

@ -77,8 +77,11 @@ func (p *DowntimePlugin) Message(message bot.Message) bool {
sort.Sort(entries) sort.Sort(entries)
tops := "The top entries are: " tops := "The top entries are: "
for _, e := range entries { for _, e := range entries {
// filter out ZNC entries // filter out ZNC entries
if !strings.HasPrefix(e.Nick, "*") { if strings.HasPrefix(e.Nick, "*") {
p.remove(e.Nick)
} else {
tops = fmt.Sprintf("%s%s: %s ", tops, e.Nick, time.Now().Sub(e.LastSeen)) tops = fmt.Sprintf("%s%s: %s ", tops, e.Nick, time.Now().Sub(e.LastSeen))
} }
} }
@ -140,7 +143,7 @@ func (p *DowntimePlugin) Event(kind string, message bot.Message) bool {
} else if kind == "PART" { } else if kind == "PART" {
p.remove(strings.ToLower(message.User.Name)) p.remove(strings.ToLower(message.User.Name))
} else { } else {
log.Println("Unknown event: ", message) log.Println("Unknown event: ", kind, message.User, message)
p.record(strings.ToLower(message.User.Name)) p.record(strings.ToLower(message.User.Name))
} }
return false return false