forked from drakenot/gramarr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandler_start.go
38 lines (29 loc) · 880 Bytes
/
handler_start.go
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
29
30
31
32
33
34
35
36
37
38
package main
import (
"fmt"
"strings"
tb "gopkg.in/tucnak/telebot.v2"
)
func (e *Env) HandleStart(m *tb.Message) {
user, exists := e.Users.User(m.Sender.ID)
var msg []string
msg = append(msg, fmt.Sprintf("Hello, I'm %s! Use these commands to control me:", e.Bot.Me.FirstName))
if !exists {
msg = append(msg, "")
msg = append(msg, "/auth [password] - authenticate with the bot")
}
if exists && user.IsAdmin() {
msg = append(msg, "")
msg = append(msg, "*Admin*")
msg = append(msg, "/users - list all bot users")
}
if exists && (user.IsMember() || user.IsAdmin()) {
msg = append(msg, "")
msg = append(msg, "*Media*")
msg = append(msg, "/addmovie - add a movie")
msg = append(msg, "/addtv - add a tv show")
msg = append(msg, "")
msg = append(msg, "/cancel - cancel the current operation")
}
Send(e.Bot, m.Sender, strings.Join(msg, "\n"))
}