From ab8be5010909d634093122e7e2a21d6c5857d5c8 Mon Sep 17 00:00:00 2001 From: HimbeerserverDE Date: Sat, 14 May 2022 18:55:56 +0200 Subject: [PATCH] Improve PR --- chat.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/chat.go b/chat.go index 027452e..6548388 100644 --- a/chat.go +++ b/chat.go @@ -13,15 +13,17 @@ import ( // about a chat command that's taking long to execute. var ChatCmdTimeout = 10 * time.Second -// DoChatMsg does a chat message +// DoChatMsg handles a chat message string +// as if it was sent by the ClientConn. func (cc *ClientConn) DoChatMsg(msg string) { cmd := &mt.ToSrvChatMsg{Msg: msg} - str, fwd := onChatMsg(cc, cmd) - if len(str) != 0 { - cc.SendChatMsg(str) + result, isCmd := onChatMsg(cc, cmd) + if result != "" { + cc.SendChatMsg(result) } - if fwd { + + if !isCmd { cc.server().SendCmd(cmd) } }