Merge branch 'master' of github.com:yagop/telegram-bot

This commit is contained in:
yago
2014-11-17 20:47:16 +01:00
4 changed files with 133 additions and 20 deletions

View File

@ -4,8 +4,6 @@
-- lrexlib = require("rex_pcre")
VERSION = 'v0.6'
plugins = {}
-- taken from http://stackoverflow.com/a/11130774/3163199
function scandir(directory)
@ -16,16 +14,7 @@
end
return t
end
-- load all plugins in the plugins/ directory
for k, v in pairs(scandir("plugins")) do
if not (v:sub(0, 1) == ".") then
print("Loading plugin", v)
t = loadfile("plugins/" .. v)()
table.insert(plugins, t)
end
end
function on_msg_receive (msg)
if msg_valid(msg) == false then
return
@ -273,11 +262,6 @@
end
end
-- Start and load values
config = load_config()
our_id = 0
now = os.time()
function get_receiver(msg)
if msg.to.type == 'user' then
return 'user#id'..msg.from.id
@ -287,7 +271,6 @@
end
end
function on_our_id (id)
our_id = id
end
@ -310,3 +293,23 @@
function on_binlog_replay_end ()
started = 1
end
-- Start and load values
config = load_config()
our_id = 0
now = os.time()
-- load plugins
plugins = {}
-- load all plugins in the plugins/ directory
for k, v in pairs(scandir("plugins")) do
if not (v:sub(0, 1) == ".") then
print("Loading plugin", v)
t = loadfile("plugins/" .. v)()
table.insert(plugins, t)
end
end

View File

@ -2,5 +2,11 @@
"log_file": "/var/www/html/log.txt",
"sh_enabled": false,
"sudo_users": [ 0, 1 ],
"values": { }
}
"values": { },
"twitter": {
"consumer_key" : "",
"consumer_secret" : "",
"access_token" : "",
"access_token_secret" : ""
}
}