[AddOn - lua] Clear "Join Channel" message

[AddOn - lua] Clear "Join Channel" message

by rdrmdr » Sat Mar 26, 2016 8:54 pm

When I join the game, it automatically shows on the chat:
Welcome to Nostalrius Begins! We hope you enjoy your stay, and if you find a Bug in game, please report it on https://report.nostalrius.org .
Joined Channel: [1. General - Elwynn Forest]
Joined Channel: [3. LocalDefense - Elwynn Forest]

and the way I'm trying to clear it is:
Code: Select all
local Frame=CreateFrame("Frame")               --CreateFrame
Frame:RegisterEvent("CHAT_MSG_CHANNEL_NOTICE") --RegisterEvent
Frame:SetScript("OnEvent",function()           --OnEvent
if arg8~=3then return end                      --IfChannelNumber≠3ThenReturn
ChatFrame1:Clear()                             --ClearChatGeneral
end)                                           --EndOfOnEvent
but the
Joined Channel: [3. LocalDefense - Elwynn Forest]
only shows after the addon code run, even though that message is probably activated by the same event.

I don't wanna make a complicated code because that doesn't bothers me that much but if there's a simple way I would love to know about it. Nothing like a timer that runs that code after 1 second...
rdrmdr
Grunt
Grunt
 

Return to Addons & macros