Compare commits

..

No commits in common. "1b498be1d6fd234e93a4a6d8173f499dd4f6f75a" and "214b621cdf8f8556dfb23ea1c0fce49629d968d3" have entirely different histories.

7 changed files with 6 additions and 50 deletions

View file

@ -3,7 +3,6 @@ return {
owner = 935626920 , -- hehe
cmds = {
'eval',
'reload',
'ping',
'rub',
'start',
@ -11,7 +10,6 @@ return {
events = {
'command',
'ready',
'inlineQuery',
},
parts = {
'locale',

View file

@ -17,14 +17,6 @@ end
function events:on(n,f) self:_add('on', n,f) end
function events:once(n,f) self:_add('once', n,f) end
function events:off(f)
for k, v in pairs(self._ev_) do
if v.fn == f then
table.remove(self._ev_, k)
end
end
end
function events:_ev(t, i, name, ...)
local v = t[i]
if v.name == name then

View file

@ -1,11 +1,5 @@
return {
run = function(C, msg)
local t = os.time()
local ps, ls, lm, lh, ld
ps, ls = t - msg.date, t - C.loaded
lm = ls / 60
lh = lm / 60
ld = lh / 24
C.api:send(msg, msg.loc.pat:format(ps, ld, lh, lm, ls))
C.api:send(msg, msg.loc.pat:format(os.time() - msg.date))
end
}

View file

@ -1,21 +0,0 @@
return {
private = true,
run = function(C, msg)
local cat, sub = table.unpack(msg.args)
if not (cat and sub) then
return C.api:reply(msg, '/reload cmds ping')
end
local path = 'src.'..cat..'.'..sub
package.loaded[path] = nil
local err, m = pcall(require, path)
if not err then return C.api:reply(msg, 'Reload failed. ' .. m)
elseif cat == 'events' then C.api:off(m); C.api:on(sub, m)
elseif cat == 'cmds' then C.cmds[sub] = m
elseif cat == 'parts' then m(C)
end
C.api:reply(msg, 'Reloaded. ' .. tostring(m))
end
}

View file

@ -17,7 +17,7 @@
"ping": {
"desc": "ping pong",
"pat": "Pong! %ds. Uptime: %.1f days (%.1fh, %.1fm.)"
"pat": "Pong! %ds"
},
"rub": {
"args": "[valute]...",

View file

@ -17,7 +17,7 @@
"ping": {
"desc": "пинг-понг",
"pat": "Понг! %dс. В сети: %.1f дней (%.1fч, %.1fм.)"
"pat": "Понг! %d секунд"
},
"rub": {
"args": "[валюта]...",

View file

@ -2,7 +2,6 @@
local Core = {
config = config,
loaded = 0,
}
(require 'etc.events')(Core) -- add events
@ -14,7 +13,8 @@ function Core:load(what)
print(('Loading %s (%d / %d) %s...'):format(what:sub(0, -2), i, s, v))
-- Lint
if pcall(require, 'src.'.. what ..'.'.. v) then
if true then
--pcall(require, 'src.'.. what ..'.'.. v) then
local a=require('src.'.. what ..'.'.. v)
if what == 'events' then self.api:on(v, a)
elseif what == 'cmds' then self.cmds[v] = a
@ -23,7 +23,6 @@ function Core:load(what)
else print 'fail' end
end
print(('Loaded %d %s'):format(s, what))
self.loaded = os.time()
end
function Core:ev(t, i, name, ...)
@ -45,10 +44,4 @@ function Core:init()
self:emit 'ready'
end
function Core:stop()
self.api:destroy()
print 'Stopped'
print('Uptime: '.. os.time() - self.loaded.. ' seconds')
end
Core:init()