--- a/mcbot/cmds/mcabber_bts.lua Fri Apr 03 22:49:15 2015 +0200
+++ b/mcbot/cmds/mcabber_bts.lua Mon Oct 12 12:42:27 2015 +0200
@@ -23,7 +23,7 @@
num = tonumber(num);
if not num then return nil end
local issue = {}
- local btsurl = "https://bitbucket.org/McKael/mcabber-crew/issue/"
+ local btsurl = "https://bitbucket.org/McKael/mcabber-crew/issues/"
issue.id = tostring(num)
issue.url = btsurl..issue.id.."/"
@@ -31,16 +31,21 @@
if not data then return nil end
local title = data:match("#"..issue.id.."%s*-%s*(.*)%s*—")
if not title then return nil end
- issue.title = title:gsub(""", "\""):gsub("&", "&")
+ issue.title = title
+ issue.title = issue.title:gsub(""", "\""):gsub("&", "&")
issue.title = issue.title:gsub("<", "<"):gsub(">", ">")
issue.title = issue.title:gsub("'", "'")
+ issue.title = issue.title:gsub("[%s\n]+$", "") -- trailing newlines
-- Get Status
- item = data:match("Status:%s*</td>%s*<td [^>]*>(.-)</td>")
+ item = data:match('<a href="[^"]+/issues%?status=(%w+)"')
if item then issue.status = item end
-- Get Type
- item = data:match("Type:%s*</td>%s*<td [^>]*>(.-)</td>")
+ item = data:match('<a href="[^"]+/issues%?kind=(%w+)"')
if item then issue.type = item end
+ -- Get Priority
+ item = data:match('<a href="[^"]+/issues%?priority=(%w+)"')
+ if item then issue.priority = item end
return issue
end
@@ -67,6 +72,9 @@
if issue.type then
result = result .. "Type: " .. issue.type .. "\n"
end
+ if issue.type then
+ result = result .. "Priority: " .. issue.priority .. "\n"
+ end
return result .. "URL: <"..tostring(issue.url)..">"
end