[Script LUA] Listen to Chat Frame and hide specific words
Hello, I added to my personal addon some lua lines to hide gold sellers and what I consider spam or anyway not interested into.
So I added a filter to CHAT_MSG_WHISPER that goes to something like this
function hide(self, event, message, sender)
if message:find("gold")
then
SendChatMessage("Your message was not delivered due to unwanted words", "WHISPER", nil, sender)
return true
end
end
It works, when someone whispers to me "gold" or a sentence that contains the word "gold", the function triggers and hides the whisper, and at the same time it sends a whisper back to the sender informing him that the message was not delivered to me.
The problem is I don't know why, but the sender gets 2-3 even more messages from me. Like if I had multiple SendChatMessage, but I wrote the command only once.
Any idea about what could be the cause? I want to automatically reply to the "spammers" without flooding them..I just need to send 1 whisper back.
Thanks let me know if you have any help.