- Code-Optimierung
- Tabellen als Rückgabewerte von Plugins werden nicht mehr unterstützt
This commit is contained in:
@@ -128,7 +128,7 @@ end
|
||||
function gImages:cache_result(results, text)
|
||||
local cache = {}
|
||||
for v in pairs(results) do
|
||||
table.insert(cache, results[v].link)
|
||||
cache[v] = results[v].link
|
||||
end
|
||||
for n, link in pairs(cache) do
|
||||
redis:hset('telegram:cache:gImages:'..link, 'mime', results[n].mime)
|
||||
|
||||
@@ -51,11 +51,11 @@ function help:action(msg, config, matches)
|
||||
local help_text = '*Verfügbare Befehle:*\n• '..config.cmd_pat
|
||||
for _,plugin in ipairs(self.plugins) do
|
||||
if plugin.command then
|
||||
table.insert(commandlist, plugin.command)
|
||||
commandlist[#commandlist+1] = plugin.command
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(commandlist, 'hilfe [Befehl]')
|
||||
commandlist[#commandlist+1] = 'hilfe [Befehl]'
|
||||
table.sort(commandlist)
|
||||
local help_text = help_text .. table.concat(commandlist, '\n• '..config.cmd_pat) .. '\nParameter: <benötigt> [optional]'
|
||||
local help_text = help_text:gsub('%[', '\\[')
|
||||
|
||||
@@ -89,7 +89,7 @@ function id:action(msg)
|
||||
for i = 1, #users do
|
||||
local user_id = users[i]
|
||||
local user_info = id:get_user(user_id, chat_id)
|
||||
table.insert(users_info, user_info)
|
||||
users_info[#users_info+1] = user_info
|
||||
end
|
||||
|
||||
-- get all administrators and the creator
|
||||
@@ -97,7 +97,7 @@ function id:action(msg)
|
||||
local admins = {}
|
||||
for num in pairs(administrators.result) do
|
||||
if administrators.result[num].status ~= 'creator' then
|
||||
table.insert(admins, tostring(administrators.result[num].user.id))
|
||||
admins[#admins+1] = tostring(administrators.result[num].user.id)
|
||||
else
|
||||
creator_id = administrators.result[num].user.id
|
||||
end
|
||||
|
||||
@@ -10,7 +10,8 @@ post_photo.triggers = {
|
||||
function post_photo:pre_process(msg, self, config)
|
||||
if not msg.document then return msg end -- Ignore
|
||||
local mime_type = msg.document.mime_type
|
||||
if mime_type ~= 'image/jpeg' and mime_type ~= 'image/png' and mime_type ~= 'image/bmp' then return msg end
|
||||
local valid_mimetypes = {['image/jpeg'] = true, ['image/png'] = true, ['image/bmp'] = true}
|
||||
if not valid_mimetypes[mime_type] then return msg end
|
||||
|
||||
local file_id = msg.document.file_id
|
||||
local file_size = msg.document.file_size
|
||||
|
||||
@@ -104,14 +104,14 @@ function twitter:action(msg, config, matches)
|
||||
if v.video_info then
|
||||
if not v.video_info.variants[3] then
|
||||
local vid = v.video_info.variants[1].url
|
||||
table.insert(videos, vid)
|
||||
videos[#videos+1] = vid
|
||||
else
|
||||
local vid = v.video_info.variants[3].url
|
||||
table.insert(videos, vid)
|
||||
videos[#videos+1] = vid
|
||||
end
|
||||
end
|
||||
text = text:gsub(url, "")
|
||||
table.insert(images, pic)
|
||||
images[#images+1] = pic
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -197,8 +197,7 @@ function wikipedia:inline_callback(inline_query, config, matches)
|
||||
end
|
||||
end
|
||||
local results = results..']'
|
||||
local res, err = utilities.answer_inline_query(self, inline_query, results, 10)
|
||||
print(results)
|
||||
utilities.answer_inline_query(self, inline_query, results, 10)
|
||||
end
|
||||
|
||||
function wikipedia:action(msg, config, matches)
|
||||
|
||||
Reference in New Issue
Block a user