Fix: Entferne User von der Stats-Liste, wenn gekickt (falsche Reihenfolge)
This commit is contained in:
		| @@ -48,6 +48,9 @@ function banhammer:kick_user(user_id, chat_id, self, onlykick) | ||||
| 	  chat_id = chat_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 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!' | ||||
|   | ||||
| @@ -80,20 +80,20 @@ function stats:chat_stats(chat_id) | ||||
| end | ||||
|  | ||||
| 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 | ||||
|     -- delete user from redis set, but keep message count | ||||
| 	local hash = 'chat:'..msg.chat.id..':users' | ||||
| 	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) | ||||
|     return msg | ||||
|   end | ||||
|  | ||||
|   -- Ignore service msg | ||||
|   if is_service_msg(msg) then | ||||
|     print('Service message') | ||||
|     return msg | ||||
|   end | ||||
|    | ||||
|   -- Save user on Redis | ||||
|   local hash = 'user:'..msg.from.id | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Andreas Bielawski
					Andreas Bielawski