-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
84 lines (72 loc) · 2.62 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package main
import (
"flag"
"fmt"
"github.com/MoYoez/Lucy_reibot/kanban"
rei "github.com/fumiama/ReiBot"
_ "github.com/MoYoez/Lucy_reibot/plugin/chat"
_ "github.com/MoYoez/Lucy_reibot/plugin/chun"
_ "github.com/MoYoez/Lucy_reibot/plugin/fortune"
_ "github.com/MoYoez/Lucy_reibot/plugin/lolicon"
_ "github.com/MoYoez/Lucy_reibot/plugin/mai"
_ "github.com/MoYoez/Lucy_reibot/plugin/phigros"
_ "github.com/MoYoez/Lucy_reibot/plugin/reborn"
_ "github.com/MoYoez/Lucy_reibot/plugin/score"
_ "github.com/MoYoez/Lucy_reibot/plugin/tools"
_ "github.com/MoYoez/Lucy_reibot/plugin/tracemoe"
_ "github.com/MoYoez/Lucy_reibot/plugin/what2eat"
_ "github.com/MoYoez/Lucy_reibot/plugin/wife"
_ "github.com/MoYoez/Lucy_reibot/plugin/action"
_ "github.com/MoYoez/Lucy_reibot/plugin/simai"
_ "github.com/MoYoez/Lucy_reibot/plugin/slash" // slash should be the last
_ "github.com/MoYoez/Lucy_reibot/plugin/stickers"
"os"
"strconv"
"github.com/joho/godotenv"
tgba "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"github.com/sirupsen/logrus"
)
func main() {
_ = godotenv.Load()
token := flag.String("t", os.Getenv("tgbot"), "telegram api token")
buffer := flag.Int("b", 256, "message sequence length")
debug := flag.Bool("d", false, "enable debug-level log output")
offset := flag.Int("o", 0, "the last Update ID to include")
timeout := flag.Int("T", 60, "timeout")
help := flag.Bool("h", false, "print this help")
flag.Parse()
if *help {
fmt.Println("Usage:")
flag.PrintDefaults()
os.Exit(0)
}
if *debug {
logrus.SetLevel(logrus.DebugLevel)
}
sus := make([]int64, 0, 16)
for _, s := range flag.Args() {
i, err := strconv.ParseInt(s, 10, 64)
if err != nil {
continue
}
sus = append(sus, i)
}
rei.OnMessageCommand("help").SetBlock(true).
Handle(func(ctx *rei.Ctx) {
ctx.SendPlainMessage(true, kanban.Banner)
})
rei.Run(rei.Bot{
Token: *token,
Botname: "Lucy",
Buffer: *buffer,
UpdateConfig: tgba.UpdateConfig{
Offset: *offset,
Limit: 0,
Timeout: *timeout,
// AllowedUpdates: []string{"message", "edited_message", "message_reaction", "message_reaction_count", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_member", "chat_join_request", "chat_boost", "removed_chat_boost"},
AllowedUpdates: []string{"message", "edited_message", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_member", "chat_join_request", "chat_boost", "removed_chat_boost"},
},
SuperUsers: sus,
Debug: *debug,
})
}