# Chat Listener The {ref}`Chat Listener` is a tool that allows you to listen for chat messages and run `OnMessage` callbacks which should be thread safe. You can debug incoming messages by adding this compiler directive before you include WaspLib: ```pascal {$DEFINE WL_DEBUG_CHAT_LISTENER} ``` For more information on listeners and how to run them check {ref}`Listeners`. - - - (TChatMessage)= ## TChatMessage type Type representing a chat message. - - - ## ChatListener.GetIronManType ```pascal function TChatListener.GetIronManType(trgt: TTarget) : ERSIronMan; ``` Very similar to {ref}`Chat.GetIronManType`. Returns the account ironman type. Example: ```pascal WriteLn ChatListener.GetIronManType(Target); ``` - - - ## ChatListener.GetMessage ```pascal function TChatListener.GetMessage(trgt: TTarget; line: Integer): TChatMessage; ``` Very similar to `Chat.GetMessage` when the chat is not transparent in how it works. Gets the message on the last `Chat` `line`. Example: ```pascal WriteLn ChatListener.GetMessage(Target, 5); ``` - - - ## ChatListener.GetTransparentMessage ```pascal function TChatListener.GetTransparentMessage(trgt: TTarget; line: Integer): TChatMessage; ``` Very similar to `Chat.GetMessage` for transparent messages in how it works. Gets the message on the last `Chat` `line`. Example: ```pascal WriteLn ChatListener.GetTransparentMessage(Target, 5); ``` - - - ## ChatListener.Check ```pascal function TChatListener.Check(): Boolean; ``` Returns true if there's been new messages. Example: ```pascal WriteLn ChatListener.Check(); ``` - - - ## ChatListener variable Global {ref}`TChatListener` variable.