some improvements

This commit is contained in:
topkecleon
2015-12-14 14:48:17 -05:00
parent c827004bc7
commit 88a506492b
6 changed files with 22 additions and 4 deletions

View File

@ -10,6 +10,8 @@ local triggers = {
local action = function(msg)
sendChatAction(msg.chat.id, 'typing')
local jstr, res = HTTPS.request('https://hacker-news.firebaseio.com/v0/topstories.json')
if res ~= 200 then
sendReply(msg, config.errors.connection)

View File

@ -15,8 +15,12 @@ local action = function(msg)
end
local output = loadstring(input)()
if not output then output = 'Done!' end
sendReply(msg, output)
if not output then
output = 'Done!'
else
output = '```\n' .. output .. '\n```'
end
sendMessage(msg.chat.id, output, true, msg.message_id, true)
end

View File

@ -15,8 +15,12 @@ local action = function(msg)
end
local output = io.popen(input):read('*all')
if output:len() == 0 then output = 'Done!' end
sendReply(msg, output)
if output:len() == 0 then
output = 'Done!'
else
output = '```\n' .. output .. '\n```'
end
sendMessage(msg.chat.id, output, true, msg.message_id, true)
end

View File

@ -15,6 +15,11 @@ local action = function(msg)
sendReply(msg, doc)
return
end
input = input:trim()
if input:len() > 20 then
input = input:sub(1,20)
end
input = input:upper()
local output = ''