summaryrefslogtreecommitdiffstats
path: root/handlers/stop.go
blob: 8c0432704b38fd95efa764e9fd0a60fcc2b7b4d6 (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 handlers

import "github.com/bjc/goctl"

type Stop struct {
	C chan bool
}

func (sh Stop) Name() string {
	return "stop"
}

func (sh Stop) Help() string {
	return "stops this bot"
}

func (sh Stop) Run(_ *goctl.Goctl, args []string) string {
	if xb != nil {
		xb.Shutdown()
		xb = nil
	}

	sh.C <- true
	return "Stopping"
}