Fix: Entferne User von der Stats-Liste, wenn gekickt (falsche Reihenfolge)
This commit is contained in:
parent
b28ae66707
commit
b11d86c456
@ -48,6 +48,9 @@ function banhammer:kick_user(user_id, chat_id, self, onlykick)
|
|||||||
chat_id = chat_id,
|
chat_id = chat_id,
|
||||||
user_id = user_id
|
user_id = user_id
|
||||||
} )
|
} )
|
||||||
|
local hash = 'chat:'..chat_id..':users'
|
||||||
|
print('User '..user_id..' was kicked/left the chat, deleting them from redis set '..hash)
|
||||||
|
redis:srem(hash, user_id)
|
||||||
if onlykick then return end
|
if onlykick then return end
|
||||||
if not request then return 'User gebannt, aber kicken war nicht erfolgreich. Bin ich Administrator oder ist der User hier überhaupt?' end
|
if not request then return 'User gebannt, aber kicken war nicht erfolgreich. Bin ich Administrator oder ist der User hier überhaupt?' end
|
||||||
return 'User '..user_id..' gebannt!'
|
return 'User '..user_id..' gebannt!'
|
||||||
|
@ -80,20 +80,20 @@ function stats:chat_stats(chat_id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function stats:pre_process(msg, self)
|
function stats:pre_process(msg, self)
|
||||||
-- Ignore service msg
|
|
||||||
if is_service_msg(msg) then
|
|
||||||
print('Service message')
|
|
||||||
return msg
|
|
||||||
end
|
|
||||||
|
|
||||||
if msg.left_chat_member then
|
if msg.left_chat_member then
|
||||||
-- delete user from redis set, but keep message count
|
-- delete user from redis set, but keep message count
|
||||||
local hash = 'chat:'..msg.chat.id..':users'
|
local hash = 'chat:'..msg.chat.id..':users'
|
||||||
local user_id_left = msg.left_chat_member.id
|
local user_id_left = msg.left_chat_member.id
|
||||||
print('User '..user_id_left..' was kicked, deleting him/her from redis set '..hash)
|
print('User '..user_id_left..' was kicked/left the chat, deleting them from redis set '..hash)
|
||||||
redis:srem(hash, user_id_left)
|
redis:srem(hash, user_id_left)
|
||||||
return msg
|
return msg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Ignore service msg
|
||||||
|
if is_service_msg(msg) then
|
||||||
|
print('Service message')
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
|
||||||
-- Save user on Redis
|
-- Save user on Redis
|
||||||
local hash = 'user:'..msg.from.id
|
local hash = 'user:'..msg.from.id
|
||||||
|
Reference in New Issue
Block a user