summaryrefslogtreecommitdiff
path: root/uptime.go
blob: d0dd89e72b614b1f060b15725a7c29369e8f25f0 (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
package main

import (
	"fmt"
	"time"

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

type Uptime struct {
	Command
	boot time.Time
}

func (u Uptime) Handle(conn *irc.Conn, line *irc.Line) {
	conn.Notice(line.Nick, fmt.Sprint(time.Since(u.boot)))
}

func (_ Uptime) Help() string {
	return "Bot's uptime"
}

func init() {
	Register("uptime", &Uptime{boot: time.Now()})
}