-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.lua
29 lines (24 loc) · 1.05 KB
/
base.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
serpent = (loadfile "serpent.lua")()
tdcli = dofile('tdcli.lua')
redis = (loadfile "redis.lua")()
tabchi_id = "TABCHI-ID"
function vardump(value)
return serpent.block(value,{comment=false})
end
function reload()
loadfile("tabchi.lua")()
end
function dl_cb (arg, data)
end
reload()
function tdcli_update_callback(data)
update(data, tabchi_id)
if data.message_ and data.message_.content_.text_ and data.message_.content_.text_ == "/reload" and data.message_.sender_user_id_ == tonumber(redis:get("tabchi:" .. tabchi_id ..":fullsudo")) then
reload()
tdcli.sendMessage(data.message_.chat_id_, 0, 1, "*Bot Reloaded*", 1, "md")
elseif data.message_ and data.message_.content_.text_ and data.message_.content_.text_ == "/gitpull" and data.message_.sender_user_id_ == tonumber(redis:get("tabchi:" .. tabchi_id ..":fullsudo")) then
io.popen("git fetch --all && git reset --hard origin/master && git pull origin master"):read("*all")
reload()
tdcli.sendMessage(data.message_.chat_id_, 0, 1, "*Updates Received And Bot Reloaded*", 1, "md")
end
end