I've noticed many custom chat addons that replace the chatframes don't use Blizzard's chat filter system. This isn't guaranteed to work if a user is running one.
Chat filters also can run multiple times according to how many frames are set to receive whisper events. On the same note, if no chatframes are registered to receive whispers, the filter will never run. If you need to reliably have code run regardless of user settings or conflicts with other addons, you need to handle the event yourself.
Lua Code:
local EventFrame=CreateFrame("Frame");
EventFrame:RegisterEvent("CHAT_MSG_WHISPER");-- Need to register an event to receive it
EventFrame:SetScript("OnEvent",function(self,event,msg,sender)
if msg:lower():find("!stats") then-- We're making sure the command is case insensitive by casting it to lowercase before running a pattern check
SendChatMessage("Your response here","WHISPER",nil,sender);
end
end);