Update client emotes list on reload emotes

closes #75
This commit is contained in:
joeyak 2019-03-31 17:33:03 -04:00
parent 4758cd68bd
commit 791df37030
2 changed files with 7 additions and 1 deletions

View File

@ -414,6 +414,7 @@ var commands = &CommandControl{
return fmt.Sprintf("ERROR: %s", err)
}
cl.belongsTo.AddChatMsg(common.NewChatHiddenMessage(common.CdEmote, common.Emotes))
cl.belongsTo.AddModNotice(cl.name + " has reloaded emotes")
common.LogInfof("Loaded %d emotes\n", num)
return fmt.Sprintf("Emotes loaded: %d", num)

View File

@ -226,8 +226,13 @@ func (cr *ChatRoom) AddMsg(from *Client, isAction, isServer bool, msg string) {
t = common.MsgServer
}
cr.AddChatMsg(common.NewChatMessage(from.name, from.color, msg, from.CmdLevel, t))
}
// Add a chat message object to the queue
func (cr *ChatRoom) AddChatMsg(data common.ChatData) {
select {
case cr.queue <- common.NewChatMessage(from.name, from.color, msg, from.CmdLevel, t):
case cr.queue <- data:
default:
common.LogErrorln("Unable to queue chat message. Channel full.")
}