summaryrefslogtreecommitdiffstats
path: root/handlers/login.go
diff options
context:
space:
mode:
Diffstat (limited to 'handlers/login.go')
-rw-r--r--handlers/login.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/handlers/login.go b/handlers/login.go
new file mode 100644
index 0000000..b516c08
--- /dev/null
+++ b/handlers/login.go
@@ -0,0 +1,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"
+}