moved to utils is_sudo and get_name

This commit is contained in:
yago 2014-12-22 21:52:11 +01:00
parent 7881f62e20
commit 3b67918a3e
2 changed files with 19 additions and 19 deletions

View File

@ -103,25 +103,6 @@ function load_config()
return config
end
function is_sudo(msg)
local var = false
-- Check users id in config
for v,user in pairs(config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function get_name(msg)
local name = msg.from.first_name
if name == nil then
name = msg.from.id
end
return name
end
function update_user_stats(msg)
-- Save user to _users table
local from_id = tostring(msg.from.id)

View File

@ -121,3 +121,22 @@ function run_command(str)
cmd:close()
return result
end
function is_sudo(msg)
local var = false
-- Check users id in config
for v,user in pairs(config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function get_name(msg)
local name = msg.from.first_name
if name == nil then
name = msg.from.id
end
return name
end