summaryrefslogtreecommitdiffstats
path: root/handlers/presence.go
blob: aae28d0ccb7bacb44e222afd9e789f82774e0501 (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
27
28
package handlers

import (
	"fmt"

	"github.com/bjc/goctl"
)

type Presence struct{}

func (ph Presence) Name() string {
	return "presence"
}

func (ph Presence) Help() string {
	return "sends available presence broadcast"
}

func (ph Presence) Run(_ *goctl.Goctl, args []string) string {
	if xb == nil {
		return "ERROR: bot is not connected."
	}

	if err := xb.Online(); err != nil {
		return fmt.Sprintf("ERROR: sending available presence: %s", err)
	}
	return "ok"
}