模块:UserlinkUserEditCount
可在模块:UserlinkUserEditCount/doc创建此模块的帮助文档
脚本错误:Lua错误:无法创建进程:proc_open(): Unable to create pipe Too many open files
local p = {}
function p.getUserEditCount(frame)
local username = frame.args[1]
if not username then
return "没有提供用户名"
end
local apiUrl = mw.uri.fullUrl('api.php', {
action = 'query',
list = 'usercontribs',
ucuser = username,
uclimit = 'max',
ucnamespace = 0,
format = 'json'
})
local result = mw.http.fetch(apiUrl)
if result and result.status == 200 then
local data = mw.text.jsonDecode(result.body)
if data and data.query and data.query.usercontribs then
local editCount = #data.query.usercontribs
return "用户 " .. username .. " 的编辑总数为: " .. editCount
end
end
return "无法获取用户编辑总数"
end
return p
