Модуль:RandomMembers
Документацію для цього модуля можна створити у Модуль:RandomMembers/документація
local p = {}
function p.showRandomMembers(frame)
local category = 'Учасники_спільноти_MCC' -- Your category
local results = mw.site:getCategoryMembers({
title = category,
namespace = 0, -- Assuming members are in the main namespace
limit = 500 -- Adjust limit based on expected category size
})
local output = {}
local count = 0
local usedIndices = {}
-- Random selection logic
while count < 4 and count < #results do
local index = math.random(#results)
if not usedIndices[index] then
usedIndices[index] = true
local member = results[index]
table.insert(output, string.format('<p><a href="/wiki/%s">%s</a></p>', mw.uri.encode(member.title, 'WIKI'), member.title))
count = count + 1
end
end
return table.concat(output, "\n")
end
return p