And also check if he send the command or you did...
(That's why it was looping)
Mattike already pointed this out
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
if(Message.match(/hello/i) && Origin != Messenger.MyName)
{
ChatWnd.SendMessage('Hi')
}
}