function DoChatBarFocus()if not ChatWindow:GetCoreGuiEnabled()then return end if not ChatBar:GetEnabled()then return end if not ChatBar:IsFocused()and ChatBar:GetVisible()then moduleApiTable:SetVisible(true)InstantFadeIn()ChatBar:CaptureFocus()moduleApiTable.ChatBarFocusChanged:fire(true)end end chatBarFocusChanged.Event:connect(function(d)moduleApiTable.ChatBarFocusChanged:fire(d)end)function DoSwitchCurrentChannel(d)if ChatWindow:GetChannel(d)then ChatWindow:SwitchCurrentChannel(d)end end function SendMessageToSelfInTargetChannel(d,x,z)local q=ChatWindow:GetChannel(x)if q then local N={ID=-1,FromSpeaker=nil;SpeakerUserId=0;OriginalChannel=x;IsFiltered=true;MessageLength=string.len(d),MessageLengthUtf8=utf8.len(utf8.nfcnormalize(d)),Message=trimTrailingSpaces(d);MessageType=ChatConstants.MessageTypeSystem,Time=os.time();ExtraData=z}q:AddMessageToChannel(N)end end function chatBarFocused()if not mouseIsInWindow then DoBackgroundFadeIn()if textIsFaded then DoTextFadeIn()end end chatBarFocusChanged:Fire(true)end


function DoChatBarFocus()
	if (not ChatWindow:GetCoreGuiEnabled()) then return end
	if (not ChatBar:GetEnabled()) then return end

	if (not ChatBar:IsFocused() and ChatBar:GetVisible()) then
		moduleApiTable:SetVisible(true)
		InstantFadeIn()
		ChatBar:CaptureFocus()
		moduleApiTable.ChatBarFocusChanged:fire(true)
	end
end

chatBarFocusChanged.Event:connect(function(focused)
	moduleApiTable.ChatBarFocusChanged:fire(focused)
end)

function DoSwitchCurrentChannel(targetChannel)
	if (ChatWindow:GetChannel(targetChannel)) then
		ChatWindow:SwitchCurrentChannel(targetChannel)
	end
end

function SendMessageToSelfInTargetChannel(message, channelName, extraData)
	local channelObj = ChatWindow:GetChannel(channelName)
	if (channelObj) then
		local messageData = {
			ID = -1,
			FromSpeaker = nil,
			SpeakerUserId = 0,
			OriginalChannel = channelName,
			IsFiltered = true,
			MessageLength = string.len(message),
			MessageLengthUtf8 = utf8.len(utf8.nfcnormalize(message)),
			Message = trimTrailingSpaces(message),
			MessageType = ChatConstants.MessageTypeSystem,
			Time = os.time(),
			ExtraData = extraData,
		}

		channelObj:AddMessageToChannel(messageData)
	end
end

function chatBarFocused()
	if (not mouseIsInWindow) then
		DoBackgroundFadeIn()
		if (textIsFaded) then
			DoTextFadeIn()
		end
	end

	chatBarFocusChanged:Fire(true)
end
