Jump to content

Module:Bot task

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SD0001 (talk | contribs) at 14:13, 22 February 2021. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local getArgs = require('Module:Arguments').getArgs

local p = {}

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

local parameters = {'bot', 'task', 'action', 'namespaces', 'title', 'title_regex', 
	'summary', 'summary_regex', 'min_edits', 'duration', 'alert_page', 'alert_mode', 
	'email_user', 'ping_user'
}

local function has_value (array, val)
    for index, value in ipairs(array) do
        if value == val then
            return true
        end
    end
    return false
end


function p._main(args)
	local str = ''
	for param, value in ipairs(args) do
		if has_value(parameters, param) == true then
			str = str .. param .. ': ' .. value .. ', '
		else 
			str = '<span class=error>Unknown paramter: ' .. param .. ' used</span>'
		end
	end
	return str
end

return p