Skip to content

Commit

Permalink
Don't add ourserves to redis ban
Browse files Browse the repository at this point in the history
  • Loading branch information
yagop committed Nov 15, 2015
1 parent 3494ba7 commit 9dd6b4d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions plugins/banhammer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ local function kick_user(user_id, chat_id)
end

local function ban_user(user_id, chat_id)
-- Save to redis
local hash = 'banned:'..chat_id..':'..user_id
redis:set(hash, true)
-- Kick from chat
kick_user(user_id, chat_id)
local chat = 'chat#id'..chat_id
if user_id == tostring(our_id) then
send_msg(chat, "I won't kick myself!", ok_cb, true)
else
-- Save to redis
local hash = 'banned:'..chat_id..':'..user_id
redis:set(hash, true)
-- Kick from chat
kick_user(user_id, chat_id)
end
end

local function is_banned(user_id, chat_id)
Expand Down

0 comments on commit 9dd6b4d

Please sign in to comment.