From Garry's Mod
Runs when user cancels/finishes typing.
Prints "User has closed the chatbox." when player closes their chat or sends the message.
hook.Add( "FinishChat", "ClientFinishTyping", function() print( "User has closed the chatbox." ) end)