Closed drig0 closed 8 years ago
Look at this
do
local NUM_MSG_MAX = 5
local TIME_CHECK = 4 -- seconds
local function pre_process(msg)
if msg.service then
return msg
end
local hash = 'user:'..msg.from.id..':msgs'
local msgs = tonumber(redis:get(hash) or 0)
if msgs > NUM_MSG_MAX then
print('User '..msg.from.id..'is flooding '..msgs)
if msg.to.type=="chat" then
local usermember = 'user#id'..msg.from.id
local chatgroup = 'chat#id'..msg.to.id
chat_del_user(chatgroup , usermember, ok_cb, false)
end
msg = nil
end
redis:setex(hash, TIME_CHECK, msgs+1)
return msg
end
local function run(msg, matches)
return
end
return {
description = "Plugin to Check Flood on Group",
usage = {
},
patterns = {
"^!flood$",
},
run = run,
pre_process = pre_process
}
end
You can change time and message check .
thx bro I will look like is in the bot =)
perfect bro very thanks =D =D =D
your Welcome, if solved , close the issue please :smile:
tla that one pluguins kicking the members who make flood !!!!!!!!!!!!!!