Implement printing last N notes
This commit is contained in:
@@ -103,6 +103,22 @@ function shared.Noter.Init()
|
||||
print(string.format("[%s] Print note command received for: %s", ModuleName, name))
|
||||
end
|
||||
local range = args[3]
|
||||
if not range then
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] No range specified for print note, defaulting to last %d notes", ModuleName,
|
||||
Heimdall_Data.config.noter.lastNotes))
|
||||
end
|
||||
local notes = Heimdall_Data.config.notes[name] or {}
|
||||
local start = math.max(1, #notes - Heimdall_Data.config.noter.lastNotes + 1)
|
||||
local finish = #notes
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Printing notes from %d to %d for: %s", ModuleName, start, finish, name))
|
||||
end
|
||||
for i = start, finish do
|
||||
PrintNote(notes[i])
|
||||
end
|
||||
return
|
||||
end
|
||||
if range then
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Range received for print note: %s", ModuleName, range))
|
||||
@@ -213,15 +229,17 @@ function shared.Noter.Init()
|
||||
end
|
||||
local command = args[1]
|
||||
if command == "note" then
|
||||
local name = strtrim(string.lower(args[2]))
|
||||
local name = strtrim(string.lower(args[2] or ""))
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Note command received for: %s", ModuleName, name))
|
||||
end
|
||||
local note = strtrim(args[3])
|
||||
local note = strtrim(args[3] or "")
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Note: %s", ModuleName, note))
|
||||
end
|
||||
if note == "delete" then
|
||||
DeleteNotes(name, args)
|
||||
-- Incorrect... We do not NEED a range for print, we also print last N if we say "note <name>", fix this
|
||||
elseif string.find(note, "%d") then
|
||||
elseif string.find(note, "[%d%.]*") then
|
||||
PrintNotes(name, args)
|
||||
else
|
||||
AddNote(name, sender, args)
|
||||
|
||||
Reference in New Issue
Block a user