-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.go
67 lines (54 loc) · 1.65 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// DailyGakki - gakki
// 2020-10-17 13:41
// Benny <[email protected]>
package main
import (
"fmt"
"os"
"runtime"
"time"
)
import (
log "github.com/sirupsen/logrus"
tb "gopkg.in/telebot.v3"
)
var b, err = tb.NewBot(tb.Settings{
Token: token,
Poller: &tb.LongPoller{Timeout: 10 * time.Second},
})
func main() {
if err != nil {
log.Panicf("Please check your network or TOKEN! %v", err)
}
_ = db.AutoMigrate(&User{}, &Chat{})
log.SetOutput(os.Stdout)
log.SetReportCaller(true)
Formatter := &log.TextFormatter{
EnvironmentOverrideColors: true,
FullTimestamp: true,
TimestampFormat: "2006-01-02 15:04:05",
CallerPrettyfier: func(f *runtime.Frame) (string, string) {
return fmt.Sprintf("[%s()]", f.Function), ""
},
}
log.SetFormatter(Formatter)
// toilet KeepMe.Run -f smblock
banner := fmt.Sprintf(`
▌ ▌ ▌ ▌ ▙▗▌ ▌ ▗
▌▖▌▝▀▖▌ ▌▛▀▖▝▀▖▞▀▖▌▗▘ ▌▘▌▝▀▖▞▀▖▛▀▖▄ ▛▀▖▞▀▖
▙▚▌▞▀▌▚▄▌▌ ▌▞▀▌▌ ▖▛▚ ▌ ▌▞▀▌▌ ▖▌ ▌▐ ▌ ▌▛▀
▘ ▘▝▀▘▗▄▘▀▀ ▝▀▘▝▀ ▘ ▘ ▘ ▘▝▀▘▝▀ ▘ ▘▀▘▘ ▘▝▀▘
By %s
Across the Great Wall, we can reach every corner in the world.
`, "BennyThink")
fmt.Printf("\n %c[1;32m%s%c[0m\n\n", 0x1B, banner, 0x1B)
b.Handle("/start", startHandler)
b.Handle("/about", aboutHandler)
b.Handle("/ping", pingHandler)
b.Handle("/stop", stopAIHandler)
b.Handle(tb.OnText, mainEntrance)
//b.Handle(tb.OnText, testEntrance)
b.Handle(&btnPrev, buttonCallback)
log.Infoln("I'm running...")
b.Start()
}