update 1.19.2 bot, chat support

This commit is contained in:
Tnze
2022-11-26 15:58:31 +08:00
parent 6a3589ad61
commit 7814e7b1ab
20 changed files with 532 additions and 136 deletions

View File

@ -17,12 +17,12 @@ type Packet struct {
}
// Marshal generate Packet with the ID and Fields
func Marshal(id int32, fields ...FieldEncoder) (pk Packet) {
func Marshal[ID ~int32 | int](id ID, fields ...FieldEncoder) (pk Packet) {
var pb Builder
for _, v := range fields {
pb.WriteField(v)
}
return pb.Packet(id)
return pb.Packet(int32(id))
}
// Scan decode the packet and fill data into fields