mirror of
https://github.com/fumiama/ReiBot.git
synced 2026-06-12 14:10:30 +08:00
fix: from.id reflect
This commit is contained in:
3
event.go
3
event.go
@@ -18,6 +18,8 @@ type Event struct {
|
|||||||
UpdateID int
|
UpdateID int
|
||||||
// Value is the non-null field value in Update
|
// Value is the non-null field value in Update
|
||||||
Value any
|
Value any
|
||||||
|
// value is the reflect value of Value
|
||||||
|
value reflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tc *TelegramClient) processEvent(update tgba.Update) {
|
func (tc *TelegramClient) processEvent(update tgba.Update) {
|
||||||
@@ -45,6 +47,7 @@ func (tc *TelegramClient) processEvent(update tgba.Update) {
|
|||||||
Type: tp,
|
Type: tp,
|
||||||
UpdateID: update.UpdateID,
|
UpdateID: update.UpdateID,
|
||||||
Value: f.Interface(),
|
Value: f.Interface(),
|
||||||
|
value: f,
|
||||||
},
|
},
|
||||||
State: State{},
|
State: State{},
|
||||||
Caller: tc,
|
Caller: tc,
|
||||||
|
|||||||
3
rule.go
3
rule.go
@@ -2,7 +2,6 @@ package rei
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@@ -24,7 +23,7 @@ func newctrl(service string, o *ctrl.Options[*Ctx]) Rule {
|
|||||||
if !ctx.Message.Chat.IsPrivate() {
|
if !ctx.Message.Chat.IsPrivate() {
|
||||||
gid = ctx.Message.Chat.ID
|
gid = ctx.Message.Chat.ID
|
||||||
}
|
}
|
||||||
return c.Handler(uintptr(unsafe.Pointer(ctx)), gid, reflect.ValueOf(ctx.Value).Elem().FieldByName("From").FieldByName("ID").Int())
|
return c.Handler(uintptr(unsafe.Pointer(ctx)), gid, ctx.value.FieldByName("From").FieldByName("ID").Int())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user