I’m having some trouble pulling the name of a player sending a message in party chat. Any ideas on an easy way to do this? I was thinking it’d be as simple as below, albeit missing a few lines of code.
function(...)
local playerName = ...
SendChatMessage("", "WHISPER", nil, playerName)
Your SendChatMessage is a whisper but you asked for party chat, so I’m including both:
local f = CreateFrame("Frame")
f:SetScript("OnEvent",function(self,event,text,sender)
print(sender,"just sent via",event,":",text)
end)
f:RegisterEvent("CHAT_MSG_PARTY")
f:RegisterEvent("CHAT_MSG_WHISPER")
If you wanted to limit it to whispers from people in your party, you can use a name with UnitInParty which accepts names as a unit tokens as long as they’re players in your party or raid; though the -realm bit may need stripped off. I forget and don’t have time to test.