From ccd41c2e1b830ef8fbc0a0225aa7455095af3e5b Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 13 Nov 2021 14:23:40 +0800 Subject: [PATCH] use rcon --- bot.go | 10 +++------- packet.go | 16 ---------------- version.go | 8 ++++---- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/bot.go b/bot.go index 880a4dc..ccf815e 100644 --- a/bot.go +++ b/bot.go @@ -309,13 +309,9 @@ func botSay(m *tb.Message) { msg := r.ReplaceAllString(m.Text, "${Message}") - px := PacketServerChat{ - Packet: Packet{PType: AdminPacketServerChat}, - ActionID: AdminNetworkActionChat, - DestinationID: AdminDestinationTypeBroadcast, - ClientID: 4294967295, - Message: msg, - Amount: 0, + px := PacketAdminRCon{ + Packet: Packet{PType: AdminPacketAdminRCon}, + Command: fmt.Sprintf("say %s", msg), } srv.Send(px.Bytes()) diff --git a/packet.go b/packet.go index 0124403..6893cd5 100644 --- a/packet.go +++ b/packet.go @@ -505,22 +505,6 @@ func (p *PacketServerChat) Read(b []byte) { 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) { r := bufio.NewReader(bytes.NewReader(b)) r.Discard(3) diff --git a/version.go b/version.go index ca21441..74e9fa0 100644 --- a/version.go +++ b/version.go @@ -1,6 +1,6 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "40a0b5e" -var buildstamp = "2021-11-13_05:56:40" -var commits = "194" -var version = "40a0b5e-b194 - 2021-11-13_05:56:40" +var githash = "11ec55b" +var buildstamp = "2021-11-13_06:23:25" +var commits = "197" +var version = "11ec55b-b197 - 2021-11-13_06:23:25"