From ed202e0e4814bcbe18fb778f549407b401a8b463 Mon Sep 17 00:00:00 2001 From: Crum Date: Fri, 2 Feb 2018 23:05:20 -0600 Subject: [PATCH] update DelayGuildMOTD function in chat --- 2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua b/2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua index d0041fb..baac11b 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua @@ -1416,17 +1416,21 @@ function CH:DelayGuildMOTD() if delay < 7 then return end local msg = GetGuildRosterMOTD() for i = 1, NUM_CHAT_WINDOWS do + local channel chat = _G["ChatFrame"..i] for k, v in pairs(chat.messageTypeList) do - if chat and v == "GUILD" then - if msg and strlen(msg) > 0 then - local info = ChatTypeInfo["GUILD"] - local string = format(GUILD_MOTD_TEMPLATE, msg) - chat:AddMessage(string, info.r, info.g, info.b, info.id) - end - chat:RegisterEvent("GUILD_MOTD") + if v == "GUILD" then + channel = v end end + if chat and channel then + if msg and strlen(msg) > 0 then + local info = ChatTypeInfo["GUILD"] + local string = format(GUILD_MOTD_TEMPLATE, msg) + chat:AddMessage(string, info.r, info.g, info.b, info.id) + end + chat:RegisterEvent("GUILD_MOTD") + end end this:SetScript("OnUpdate", nil) end)