This commit is contained in:
shoopea 2021-11-13 14:23:40 +08:00
parent 11ec55ba70
commit ccd41c2e1b
3 changed files with 7 additions and 27 deletions

10
bot.go
View File

@ -309,13 +309,9 @@ func botSay(m *tb.Message) {
msg := r.ReplaceAllString(m.Text, "${Message}") msg := r.ReplaceAllString(m.Text, "${Message}")
px := PacketServerChat{ px := PacketAdminRCon{
Packet: Packet{PType: AdminPacketServerChat}, Packet: Packet{PType: AdminPacketAdminRCon},
ActionID: AdminNetworkActionChat, Command: fmt.Sprintf("say %s", msg),
DestinationID: AdminDestinationTypeBroadcast,
ClientID: 4294967295,
Message: msg,
Amount: 0,
} }
srv.Send(px.Bytes()) srv.Send(px.Bytes())

View File

@ -505,22 +505,6 @@ func (p *PacketServerChat) Read(b []byte) {
p.Amount = binary.LittleEndian.Uint64(bs[0:]) p.Amount = binary.LittleEndian.Uint64(bs[0:])
} }
func (p *PacketServerChat) Bytes() []byte {
buf := new(bytes.Buffer)
p.PLength = uint16(len(p.Message) + 17)
binary.Write(buf, binary.LittleEndian, p.PLength)
binary.Write(buf, binary.LittleEndian, p.ActionID)
binary.Write(buf, binary.LittleEndian, p.DestinationID)
binary.Write(buf, binary.LittleEndian, p.ClientID)
buf.WriteString(p.Message)
buf.WriteByte(0)
binary.Write(buf, binary.LittleEndian, p.Amount)
return buf.Bytes()
}
func (p *PacketServerConsole) Read(b []byte) { func (p *PacketServerConsole) Read(b []byte) {
r := bufio.NewReader(bytes.NewReader(b)) r := bufio.NewReader(bytes.NewReader(b))
r.Discard(3) r.Discard(3)

View File

@ -1,6 +1,6 @@
// Code generated by version.sh (@generated) DO NOT EDIT. // Code generated by version.sh (@generated) DO NOT EDIT.
package main package main
var githash = "40a0b5e" var githash = "11ec55b"
var buildstamp = "2021-11-13_05:56:40" var buildstamp = "2021-11-13_06:23:25"
var commits = "194" var commits = "197"
var version = "40a0b5e-b194 - 2021-11-13_05:56:40" var version = "11ec55b-b197 - 2021-11-13_06:23:25"