summaryrefslogtreecommitdiff
path: root/top.go
blob: 10a557f6e2380c1deab5dbe5779a125fafe4bd39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main

import (
	"fmt"

	irc "github.com/fluffle/goirc/client"
)

type Top struct{ Command }

func (_ Top) Handle(conn *irc.Conn, line *irc.Line) {
	n := 100
	if line.Public() {
		n = 10
	}
	s := fmt.Sprint(NewScores(n))
	conn.Privmsg(line.Target(), s)
}

func init() {
	Register("top", &Top{
		Command{
			Help: "Top 10 flooder (msg private to see top 100)",
		},
	})
}