diff --git a/config.lua b/config.lua index eead837..6acd80f 100644 --- a/config.lua +++ b/config.lua @@ -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', diff --git a/etc/events.lua b/etc/events.lua index 28de8d0..ee1876a 100644 --- a/etc/events.lua +++ b/etc/events.lua @@ -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 diff --git a/src/cmds/ping.lua b/src/cmds/ping.lua index 78e0726..926cef7 100644 --- a/src/cmds/ping.lua +++ b/src/cmds/ping.lua @@ -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 -} +} \ No newline at end of file diff --git a/src/cmds/reload.lua b/src/cmds/reload.lua deleted file mode 100644 index ee00df8..0000000 --- a/src/cmds/reload.lua +++ /dev/null @@ -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 -} diff --git a/src/locales/en.json b/src/locales/en.json index 5b58d54..55a04fc 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -17,7 +17,7 @@ "ping": { "desc": "ping pong", - "pat": "Pong! %ds. Uptime: %.1f days (%.1fh, %.1fm.)" + "pat": "Pong! %ds" }, "rub": { "args": "[valute]...", diff --git a/src/locales/ru.json b/src/locales/ru.json index 1f72af5..5efe927 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -17,7 +17,7 @@ "ping": { "desc": "пинг-понг", - "pat": "Понг! %dс. В сети: %.1f дней (%.1fч, %.1fм.)" + "pat": "Понг! %d секунд" }, "rub": { "args": "[валюта]...", diff --git a/src/parts/core.lua b/src/parts/core.lua index 8e072a8..b152c57 100644 --- a/src/parts/core.lua +++ b/src/parts/core.lua @@ -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()