-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.go
43 lines (37 loc) · 831 Bytes
/
init.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
39
40
41
42
43
package telebot
import (
"flag"
tgbotapi "github.com/aliforever/go-telegram-bot-api"
"os"
"strings"
"github.com/aliforever/go-telebot/generator"
log "github.com/sirupsen/logrus"
)
var (
newFlag string
langsStr string
)
func init() {
flag.StringVar(&newFlag, "new", "", "--new=BOT_TOKEN_HERE")
flag.StringVar(&langsStr, "langs", "", "--langs=Persian,Arabic,French")
flag.Parse()
var langsSlice []string
if langsStr != "" {
langsSlice = strings.Split(langsStr, ",")
}
if newFlag != "" {
defer os.Exit(1)
_, err := tgbotapi.New(newFlag)
if err != nil {
log.Error("error creating new bot", err)
return
}
err = generator.NewBot(newFlag, langsSlice)
if err != nil {
log.Error("error creating new bot", err)
return
}
} else if langsStr != "" {
// TODO: Create a new language file
}
}