mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 22:34:56 +00:00
32 lines
543 B
Lua
32 lines
543 B
Lua
local M = {}
|
|
|
|
local banned_terms = {
|
|
"spam",
|
|
"scam",
|
|
"phish",
|
|
"abuse"
|
|
}
|
|
|
|
function M.flag_post(post)
|
|
local content = post.content or ""
|
|
local reasons = {}
|
|
|
|
if #content > 5000 then
|
|
table.insert(reasons, "Post exceeds 5000 characters")
|
|
end
|
|
|
|
local lowered = string.lower(content)
|
|
for _, term in ipairs(banned_terms) do
|
|
if string.find(lowered, term, 1, true) then
|
|
table.insert(reasons, "Contains banned term: " .. term)
|
|
end
|
|
end
|
|
|
|
return {
|
|
flagged = #reasons > 0,
|
|
reasons = reasons
|
|
}
|
|
end
|
|
|
|
return M
|