From 59cef9c4784a95b205809584d6214b32960f78db Mon Sep 17 00:00:00 2001 From: Tyler Gray <42650829+TylerGrayStudent@users.noreply.github.com> Date: Fri, 29 Jan 2021 15:53:01 -0500 Subject: [PATCH 1/2] Update Name2Chat.lua Adding name to chat is ignored if the messgae begins with ! --- Name2Chat.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Name2Chat.lua b/Name2Chat.lua index de38d80..c026e2e 100644 --- a/Name2Chat.lua +++ b/Name2Chat.lua @@ -171,7 +171,13 @@ function Name2Chat:SendChatMessage(msg, chatType, language, channel) (self.db.profile.party and chatType == "PARTY") or (self.db.profile.instance_chat and chatType == "INSTANCE_CHAT") then - msg = "(" .. self.db.profile.name .. "): " .. msg + --TODO Learn how to do a not in LUA + if(string.starts(msg,'!keys')) + then + msg = msg + else + msg = "(" .. self.db.profile.name .. "): " .. msg + end elseif self.db.profile.channel and chatType == "CHANNEL" then --local id, chname = GetChannelName(channel) @@ -197,3 +203,7 @@ function Name2Chat:Safe_Print(msg) self:Print(msg) end end + +function string.starts(String,Start) + return string.sub(String,1,string.len(Start))==Start + end \ No newline at end of file From 6771261ac89361616fa752097df4667f57a144b6 Mon Sep 17 00:00:00 2001 From: Tyler Gray <42650829+TylerGrayStudent@users.noreply.github.com> Date: Fri, 29 Jan 2021 16:12:20 -0500 Subject: [PATCH 2/2] Added option for toggle ignore ! --- Name2Chat.lua | 9 ++++++++- lang/enUS.lua | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Name2Chat.lua b/Name2Chat.lua index c026e2e..5f5f09a 100644 --- a/Name2Chat.lua +++ b/Name2Chat.lua @@ -73,6 +73,12 @@ local Options = { type = "toggle", name = L["hideOnMatchingCharName"], desc = L["hideOnMatchingCharName_desc"], + }, + ignoreExclamationMark = { + order = 9, + type = "toggle", + name = L["ignoreExclamationMark"], + desc = L["ignoreExclamationMark_desc"], } }, } @@ -87,6 +93,7 @@ local Defaults = { debug = false, channel = nil, hideOnMatchingCharName = false, + ignoreExclamationMark = true, }, } @@ -172,7 +179,7 @@ function Name2Chat:SendChatMessage(msg, chatType, language, channel) (self.db.profile.instance_chat and chatType == "INSTANCE_CHAT") then --TODO Learn how to do a not in LUA - if(string.starts(msg,'!keys')) + if(string.starts(msg,'!keys') and self.db.profile.ignoreExclamationMark) then msg = msg else diff --git a/lang/enUS.lua b/lang/enUS.lua index 78e180c..1343e65 100644 --- a/lang/enUS.lua +++ b/lang/enUS.lua @@ -26,3 +26,5 @@ L["party"] = "Party" L["party_desc"] = "Add name to party chat messages (/p)." L["raid"] = "Raid" L["raid_desc"] = "Add name to raid chat messages (/raid)." +L["ignoreExclamationMark"] = "Ignore adding name to chat if the message begings with !keys" +L["ignoreExclamationMark_desc"] = "If the message begins with !keys, the name will be ignored so Astral Keys can work correctly."