Skip to content

Commit

Permalink
fix: 私域无法监听到非 AT 事件 & 增加 -p -r 参数
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Oct 18, 2023
1 parent e4de729 commit 286acf3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ nanobot [-Tadhst] ID1 ID2 ...
-b run in sandbox api
-d enable debug-level log output
-h print this help
-p only listen to public intent
-r uint
shard index
-s string
qq secret
-t string
Expand Down
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ func main() {
timeout := flag.Int("T", 60, "api timeout (s)")
help := flag.Bool("h", false, "print this help")
sandbox := flag.Bool("b", false, "run in sandbox api")
onlypublic := flag.Bool("p", false, "only listen to public intent")
shardindex := flag.Uint("r", 0, "shard index")
flag.Parse()
if *help {
fmt.Println("Usage:")
Expand All @@ -55,6 +57,10 @@ func main() {
if *debug {
logrus.SetLevel(logrus.DebugLevel)
}
intent := uint32(nano.IntentAll)
if *onlypublic {
intent = nano.IntentPublic
}

sus := make([]string, 0, 16)
for _, s := range flag.Args() {
Expand All @@ -77,8 +83,9 @@ func main() {
AppID: *appid,
Token: *token,
Secret: *secret,
Intents: nano.IntentPublic,
Timeout: time.Duration(*timeout) * time.Second,
SuperUsers: sus,
Timeout: time.Duration(*timeout) * time.Second,
Intents: intent,
ShardIndex: uint16(*shardindex),
})
}

0 comments on commit 286acf3

Please sign in to comment.