Add 1.21.1 chat support (#284)

Merge this without verification. Otherwise can't be reviewed in the further updates.
This commit is contained in:
Tnze
2024-12-24 11:20:05 +08:00
committed by GitHub
parent 9a1f543137
commit 539b4a3a7f
5 changed files with 115 additions and 15 deletions

View File

@ -58,3 +58,16 @@ func (m *Message) UnmarshalJSON(raw []byte) (err error) {
return errors.New("unknown chat message type: '" + string(raw[0]) + "'")
}
}
func (t *TranslateArgs) UnmarshalJSON(raw []byte) error {
var v []Message
err := json.Unmarshal(raw, &v)
if err != nil {
return err
}
for _, v := range v {
*t = append(*t, v)
}
return nil
}