summaryrefslogtreecommitdiffstats
path: root/handlers/login.go
blob: b516c08ae3c57c225f0e7d155c8eb80f0d4af3ea (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 Login struct{}

func (lh Login) Name() string {
	return "login"
}

func (lh Login) Help() string {
	return "authenticates to server"
}

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

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