Callback NPC:OnPlayerText is called every time someone says something in the chat. This includes any player, any other NPC, or the same NPC himself.
Callback NPC:OnPlayerText was added in 0.3a and will not work in earlier versions!
For the player version of this callback, check OnPlayerText

(playerid, text[])
int playerid The player who has written something in the chat.
string text The text written by playerid.

Return Values:
This callback does not handle returns.

public OnPlayerText(playerid, text[])
    if (strfind(text, "stupid bot") != -1)
        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Hey %s! Don't say those things! We, bots, are cool!", name);
    return 1;

Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.