1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package qtvstringcmd import ( "github.com/osm/quake/common/buffer" "github.com/osm/quake/protocol/qtv" ) type Command struct { String string } func (cmd *Command) Bytes() []byte { buf := buffer.New() buf.PutUint16(uint16(1+2+len(cmd.String)) + 1) buf.PutByte(byte(qtv.CLCStringCmd)) buf.PutString(cmd.String) return buf.Bytes() }