The addon Blizzard_Communities is LoadOnDemand. Out of all actions in the UI that load it, the one that usually gets it first is when your chat channel list updates in FrameXML\ChannelList.lua:101
Lua Code:
function ChannelListMixin:Update()
...
-- Then add community streams
local clubs = C_Club.GetSubscribedClubs();
Communities_LoadUI(); -- here
CommunitiesFrame.CommunitiesList:PredictFavorites(clubs);
CommunitiesUtil.SortClubs(clubs);
...
end
The event you want is ADDON_LOADED after force-loading Communities at login:
Lua Code:
local frame=CreateFrame("frame")
frame:RegisterEvent("ADDON_LOADED")
frame:RegisterEvent("PLAYER_LOGIN")
frame:SetScript("OnEvent",function(self,event,arg1)
if event=="ADDON_LOADED" and arg1=="Blizzard_Communities" then
ChatFrame_AddChannel(DEFAULT_CHAT_FRAME,"Community:XXXXXXX:1")
elseif event=="PLAYER_LOGIN" then
Communities_LoadUI()
end
end)
You don't need to call ChatFrame_RemoveChannel. It's possible that the act of toggling the community loads Communities and for some reason Blizzard doesn't load Communities appropriately at login.