Fix up the log messages a lil

Unbutcher inviter
This commit is contained in:
2025-01-08 17:11:07 +01:00
parent fca49c6302
commit d3004019c6
15 changed files with 647 additions and 305 deletions

View File

@@ -88,7 +88,7 @@ function shared.Commander.Init()
end
end
if Heimdall_Data.config.commander.debug then
print(string.format("%s: ret = %s", ModuleName, strjoin(", ", unpack(ret))))
print(string.format("[%s] Command result: %s", ModuleName, strjoin(", ", unpack(ret))))
end
return ret
end
@@ -116,7 +116,7 @@ function shared.Commander.Init()
text[#text + 1] = string.format("%s: %d", class, count)
end
if Heimdall_Data.config.commander.debug then
print(string.format("%s: ret = %s", ModuleName, strjoin(", ", unpack(text))))
print(string.format("[%s] Message text: %s", ModuleName, strjoin(", ", unpack(text))))
end
return text
end
@@ -131,7 +131,7 @@ function shared.Commander.Init()
return text
end
local function CountClassPartitionedStinkies()
if Heimdall_Data.config.commander.debug then print(string.format("%s: CountClassPartitionedStinkies", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Executing: CountClassPartitionedStinkies", ModuleName)) end
local res = CountClassPartitioned(HeimdallStinkies)
if #res == 0 then
return { "No stinkies found" }
@@ -139,7 +139,7 @@ function shared.Commander.Init()
return res
end
local function WhoPartitionedStinkies()
if Heimdall_Data.config.commander.debug then print(string.format("%s: WhoPartitionedStinkies", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Executing: WhoPartitionedStinkies", ModuleName)) end
local res = WhoPartitioned(HeimdallStinkies)
if #res == 0 then
return { "No stinkies found" }
@@ -147,7 +147,7 @@ function shared.Commander.Init()
return res
end
local function CountPartitionedStinkies()
if Heimdall_Data.config.commander.debug then print(string.format("%s: CountPartitionedStinkies", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Executing: CountPartitionedStinkies", ModuleName)) end
local res = CountPartitioned(HeimdallStinkies)
if #res == 0 then
return { "No stinkies found" }
@@ -155,25 +155,25 @@ function shared.Commander.Init()
return res
end
local function HelpRu()
if Heimdall_Data.config.commander.debug then print(string.format("%s: HelpRu", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Executing: HelpRu", ModuleName)) end
return helpMessages.ru
end
local function HelpEn()
if Heimdall_Data.config.commander.debug then print(string.format("%s: HelpEn", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Executing: HelpEn", ModuleName)) end
return helpMessages.en
end
local groupInviteFrame = CreateFrame("Frame")
groupInviteFrame:SetScript("OnEvent", function(self, event, ...)
if Heimdall_Data.config.commander.debug then print(string.format("%s: OnEvent", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Event received", ModuleName)) end
AcceptGroup()
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
C_Timer.NewTimer(0.1, function()
if Heimdall_Data.config.commander.debug then print(string.format("%s: Click", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Click event triggered", ModuleName)) end
_G["StaticPopup1Button1"]:Click()
end, 1)
end)
local function JoinGroup()
if Heimdall_Data.config.commander.debug then print(string.format("%s: JoinGroup", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] JoinGroup command received", ModuleName)) end
groupInviteFrame:RegisterEvent("PARTY_INVITE_REQUEST")
C_Timer.NewTimer(10, function()
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
@@ -181,13 +181,13 @@ function shared.Commander.Init()
return { "+" }
end
local function LeaveGroup()
if Heimdall_Data.config.commander.debug then print(string.format("%s: LeaveGroup", ModuleName)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] LeaveGroup command received", ModuleName)) end
LeaveParty()
return {}
end
---@param target string
local function FollowTarget(target)
if Heimdall_Data.config.commander.debug then print(string.format("%s: FollowTarget: %s", ModuleName, target)) end
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Following target: %s", ModuleName, target)) end
if not target then return end
FollowUnit(target)
return {}
@@ -213,25 +213,25 @@ function shared.Commander.Init()
commanderChannelFrame:RegisterEvent("CHAT_MSG_CHANNEL")
commanderChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
if Heimdall_Data.config.commander.debug then
print(string.format("%s: OnEvent", ModuleName))
print(string.format("[%s] Event received", ModuleName))
shared.dumpTable(Heimdall_Data.config.commander)
end
if not Heimdall_Data.config.commander.enabled then return end
local channelId = select(6, ...)
local _, channelname = GetChannelName(channelId)
if Heimdall_Data.config.commander.debug then
print(string.format("%s: channelname = %s", ModuleName, channelname))
print(string.format("[%s] Channel received: %s", ModuleName, channelname))
end
if channelname ~= Heimdall_Data.config.commander.masterChannel then return end
sender = string.match(sender, "^[^-]+")
if Heimdall_Data.config.commander.debug then
print(string.format("%s: sender = %s", ModuleName, sender))
print(string.format("[%s] Message from: %s", ModuleName, sender))
end
for _, command in ipairs(commands) do
local enabled = Heimdall_Data.config.commander.commands[command.keywordRe] == true or false
if Heimdall_Data.config.commander.debug then
print(string.format("%s: command.keywordRe = %s: %s", ModuleName, command.keywordRe, tostring(enabled)))
print(string.format("[%s] Command match: %s = %s", ModuleName, command.keywordRe, tostring(enabled)))
end
if enabled and
(not command.commanderOnly
@@ -240,7 +240,7 @@ function shared.Commander.Init()
if msg:match(command.keywordRe) then
local messages = command.callback({ strsplit(" ", msg) })
if Heimdall_Data.config.commander.debug then
print(string.format("%s: messages = %s", ModuleName, strjoin(", ", unpack(messages))))
print(string.format("[%s] Messages to send: %s", ModuleName, strjoin(", ", unpack(messages))))
end
for _, message in ipairs(messages) do
---@type Message
@@ -256,5 +256,5 @@ function shared.Commander.Init()
end
end)
print("Heimdall - Commander loaded")
print("[Heimdall] Commander module loaded")
end