--- a/mcbot/cmds/mcabber_bts.lua Tue Apr 13 22:45:12 2010 +0200
+++ b/mcbot/cmds/mcabber_bts.lua Wed Apr 14 00:22:03 2010 +0200
@@ -2,6 +2,8 @@
require "libs.shcmd"
local function get_issue_details (num)
+ local item
+
num = tonumber(num);
if not num then return nil end
local issue = {}
@@ -13,6 +15,14 @@
local title = data:match("#"..issue.id.."%s*-%s*(.*)%s*—")
if not title then return nil end
issue.title = title
+
+ -- Get Status
+ item = data:match("Status:%s*</td>%s*<td [^>]*>(.-)</td>")
+ if item then issue.status = item end
+ -- Get Type
+ item = data:match("Type:%s*</td>%s*<td [^>]*>(.-)</td>")
+ if item then issue.type = item end
+
return issue
end
@@ -27,9 +37,17 @@
if not issue then
return nil,"Sorry, couldn't find issue "..tostring(num)
end
- return "Issue #"..issue.id.." -- "..issue.title.."\n"..
- "URL: <"..tostring(issue.url)..">"
+
+ local result = "Issue #"..issue.id.." -- "..issue.title.."\n"
+ if issue.status then
+ result = result .. "Status: " .. issue.status .. "\n"
+ end
+ if issue.type then
+ result = result .. "Type: " .. issue.type .. "\n"
+ end
+ return result .. "URL: <"..tostring(issue.url)..">"
end
mcbot_register_command("bts", mcabber_bts)
mcbot_register_command("bug", mcabber_bts)
+mcbot_register_command("issue", mcabber_bts)