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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
plugins/administration.lua

View File

@ -9,6 +9,7 @@ return {
time_offset = 0,
lang = 'en',
admin = 00000000,
admin_name = 'John Smith',
about_text = [[
I am otouto, the plugin-wielding, multi-purpose Telegram bot written by topkecleon.
@ -93,6 +94,7 @@ telegram.me/otouto
'bandersnatch.lua',
'currency.lua',
'cats.lua',
'shout.lua',
-- Put new plugins here.
'help.lua',
'greetings.lua'

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 = ''