-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.go
More file actions
47 lines (40 loc) · 790 Bytes
/
Copy pathconfig.go
File metadata and controls
47 lines (40 loc) · 790 Bytes
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
44
45
46
47
package main
import (
"log"
"os"
"reflect"
"strconv"
"strings"
_ "github.com/joho/godotenv/autoload"
)
var (
Token = os.Getenv("TOKEN")
ApiId = os.Getenv("API_ID")
ApiHash = os.Getenv("API_HASH")
devIDs = parseDevIDs(os.Getenv("DEV_IDS"))
maxMessageLen = 4000
)
func parseDevIDs(list string) []int64 {
if list == "" {
return nil
}
var ids []int64
for _, s := range strings.Split(list, ",") {
id, err := strconv.ParseInt(strings.TrimSpace(s), 10, 64)
if err != nil {
log.Printf("invalid DEV_ID: %s", s)
continue
}
ids = append(ids, id)
}
return ids
}
var Symbols = map[string]map[string]reflect.Value{}
func IsDev(userID int64) bool {
for _, id := range devIDs {
if id == userID {
return true
}
}
return false
}