Improve PR
parent
1da36d94a0
commit
ab8be50109
12
chat.go
12
chat.go
|
@ -13,15 +13,17 @@ import (
|
||||||
// about a chat command that's taking long to execute.
|
// about a chat command that's taking long to execute.
|
||||||
var ChatCmdTimeout = 10 * time.Second
|
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) {
|
func (cc *ClientConn) DoChatMsg(msg string) {
|
||||||
cmd := &mt.ToSrvChatMsg{Msg: msg}
|
cmd := &mt.ToSrvChatMsg{Msg: msg}
|
||||||
|
|
||||||
str, fwd := onChatMsg(cc, cmd)
|
result, isCmd := onChatMsg(cc, cmd)
|
||||||
if len(str) != 0 {
|
if result != "" {
|
||||||
cc.SendChatMsg(str)
|
cc.SendChatMsg(result)
|
||||||
}
|
}
|
||||||
if fwd {
|
|
||||||
|
if !isCmd {
|
||||||
cc.server().SendCmd(cmd)
|
cc.server().SendCmd(cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue