local addonName, TC = ...

-- 1. Initialize the AceAddon-3.0 object
local TownCrier = LibStub("AceAddon-3.0"):NewAddon("TownCrier", "AceEvent-3.0", "AceConsole-3.0")
TC.Core = TownCrier

-- ... [Defaults remain the same] ...

function TownCrier:OnInitialize()
    self.db = LibStub("AceDB-3.0"):New("TownCrierDB", TC.Defaults, true)
    TC.db = self.db

    if TC.Options and TC.Options.Initialize then TC.Options:Initialize() end
    if TC.SetupMinimap then TC:SetupMinimap() end

    -- [[ PROFESSIONAL SPLASH SUMMARY ]]
    local ver = "1.2.6" -- Updated Version 
    print("|cFFFFD100TownCrier v" .. ver .. "|r Initialized.")
    print("|cFF888888- Trivia Engine:|r |cFF00FF00Ready|r")
    print("|cFF888888- Broadcaster:|r |cFF00FF00Ready|r")
    print("|cFF888888- Midnight Data:|r |cFF00FF00Loaded|r")
    print("|cFF888888- Auto-Welcome:|r " .. (TC.db.profile.welcomeEnabled and "|cFF00FF00Active|r" or "|cFFFF4444Inactive|r"))
    
    if TC.Broadcaster and TC.Broadcaster.Initialize then
        TC.Broadcaster:Initialize()
    end
end

-- ... [Event handlers remain the same] ...

function TownCrier:ChatCommand(input)
    if not input or input:trim() == "" then
        TC.UI:Toggle()
    elseif input:trim():lower() == "copy" then
        if TC.ChatCopy then TC.ChatCopy:Toggle() end -- New Shortcut 
    else
        LibStub("AceConfigDialog-3.0"):Open("TownCrier")
    end
end

TownCrier:RegisterChatCommand("tc", "ChatCommand")
TownCrier:RegisterChatCommand("towncrier", "ChatCommand")