Module:Sandbox/SD0001/BAMSection

Revision as of 13:07, 25 October 2021 by imported>SD0001 (del unused code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/SD0001/BAMSection/doc

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

local p = {}

function p.main(frame) 
	local args = getArgs(frame)
	
	local report = mw.title.new('Wikipedia:Bot activity monitor/Report'):getContent()
	local bot = args[1]
	
	-- table start 
	local section = report:match('{|.-!.-|%-\n')
	
	-- entries
	for entry in report:gmatch('| %[%[User:' .. bot .. '|' .. bot .. '%]%].-|%-') do
		section = section .. entry .. '\n'
	end
	
	-- end
	section = section .. '|}'
	
	section = frame:preprocess(section)
	
	return section
end

return p