A very lazy way would just be to check the first character of the chat message and see if it's an exclamation mark. Of course this will work for any text preceded by !, so if you want it to only work for valid ULX commands you're going to have to go another route.