mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Fix parse_message
This commit is contained in:
@@ -323,17 +323,13 @@ local function parse_message(str)
|
|||||||
-- Trimm the spaces of the string
|
-- Trimm the spaces of the string
|
||||||
local trimmed = (string.gsub(str, "^%s*(.-)%s*$", "%1"))
|
local trimmed = (string.gsub(str, "^%s*(.-)%s*$", "%1"))
|
||||||
local message = { title = "", body = "" }
|
local message = { title = "", body = "" }
|
||||||
-- If it doesn't match the patter return the str as a title
|
local title, body = string.match(trimmed, message_pattern)
|
||||||
local match = string.match(trimmed, message_pattern)
|
if not title then
|
||||||
if not match then
|
-- If it doesn't match the patter return the str as a title
|
||||||
message.title = trimmed
|
message.title = trimmed
|
||||||
return message
|
else
|
||||||
end
|
message.title = title
|
||||||
-- If message has multiple lines
|
message.body = body
|
||||||
for key, value in string.gmatch(trimmed, message_pattern) do
|
|
||||||
message.title = key
|
|
||||||
message.body = value
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
return message
|
return message
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user