Whoops, forgot how things worked.

This commit is contained in:
topkecleon 2016-05-20 03:34:52 -04:00
parent b55d430cd2
commit a786beada6

View File

@ -106,15 +106,15 @@ administration.flags = {
} }
administration.antiflood = { administration.antiflood = {
text = 5, text = 10,
voice = 5, voice = 10,
audio = 5, audio = 10,
contact = 5, contact = 10,
photo = 10, photo = 20,
video = 10, video = 20,
location = 10, location = 20,
document = 10, document = 20,
sticker = 20 sticker = 40
} }
administration.ranks = { administration.ranks = {
@ -277,9 +277,9 @@ function administration.init_command(self_)
-- antisquig -- antisquig
if group.flags[2] and ( if group.flags[2] and (
msg.text:match('[\216-\219][\128-\191]') msg.text:match(utilities.char.arabic)
or msg.text:match('') or msg.text:match(utilities.char.rtl)
or msg.text:match('') or msg.text:match(utilities.char.flush_right)
) then ) then
user.do_kick = true user.do_kick = true
user.reason = 'antisquig' user.reason = 'antisquig'
@ -288,9 +288,9 @@ function administration.init_command(self_)
-- antisquig++ -- antisquig++
if group.flags[3] and ( if group.flags[3] and (
msg.from.name:match('[\216-\219][\128-\191]') msg.from.name:match(utilities.char.arabic)
or msg.from.name:match('') or msg.from.name:match(utilities.char.rtl)
or msg.from.name:match('') or msg.from.name:match(utilities.char.flush_right)
) then ) then
user.do_kick = true user.do_kick = true
user.reason = 'antisquig++' user.reason = 'antisquig++'
@ -308,31 +308,30 @@ function administration.init_command(self_)
if not self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] then if not self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] then
self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = 0 self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = 0
end end
local user_flood = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str]
if msg.sticker then -- Thanks Brazil for discarding switches. if msg.sticker then -- Thanks Brazil for discarding switches.
user_flood = user_flood + group.antiflood.sticker self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.sticker
elseif msg.photo then elseif msg.photo then
user_flood = user_flood + group.antiflood.photo self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.photo
elseif msg.document then elseif msg.document then
user_flood = user_flood + group.antiflood.document self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.document
elseif msg.audio then elseif msg.audio then
user_flood = user_flood + group.antiflood.audio self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.audio
elseif msg.contact then elseif msg.contact then
user_flood = user_flood + group.antiflood.contact self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.contact
elseif msg.video then elseif msg.video then
user_flood = user_flood + group.antiflood.video self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.video
elseif msg.location then elseif msg.location then
user_flood = user_flood + group.antiflood.location self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.location
elseif msg.voice then elseif msg.voice then
user_flood = user_flood + group.antiflood.voice self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.voice
else else
user_flood = user_flood + group.antiflood.text self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] + group.antiflood.text
end end
if user_flood > 99 then if self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] > 99 then
user.do_kick = true user.do_kick = true
user.reason = 'antiflood' user.reason = 'antiflood'
user.output = administration.flags[5].kicked:gsub('GROUPNAME', msg.chat.title) user.output = administration.flags[5].kicked:gsub('GROUPNAME', msg.chat.title)
user_flood = nil self.admin_temp.flood[msg.chat.id_str][msg.from.id_str] = nil
end end
end end
@ -364,9 +363,9 @@ function administration.init_command(self_)
-- antisquig++ -- antisquig++
if group.flags[3] and ( if group.flags[3] and (
newguy.name:match('[\216-\219][\128-\191]') newguy.name:match(utilities.char.arabic)
or newguy.name:match('') or newguy.name:match(utilities.char.rtl)
or newguy.name:match('') or newguy.name:match(utilities.char.flush_right)
) then ) then
new_user.do_kick = true new_user.do_kick = true
new_user.reason = 'antisquig++' new_user.reason = 'antisquig++'
@ -445,7 +444,7 @@ function administration.init_command(self_)
if group.autokicks[msg.from.id_str] >= group.autoban then if group.autokicks[msg.from.id_str] >= group.autoban then
group.autokicks[msg.from.id_str] = 0 group.autokicks[msg.from.id_str] = 0
user.do_ban = true user.do_ban = true
user.reason = 'antiflood autoban' user.reason = 'antiflood autoban: ' .. user.reason
user.output = 'You have been banned for being autokicked too many times.' user.output = 'You have been banned for being autokicked too many times.'
end end
end end
@ -938,7 +937,7 @@ function administration.init_command(self_)
for k,v in pairs(group.antiflood) do for k,v in pairs(group.antiflood) do
output = output .. '*'..k..':* `'..v..'`\n' output = output .. '*'..k..':* `'..v..'`\n'
end end
output = output .. '\nUsers will be banned automatically after *' .. group.autoban .. '* autokicks. Configure this with the *autoban* keyword.' output = output .. 'Users will be banned automatically after *' .. group.autoban .. '* autokicks. Configure this with the *autoban* keyword.'
end end
bindings.sendMessage(self, msg.chat.id, output, true, msg.message_id, true) bindings.sendMessage(self, msg.chat.id, output, true, msg.message_id, true)
end end