-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (34 loc) · 1.02 KB
/
main.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 (
_ "embed"
"flag"
"math"
"os"
"runtime/debug"
"time"
"fortio.org/log"
"fortio.org/scli"
)
var (
//go:embed discord.gr
libraryCode string
depth = flag.Int("max-depth", 2500, "Maximum depth of recursion")
maxLen = flag.Int("max-save-len", 2000, "Maximum len of saved identifiers, use 0 for unlimited")
maxDur = flag.Duration("max-duration", 3*time.Second, "Maximum duration of scripts, use 0 for unlimited")
panicF = flag.Bool("panic", false, "Don't catch panic (DEV only)")
)
func main() {
num := flag.Int("n", 100, "Maximum number of messages to keep in memory for possible edit")
scli.ServerMain()
BotToken = os.Getenv("DISCORD_BOT_TOKEN")
if BotToken == "" {
log.Fatalf("DISCORD_BOT_TOKEN must be set")
}
AutoSave = !(os.Getenv("GROL_DISABLE_AUTOSAVE") == "1")
memlimit := debug.SetMemoryLimit(-1)
if memlimit == math.MaxInt64 {
log.Fatalf("Memory limit not set, please set GOMEMLIMIT=1GiB or similar")
}
BotAdmin = os.Getenv("DISCORD_BOT_ADMIN")
os.Exit(Run(*num))
}