Fix luacheck

Fix luacheck warnings in spam.lua

Fix global variable initialization (was needed only locally)

Add beerchat to luacheck
This commit is contained in:
Niklp 2023-12-29 23:34:24 +01:00 committed by Athozus
parent 103c4ae441
commit c5fd218415
2 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,8 @@ globals = {
read_globals = { read_globals = {
-- Stdlib -- Stdlib
string = {fields = {"split"}}, string = {fields = {"split"}},
table = {fields = {"copy", "getn"}}, table = {fields = {"copy", "getn", "indexof"}},
beerchat = {fields = {"has_player_muted_player", "execute_callbacks"}},
-- Minetest -- Minetest
"minetest", "minetest",

View File

@ -28,7 +28,7 @@ local function words_ratio(str, ratio)
end end
function mail.check_spam(message) function mail.check_spam(message)
spam_checks = {} local spam_checks = {}
if caps_ratio(message.subject) == 1 or caps_ratio(message.body) > 0.4 then if caps_ratio(message.subject) == 1 or caps_ratio(message.body) > 0.4 then
table.insert(spam_checks, "caps") table.insert(spam_checks, "caps")
end end