local home = os.getenv("HOME")
local excusefile = home.."/.mcabber/mcabbot/mcbot/bofh_excuses.txt"
home = nil
local bofh = { ["desc"] = "Give a BOFH excuse",
["aliases"] = { "excuse" } }
function bofh.cmd (args, botdata, cmd)
local r = {}
if cmd:lower() == "excuse" and args and not args:match("[!%?]+") then
return nil
end
for line in io.lines(excusefile) do table.insert(r, line) end
local len = table.getn(r)
if len == 0 then
return nil, "I have no excuse, Sir... :-("
end
local n = math.random(len)
return "BOFH's excuse: "..r[n]
end
mcbot_register_command("bofh", bofh)