disabled annoying messages and german translate in manager.lua

This commit is contained in:
Akamaru 2015-06-16 22:15:22 +02:00
parent df7817a3be
commit c5da7388b1

View File

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