Module:Discord

local p = {}

function p.summary(frame) --Define vars linkPrefix = "https://splatoonwiki.org/wiki/" linkPrefixInterwiki = "Special:GoToInterwiki/" linkRegex = "%[%[[^%]%|]*%|?[^%]%|]*%]%]"   --Get input    summary = frame.args[1]

while true do     linkStart, linkEnd = string.find(summary, linkRegex) if linkStart == nil then break end linkTxt = string.sub(summary, linkStart, linkEnd) if string.find(linkTxt, "|") then page = string.sub(string.match(linkTxt, "%[%[[^%]%|]*%|"), 3, -2)       text = string.sub(string.match(linkTxt, "%|[^%]%|]*%]%]"), 2, -3)        interwiki = mw.title.new(page).interwiki ~= ""        if interwiki then summary = summary:sub(0, linkStart-1) .. "[" .. text .. "](" .. linkPrefix .. linkPrefixInterwiki .. string.gsub(page, " ", "%%20") .. ")" ..  summary:sub(linkEnd+1)        else summary = summary:sub(0, linkStart-1) .. "[" .. text .. "](" .. linkPrefix .. string.gsub(page, " ", "%%20") .. ")" ..  summary:sub(linkEnd+1)        end      else        page = string.sub(string.match(linkTxt, "%[%[[^%]%|]*%]%]"), 3, -3)        interwiki = mw.title.new(page).interwiki ~= ""        if interwiki then summary = summary:sub(0, linkStart-1) .. "[" .. page .. "](" .. linkPrefix .. linkPrefixInterwiki .. string.gsub(page, " ", "%%20") .. ")" ..  summary:sub(linkEnd+1)        else summary = summary:sub(0, linkStart-1) .. "[" .. page .. "](" .. linkPrefix .. string.gsub(page, " ", "%%20") .. ")" ..  summary:sub(linkEnd+1)        end      end    end

return summary end

function p.groups(frame) --Define vars linkPrefix = "https://splatoonwiki.org/wiki/" grouppagePrefix = "Grouppage-"

--Get input groups = frame.args[1] r = ""

for group in mw.text.gsplit(groups, ", ") do     r = r .. "[" .. group .. "](" .. linkPrefix .. string.gsub(frame:preprocess(mw.message.new(grouppagePrefix .. group):plain), " ", "%%20") .. "), " end

return r:sub(0, -3) end

return p