Merge branch 'kick_from_service_msg' into dev
This commit is contained in:
commit
f0798c7ea0
@ -233,6 +233,7 @@ function pre_process_msg(self, msg, config)
|
||||
if plugin.pre_process and msg then
|
||||
-- print('Preprocess '..plugin.name) -- remove comment to restore old behaviour
|
||||
new_msg = plugin:pre_process(msg, self, config)
|
||||
if not new_msg then return end
|
||||
end
|
||||
end
|
||||
return new_msg
|
||||
|
@ -177,8 +177,7 @@ end
|
||||
|
||||
function banhammer:action(msg, config, matches)
|
||||
if not is_sudo(msg, config) then
|
||||
utilities.send_reply(self, msg, config.errors.sudo)
|
||||
return
|
||||
return -- Silent ignore
|
||||
end
|
||||
|
||||
if matches[1] == 'leave' then
|
||||
@ -197,7 +196,13 @@ function banhammer:action(msg, config, matches)
|
||||
if not msg.reply_to_message then
|
||||
return
|
||||
end
|
||||
user_id = msg.reply_to_message.from.id
|
||||
if msg.reply_to_message.new_chat_member then
|
||||
user_id = msg.reply_to_message.new_chat_member.id
|
||||
elseif msg.reply_to_message.left_chat_member then
|
||||
user_id = msg.reply_to_message.left_chat_member.id
|
||||
else
|
||||
user_id = msg.reply_to_message.from.id
|
||||
end
|
||||
end
|
||||
|
||||
if msg.chat.type == 'group' or msg.chat.type == 'supergroup' then
|
||||
@ -224,7 +229,11 @@ function banhammer:action(msg, config, matches)
|
||||
if not msg.reply_to_message then
|
||||
return
|
||||
end
|
||||
user_id = msg.reply_to_message.from.id
|
||||
if msg.reply_to_message.new_chat_member then
|
||||
user_id = msg.reply_to_message.new_chat_member.id
|
||||
else
|
||||
user_id = msg.reply_to_message.from.id
|
||||
end
|
||||
end
|
||||
banhammer:kick_user(user_id, msg.chat.id, self, true)
|
||||
return
|
||||
@ -253,7 +262,11 @@ function banhammer:action(msg, config, matches)
|
||||
if not msg.reply_to_message then
|
||||
return
|
||||
end
|
||||
local user_id = msg.reply_to_message.from.id
|
||||
if msg.reply_to_message.new_chat_member then
|
||||
user_id = msg.reply_to_message.new_chat_member.id
|
||||
else
|
||||
user_id = msg.reply_to_message.from.id
|
||||
end
|
||||
local hash = 'whitelist:user#id'..user_id
|
||||
redis:set(hash, true)
|
||||
utilities.send_reply(self, msg, 'User '..user_id..' whitelisted')
|
||||
@ -264,7 +277,13 @@ function banhammer:action(msg, config, matches)
|
||||
if not msg.reply_to_message then
|
||||
return
|
||||
end
|
||||
local user_id = msg.reply_to_message.from.id
|
||||
if msg.reply_to_message.new_chat_member then
|
||||
user_id = msg.reply_to_message.new_chat_member.id
|
||||
elseif msg.reply_to_message.left_chat_member then
|
||||
user_id = msg.reply_to_message.left_chat_member.id
|
||||
else
|
||||
user_id = msg.reply_to_message.from.id
|
||||
end
|
||||
local hash = 'whitelist:user#id'..user_id
|
||||
redis:del(hash)
|
||||
utilities.send_reply(self, msg, 'User '..user_id..' von der Whitelist entfernt!')
|
||||
@ -330,7 +349,13 @@ function banhammer:action(msg, config, matches)
|
||||
if not msg.reply_to_message then
|
||||
return
|
||||
end
|
||||
local user_id = msg.reply_to_message.from.id
|
||||
if msg.reply_to_message.new_chat_member then
|
||||
user_id = msg.reply_to_message.new_chat_member.id
|
||||
elseif msg.reply_to_message.left_chat_member then
|
||||
user_id = msg.reply_to_message.left_chat_member.id
|
||||
else
|
||||
user_id = msg.reply_to_message.from.id
|
||||
end
|
||||
local hash = 'blocked:'..user_id
|
||||
redis:set(hash, true)
|
||||
utilities.send_reply(self, msg, 'User '..user_id..' darf den Bot nun nicht mehr nutzen.')
|
||||
@ -341,7 +366,13 @@ function banhammer:action(msg, config, matches)
|
||||
if not msg.reply_to_message then
|
||||
return
|
||||
end
|
||||
local user_id = msg.reply_to_message.from.id
|
||||
if msg.reply_to_message.new_chat_member then
|
||||
user_id = msg.reply_to_message.new_chat_member.id
|
||||
elseif msg.reply_to_message.left_chat_member then
|
||||
user_id = msg.reply_to_message.left_chat_member.id
|
||||
else
|
||||
user_id = msg.reply_to_message.from.id
|
||||
end
|
||||
local hash = 'blocked:'..user_id
|
||||
redis:del(hash)
|
||||
utilities.send_reply(self, msg, 'User '..user_id..' darf den Bot wieder nutzen.')
|
||||
|
Reference in New Issue
Block a user