1
0
mirror of https://github.com/fumiama/ReiBot.git synced 2026-06-18 01:32:58 +08:00

feat: ctx add api Break

This commit is contained in:
源文雨
2022-10-11 00:14:05 +08:00
parent 95250c70dc
commit 73d5f1e597
5 changed files with 27 additions and 6 deletions

View File

@@ -219,6 +219,9 @@ loop:
if m.Engine != nil {
for _, handler := range m.Engine.preHandler {
if !handler(ctx) { // 有 pre handler 未满足
if m.Block { // 阻断后续
break loop
}
continue loop
}
}
@@ -226,6 +229,9 @@ loop:
for _, rule := range m.Rules {
if rule != nil && !rule(ctx) { // 有 Rule 的条件未满足
if m.Block { // 阻断后续
break loop
}
continue loop
}
}
@@ -234,6 +240,9 @@ loop:
if m.Engine != nil {
for _, handler := range m.Engine.midHandler {
if !handler(ctx) { // 有 mid handler 未满足
if m.Block { // 阻断后续
break loop
}
continue loop
}
}