Skip to content

Commit

Permalink
Merge pull request #7 from TylerGrayStudent/master
Browse files Browse the repository at this point in the history
Added ignore option to allow !keys to work for Astral Keys
  • Loading branch information
gOOvER authored Jan 30, 2021
2 parents e147369 + 6771261 commit 112fb7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Name2Chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}
},
}
Expand All @@ -87,6 +93,7 @@ local Defaults = {
debug = false,
channel = nil,
hideOnMatchingCharName = false,
ignoreExclamationMark = true,
},
}

Expand Down Expand Up @@ -171,7 +178,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') and self.db.profile.ignoreExclamationMark)
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)
Expand All @@ -197,3 +210,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
2 changes: 2 additions & 0 deletions lang/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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."

0 comments on commit 112fb7d

Please sign in to comment.