disabled annoying messages and german translate in manager.lua
This commit is contained in:
parent
df7817a3be
commit
c5da7388b1
@ -43,10 +43,10 @@ local function pre_process(msg)
|
|||||||
else
|
else
|
||||||
user_id = msg.action.user.id
|
user_id = msg.action.user.id
|
||||||
end
|
end
|
||||||
print('Checking invited user '..user_id)
|
--print('Checking invited user '..user_id)
|
||||||
local banned = is_banned(user_id, msg.to.id)
|
local banned = is_banned(user_id, msg.to.id)
|
||||||
if banned then
|
if banned then
|
||||||
print('User wurde gebannt!')
|
--print('User wurde gebannt!')
|
||||||
kick_user(user_id, msg.to.id)
|
kick_user(user_id, msg.to.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -60,7 +60,7 @@ local function pre_process(msg)
|
|||||||
local chat_id = msg.to.id
|
local chat_id = msg.to.id
|
||||||
local banned = is_banned(user_id, chat_id)
|
local banned = is_banned(user_id, chat_id)
|
||||||
if banned then
|
if banned then
|
||||||
print('Banned user talking!')
|
--print('Banned user talking!')
|
||||||
ban_user(user_id, chat_id)
|
ban_user(user_id, chat_id)
|
||||||
msg.text = ''
|
msg.text = ''
|
||||||
end
|
end
|
||||||
@ -73,22 +73,22 @@ local function pre_process(msg)
|
|||||||
|
|
||||||
-- Allow all sudo users even if whitelist is allowed
|
-- Allow all sudo users even if whitelist is allowed
|
||||||
if whitelist and not issudo then
|
if whitelist and not issudo then
|
||||||
print('Whitelist enabled and not sudo')
|
--print('Whitelist enabled and not sudo')
|
||||||
-- Check if user or chat is whitelisted
|
-- Check if user or chat is whitelisted
|
||||||
local allowed = is_user_whitelisted(msg.from.id)
|
local allowed = is_user_whitelisted(msg.from.id)
|
||||||
|
|
||||||
if not allowed then
|
if not allowed then
|
||||||
print('User '..msg.from.id..' not whitelisted')
|
--print('User '..msg.from.id..' not whitelisted')
|
||||||
if msg.to.type == 'chat' then
|
if msg.to.type == 'chat' then
|
||||||
allowed = is_chat_whitelisted(msg.to.id)
|
allowed = is_chat_whitelisted(msg.to.id)
|
||||||
if not allowed then
|
if not allowed then
|
||||||
print ('Chat '..msg.to.id..' not whitelisted')
|
--print ('Chat '..msg.to.id..' not whitelisted')
|
||||||
else
|
else
|
||||||
print ('Chat '..msg.to.id..' whitelisted :)')
|
--print ('Chat '..msg.to.id..' whitelisted :)')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print('User '..msg.from.id..' allowed :)')
|
--print('User '..msg.from.id..' allowed :)')
|
||||||
end
|
end
|
||||||
|
|
||||||
if not allowed then
|
if not allowed then
|
||||||
@ -97,7 +97,6 @@ local function pre_process(msg)
|
|||||||
|
|
||||||
else
|
else
|
||||||
--print('Whitelist not enabled or is sudo')
|
--print('Whitelist not enabled or is sudo')
|
||||||
print('')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
@ -117,15 +116,15 @@ local function run(msg, matches)
|
|||||||
if msg.to.type == 'chat' then
|
if msg.to.type == 'chat' then
|
||||||
if matches[2] == 'user' then
|
if matches[2] == 'user' then
|
||||||
ban_user(user_id, chat_id)
|
ban_user(user_id, chat_id)
|
||||||
return 'User '..user_id..' banned'
|
return 'User "'..user_id..'" verbannt!'
|
||||||
end
|
end
|
||||||
if matches[2] == 'delete' then
|
if matches[2] == 'delete' then
|
||||||
local hash = 'banned:'..chat_id..':'..user_id
|
local hash = 'banned:'..chat_id..':'..user_id
|
||||||
redis:del(hash)
|
redis:del(hash)
|
||||||
return 'User '..user_id..' unbanned'
|
return 'User "'..user_id..'" entbannt'
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return 'This isn\'t a chat group'
|
return 'Das hier ist keine Chat-Gruppe'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -133,7 +132,7 @@ local function run(msg, matches)
|
|||||||
if msg.to.type == 'chat' then
|
if msg.to.type == 'chat' then
|
||||||
kick_user(matches[2], msg.to.id)
|
kick_user(matches[2], msg.to.id)
|
||||||
else
|
else
|
||||||
return 'This isn\'t a chat group'
|
return 'Das hier ist keine Chat-Gruppe'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -141,19 +140,19 @@ local function run(msg, matches)
|
|||||||
if matches[2] == 'enable' then
|
if matches[2] == 'enable' then
|
||||||
local hash = 'whitelist:enabled'
|
local hash = 'whitelist:enabled'
|
||||||
redis:set(hash, true)
|
redis:set(hash, true)
|
||||||
return 'Enabled whitelist'
|
return 'Whitelist aktiviert!'
|
||||||
end
|
end
|
||||||
|
|
||||||
if matches[2] == 'disable' then
|
if matches[2] == 'disable' then
|
||||||
local hash = 'whitelist:enabled'
|
local hash = 'whitelist:enabled'
|
||||||
redis:del(hash)
|
redis:del(hash)
|
||||||
return 'Disabled whitelist'
|
return 'Whitelist deaktiviert!'
|
||||||
end
|
end
|
||||||
|
|
||||||
if matches[2] == 'user' then
|
if matches[2] == 'user' then
|
||||||
local hash = 'whitelist:user#id'..matches[3]
|
local hash = 'whitelist:user#id'..matches[3]
|
||||||
redis:set(hash, true)
|
redis:set(hash, true)
|
||||||
return 'User "'..matches[3]..'" wurde freigeschalten'
|
return 'User "'..matches[3]..'" zur Whitelist hinzugefügt!'
|
||||||
end
|
end
|
||||||
|
|
||||||
if matches[2] == 'chat' then
|
if matches[2] == 'chat' then
|
||||||
@ -162,22 +161,22 @@ local function run(msg, matches)
|
|||||||
end
|
end
|
||||||
local hash = 'whitelist:chat#id'..msg.to.id
|
local hash = 'whitelist:chat#id'..msg.to.id
|
||||||
redis:set(hash, true)
|
redis:set(hash, true)
|
||||||
return 'Chat "'..msg.to.id..'" wurde freigeschalten'
|
return 'Chat "'..msg.to.id..'" zur Whitelist hinzugefügt!'
|
||||||
end
|
end
|
||||||
|
|
||||||
if matches[2] == 'delete' and matches[3] == 'user' then
|
if matches[2] == 'delete' and matches[3] == 'user' then
|
||||||
local hash = 'whitelist:user#id'..matches[4]
|
local hash = 'whitelist:user#id'..matches[4]
|
||||||
redis:del(hash)
|
redis:del(hash)
|
||||||
return 'User "'..matches[4]..'" removed from whitelist'
|
return 'User "'..matches[4]..'" von der Whitelist entfernt!'
|
||||||
end
|
end
|
||||||
|
|
||||||
if matches[2] == 'delete' and matches[3] == 'chat' then
|
if matches[2] == 'delete' and matches[3] == 'chat' then
|
||||||
if msg.to.type ~= 'chat' then
|
if msg.to.type ~= 'chat' then
|
||||||
return 'This isn\'t a chat group'
|
return 'Das hier ist keine Chat-Gruppe'
|
||||||
end
|
end
|
||||||
local hash = 'whitelist:chat#id'..msg.to.id
|
local hash = 'whitelist:chat#id'..msg.to.id
|
||||||
redis:del(hash)
|
redis:del(hash)
|
||||||
return 'Chat '..msg.to.id..' removed from whitelist'
|
return 'Chat "'..msg.to.id..'" von der Whitelist entfernt!'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user