1. Hello, im still new to lua, and im kinda stumped, ive been picking apart at a abandoned addon, whos author hasn't logged on curse forged in 2 years. the addon still words and ive been about to update that data and make some minor tweaks. But i want to add a feature to the addon, make it able to switch chat channels without the need to edit the lua file and reloading the game. the chat code it have now as follows,

     local __wgg= {}  
     setmetatable(__wgg, wgg)  
     local frame = CreateFrame("Frame")  
     frame:SetScript("OnEvent", function(_, _, text, author)  
         __wgg:onGuildMessage(text, author)  
     end)  
     frame:RegisterEvent("CHAT _ MSG _ GUILD")  
    
     function wgg:spam(text)  
     SendChatMessage(text, "GUILD")  
     end  
    

    To change the channel it get input and also outputs the data to is static on Guild chat, in current state, unless you change "CHAT _ MSG _ GUILD" and "GUILD", to say for party chat, "CHAT _ MSG _ PARTY" and "PARTY". If there was a way to give it a slash command or even a interface menu window to select different chat types. Ive tried looking at a few different addons lua that had the ability to switch output channels but couldn't figure out a way how i want it to work yet.

    Thanks for your time, and hopfully someone might have an idea i can try

    I'm not entirely sure I follow, but I think you just want to be able to change whether or not he output goes to the guild channel or the party channel. For this you just need to create a saved variable that can be set to some value (probably the strings "guild" and "party") and then within the addon check the value of the saved variable to see which events should be registered and where the message should be directed.

    I'm not entirely sure I follow, but I think you just want to be able to change whether or not he output goes to the guild channel or the party channel. For this you just need to create a saved variable that can be set to some value (probably the strings "guild" and "party") and then within the addon check the value of the saved variable to see which events should be registered and where the message should be directed.