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

View File

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

View File

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

View File

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

View File

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