Add document for chat.Message.Append() method

This commit is contained in:
Tnze
2022-04-26 10:11:41 +08:00
parent 39d6998cda
commit 197e37017c

View File

@ -134,6 +134,8 @@ func (m Message) WriteTo(w io.Writer) (int64, error) {
return pk.String(code).WriteTo(w) return pk.String(code).WriteTo(w)
} }
// Append extra message to the end of the message and return the new one.
// The source message remains unchanged.
func (m Message) Append(extraMsg ...Message) Message { func (m Message) Append(extraMsg ...Message) Message {
origLen := len(m.Extra) origLen := len(m.Extra)
finalLen := origLen + len(extraMsg) finalLen := origLen + len(extraMsg)