From 4cbe28ea93f12c784ed9e7f66ff23aa8166443ab Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Sun, 19 Jun 2016 22:14:54 +0200 Subject: [PATCH] - Echo: Erlaube Markdown (nicht in Supergruppen) - Entferne orderdPairs(), da .getn deprecated ist --- otouto/plugins/echo.lua | 4 +--- otouto/utilities.lua | 50 ----------------------------------------- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/otouto/plugins/echo.lua b/otouto/plugins/echo.lua index 10228b4..93d3b29 100644 --- a/otouto/plugins/echo.lua +++ b/otouto/plugins/echo.lua @@ -22,10 +22,8 @@ function echo:action(msg) local output if msg.chat.type == 'supergroup' then output = '*Echo:*\n"' .. utilities.md_escape(input) .. '"' - else - output = utilities.md_escape(utilities.char.zwnj..input) end - utilities.send_message(self, msg.chat.id, output, true, nil, true) + utilities.send_message(self, msg.chat.id, input, true, nil, true) end diff --git a/otouto/utilities.lua b/otouto/utilities.lua index d984ca4..535be96 100644 --- a/otouto/utilities.lua +++ b/otouto/utilities.lua @@ -706,56 +706,6 @@ function cache_data(plugin, query, data, timeout, typ) end end ---[[ -Ordered table iterator, allow to iterate on the natural order of the keys of a -table. --- http://lua-users.org/wiki/SortedIteration -]] - -function __genOrderedIndex( t ) - local orderedIndex = {} - for key in pairs(t) do - table.insert( orderedIndex, key ) - end - table.sort( orderedIndex ) - return orderedIndex -end - -function orderedNext(t, state) - -- Equivalent of the next function, but returns the keys in the alphabetic - -- order. We use a temporary ordered key table that is stored in the - -- table being iterated. - - key = nil - --print("orderedNext: state = "..tostring(state) ) - if state == nil then - -- the first time, generate the index - t.__orderedIndex = __genOrderedIndex( t ) - key = t.__orderedIndex[1] - else - -- fetch the next value - for i = 1,table.getn(t.__orderedIndex) do - if t.__orderedIndex[i] == state then - key = t.__orderedIndex[i+1] - end - end - end - - if key then - return key, t[key] - end - - -- no more value to return, cleanup - t.__orderedIndex = nil - return -end - -function orderedPairs(t) - -- Equivalent of the pairs() function on tables. Allows to iterate - -- in order - return orderedNext, t, nil -end - -- converts total amount of seconds (e.g. 65 seconds) to human redable time (e.g. 1:05 minutes) function makeHumanTime(totalseconds) local seconds = totalseconds % 60