Fix noter
This commit is contained in:
@@ -106,9 +106,10 @@ function shared.Noter.Init()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param channel string
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param note Note
|
---@param note Note
|
||||||
local function PrintNote(index, note)
|
local function PrintNote(channel, index, note)
|
||||||
if Heimdall_Data.config.noter.debug then
|
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] 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))
|
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
|
---@type Message
|
||||||
local msg = {
|
local msg = {
|
||||||
channel = "C",
|
channel = "C",
|
||||||
data = Heimdall_Data.config.noter.masterChannel,
|
data = channel,
|
||||||
message = string.format("[%s][%d] %s: %s", note.source, index, note.date, note.note)
|
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
|
end
|
||||||
---@param name string
|
---@param name string
|
||||||
---@param args string[]
|
---@param args string[]
|
||||||
local function PrintNotes(name, args)
|
local function PrintNotes(channel, name, args)
|
||||||
if Heimdall_Data.config.noter.debug then
|
if Heimdall_Data.config.noter.debug then
|
||||||
print(string.format("[%s] Print note command received for: %s", ModuleName, name))
|
print(string.format("[%s] Print note command received for: %s", ModuleName, name))
|
||||||
end
|
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))
|
print(string.format("[%s] Printing notes from %d to %d for: %s", ModuleName, start, finish, name))
|
||||||
end
|
end
|
||||||
for i = start, finish do
|
for i = start, finish do
|
||||||
PrintNote(i, notes[i])
|
PrintNote(channel, i, notes[i])
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -181,7 +183,7 @@ function shared.Noter.Init()
|
|||||||
print(string.format("[%s] Printing note %s at index %s", ModuleName, name, i))
|
print(string.format("[%s] Printing note %s at index %s", ModuleName, name, i))
|
||||||
shared.dumpTable(Heimdall_Data.config.notes[name][i])
|
shared.dumpTable(Heimdall_Data.config.notes[name][i])
|
||||||
end
|
end
|
||||||
PrintNote(i, Heimdall_Data.config.notes[name][i])
|
PrintNote(channel, i, Heimdall_Data.config.notes[name][i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -251,10 +253,9 @@ function shared.Noter.Init()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not ok then
|
if not ok then
|
||||||
if Heimdall_Data.config.noter.debug then
|
--if Heimdall_Data.config.noter.debug then
|
||||||
print(string.format("[%s] Channel %s does not match master channel %s", ModuleName, channelname,
|
-- print(string.format("[%s] Channel %s does not match the master channel %s", ModuleName, channelname, Heimdall_Data.config.noter.masterChannel))
|
||||||
Heimdall_Data.config.noter.masterChannel))
|
--end
|
||||||
end
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -289,7 +290,7 @@ function shared.Noter.Init()
|
|||||||
if note == "delete" then
|
if note == "delete" then
|
||||||
DeleteNotes(name, args)
|
DeleteNotes(name, args)
|
||||||
elseif string.find(note, "^[%d%.]*$") then
|
elseif string.find(note, "^[%d%.]*$") then
|
||||||
PrintNotes(name, args)
|
PrintNotes(channelname, name, args)
|
||||||
else
|
else
|
||||||
AddNote(name, sender, args)
|
AddNote(name, sender, args)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user