Module:GroupInfobox

local categorization = require('Module:Categorization') local roblox_urls = require('Module:RobloxUrls') local links = require("Dev:Links") local utils = require("Module:Utils") local infobox_utils = require('Module:InfoboxUtils')

local categorize = categorization.categorize_in_namespaces(0)

local p = {}

function p._format_title(args) if args.id == '' then return infobox_utils.error_message(" parameter missing") elseif tonumber(args.id) then return links.link(tostring(roblox_urls.group(args.id)), args.name, "ext") else return infobox_utils.error_message(" must be an integer.") end end

p.format_title = utils.make_wrapper_function(p._format_title)

function p._format_owner(args) return infobox_utils.player_link(args.owner) end

p.format_owner = utils.make_wrapper_function(p._format_owner)

function p._format_activity(args) local activity = args.activity:lower if activity == 'active' then return "Active" .. categorize("Active groups") elseif activity == 'inactive' or activity == 'not active' then return "Inactive" .. categorize("Inactive groups") elseif activity == 'abandoned' or activity == 'dead' then return "Abandoned" .. categorize("Abandoned groups") elseif activity == 'locked' or activity == 'deleted' then return "Locked" .. categorize("Locked groups") else return infobox_utils.error_message(" must be 'active', 'inactive' or 'abandoned'") end end

p.format_activity = utils.make_wrapper_function(p._format_activity)

function p._format_members(args) return infobox_utils.format_number(args.members, 1000, "Groups with less than 15000 members", 15000, "SUSPECTED_NCU") end

p.format_members = utils.make_wrapper_function(p._format_members)

local media_list = { {"twitter","External Twitter.png","https://twitter.com/%s"}, {"youtube","External YouTube.png","https://www.youtube.com/%s"}, {"tiktok","External TikTok.png","https://www.tiktok.com/@%s"}, {"twitch","External Twitch.png","https://www.twitch.tv/%s"}, {"discord","External Discord.png","https://discord.gg/%s"}, {"facebook","External Facebook.png","https://www.facebook.com/%s/"}, {"guilded","External Guilded.png","https://www.guilded.gg/%s/"}, }

function p._format_media(args) local retString = "" for i,v in pairs(media_list) do       if args[v[1]] then retString = retString .. " "       end end if retString ~= "" then retString = retString .. categorize("Pages with social links") end return retString end

p.format_media = utils.make_wrapper_function(p._format_media,true)

return p