Fix noter

This commit is contained in:
2025-01-27 01:03:00 +01:00
parent 9a10386e65
commit 25fe8350a7

View File

@@ -106,9 +106,10 @@ function shared.Noter.Init()
end
end
---@param channel string
---@param index number
---@param note Note
local function PrintNote(index, note)
local function PrintNote(channel, index, note)
if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Printing note at index %d for: %s", ModuleName, index, note.source))
print(string.format("[%s] [%s][%d] %s: %s", ModuleName, note.source, index, note.date, note.note))
@@ -116,14 +117,15 @@ function shared.Noter.Init()
---@type Message
local msg = {
channel = "C",
data = Heimdall_Data.config.noter.masterChannel,
data = channel,
message = string.format("[%s][%d] %s: %s", note.source, index, note.date, note.note)
}
table.insert(shared.messenger.queue, msg)
--table.insert(shared.messenger.queue, msg)
table.insert(shared.networkMessenger.queue, msg)
end
---@param name string
---@param args string[]
local function PrintNotes(name, args)
local function PrintNotes(channel, name, args)
if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Print note command received for: %s", ModuleName, name))
end
@@ -140,7 +142,7 @@ function shared.Noter.Init()
print(string.format("[%s] Printing notes from %d to %d for: %s", ModuleName, start, finish, name))
end
for i = start, finish do
PrintNote(i, notes[i])
PrintNote(channel, i, notes[i])
end
return
end
@@ -181,7 +183,7 @@ function shared.Noter.Init()
print(string.format("[%s] Printing note %s at index %s", ModuleName, name, i))
shared.dumpTable(Heimdall_Data.config.notes[name][i])
end
PrintNote(i, Heimdall_Data.config.notes[name][i])
PrintNote(channel, i, Heimdall_Data.config.notes[name][i])
end
end
end
@@ -251,10 +253,9 @@ function shared.Noter.Init()
end
end
if not ok then
if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Channel %s does not match master channel %s", ModuleName, channelname,
Heimdall_Data.config.noter.masterChannel))
end
--if Heimdall_Data.config.noter.debug then
-- print(string.format("[%s] Channel %s does not match the master channel %s", ModuleName, channelname, Heimdall_Data.config.noter.masterChannel))
--end
return
end
@@ -289,7 +290,7 @@ function shared.Noter.Init()
if note == "delete" then
DeleteNotes(name, args)
elseif string.find(note, "^[%d%.]*$") then
PrintNotes(name, args)
PrintNotes(channelname, name, args)
else
AddNote(name, sender, args)
end