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
|
if plugin.pre_process and msg then
|
||||||
-- print('Preprocess '..plugin.name) -- remove comment to restore old behaviour
|
-- print('Preprocess '..plugin.name) -- remove comment to restore old behaviour
|
||||||
new_msg = plugin:pre_process(msg, self, config)
|
new_msg = plugin:pre_process(msg, self, config)
|
||||||
|
if not new_msg then return end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return new_msg
|
return new_msg
|
||||||
|
@ -177,8 +177,7 @@ end
|
|||||||
|
|
||||||
function banhammer:action(msg, config, matches)
|
function banhammer:action(msg, config, matches)
|
||||||
if not is_sudo(msg, config) then
|
if not is_sudo(msg, config) then
|
||||||
utilities.send_reply(self, msg, config.errors.sudo)
|
return -- Silent ignore
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if matches[1] == 'leave' then
|
if matches[1] == 'leave' then
|
||||||
@ -197,8 +196,14 @@ function banhammer:action(msg, config, matches)
|
|||||||
if not msg.reply_to_message then
|
if not msg.reply_to_message then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
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
|
user_id = msg.reply_to_message.from.id
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if msg.chat.type == 'group' or msg.chat.type == 'supergroup' then
|
if msg.chat.type == 'group' or msg.chat.type == 'supergroup' then
|
||||||
if matches[2] == 'user' or not matches[2] then
|
if matches[2] == 'user' or not matches[2] then
|
||||||
@ -224,8 +229,12 @@ function banhammer:action(msg, config, matches)
|
|||||||
if not msg.reply_to_message then
|
if not msg.reply_to_message then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
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
|
user_id = msg.reply_to_message.from.id
|
||||||
end
|
end
|
||||||
|
end
|
||||||
banhammer:kick_user(user_id, msg.chat.id, self, true)
|
banhammer:kick_user(user_id, msg.chat.id, self, true)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@ -253,7 +262,11 @@ function banhammer:action(msg, config, matches)
|
|||||||
if not msg.reply_to_message then
|
if not msg.reply_to_message then
|
||||||
return
|
return
|
||||||
end
|
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
|
local hash = 'whitelist:user#id'..user_id
|
||||||
redis:set(hash, true)
|
redis:set(hash, true)
|
||||||
utilities.send_reply(self, msg, 'User '..user_id..' whitelisted')
|
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
|
if not msg.reply_to_message then
|
||||||
return
|
return
|
||||||
end
|
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
|
local hash = 'whitelist:user#id'..user_id
|
||||||
redis:del(hash)
|
redis:del(hash)
|
||||||
utilities.send_reply(self, msg, 'User '..user_id..' von der Whitelist entfernt!')
|
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
|
if not msg.reply_to_message then
|
||||||
return
|
return
|
||||||
end
|
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
|
local hash = 'blocked:'..user_id
|
||||||
redis:set(hash, true)
|
redis:set(hash, true)
|
||||||
utilities.send_reply(self, msg, 'User '..user_id..' darf den Bot nun nicht mehr nutzen.')
|
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
|
if not msg.reply_to_message then
|
||||||
return
|
return
|
||||||
end
|
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
|
local hash = 'blocked:'..user_id
|
||||||
redis:del(hash)
|
redis:del(hash)
|
||||||
utilities.send_reply(self, msg, 'User '..user_id..' darf den Bot wieder nutzen.')
|
utilities.send_reply(self, msg, 'User '..user_id..' darf den Bot wieder nutzen.')
|
||||||
|
Reference in New Issue
Block a user