diff options
Diffstat (limited to 'handlers/stop.go')
-rw-r--r-- | handlers/stop.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/handlers/stop.go b/handlers/stop.go new file mode 100644 index 0000000..8c04327 --- /dev/null +++ b/handlers/stop.go @@ -0,0 +1,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" +} |