summaryrefslogtreecommitdiffstats
path: root/handlers/bind.go
blob: cdacf06204e5b0550a7d2bbcca543385e2b56280 (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 Bind struct{}

func (bh Bind) Name() string {
	return "bind"
}

func (bh Bind) Help() string {
	return "binds XMPP resource"
}

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

	if err := xb.Bind(); err != nil {
		return fmt.Sprintf("ERROR: couldn't bind resource: %s.", err)
	}
	return "ok"
}