mirror of https://github.com/velour/catbase.git
Fixing a counter crash; trying to get more info on zombie downtime users
This commit is contained in:
parent
66a149f2e8
commit
18dcb5884d
|
@ -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]
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue