minor changes

This commit is contained in:
topkecleon 2015-07-19 16:46:06 -04:00
parent f7f2fa5eed
commit 02d30f8451
4 changed files with 22 additions and 6 deletions

View File

@ -77,3 +77,11 @@ function send_location(chat_id, latitude, longitude, reply_to_message_id)
return send_request(url)
end
function forward_message(chat_id, from_chat_id, message_id)
local url = BASE_URL .. 'forwardMessage?chat_id=' .. chat_id .. '&from_chat_id=' .. from_chat_id .. '&message_id=' .. message_id
return send_request(url)
end

14
bot.lua
View File

@ -20,7 +20,9 @@ function on_msg_receive(msg)
for i,v in pairs(plugins) do
for j,w in pairs(v.triggers) do
if string.match(lower, w) then
send_chat_action(msg.chat.id, 'typing')
if not v.no_typing then
send_chat_action(msg.chat.id, 'typing')
end
v.action(msg)
end
end
@ -41,6 +43,9 @@ function bot_init()
print('\nFetching bot information...')
bot = get_me().result
if not bot then
error('Failure fetching bot information.')
end
for k,v in pairs(bot) do
print('',k,v)
end
@ -102,11 +107,11 @@ reminders = {}
last_update = 0
while is_started == true do
local result = get_updates(last_update)
if not result then
local res = get_updates(last_update)
if not res then
print('Error getting updates.')
else
for i,v in ipairs(get_updates(last_update).result) do
for i,v in ipairs(res.result) do
if v.update_id > last_update then
last_update = v.update_id
on_msg_receive(v.message)
@ -124,3 +129,4 @@ while is_started == true do
end
end
print('Halted.')

View File

@ -3,7 +3,7 @@ return {
biblia_api_key = '',
giphy_api_key = 'dc6zaTOxFJmzC',
time_offset = 0,
locale = dofile('loc.en'),
locale = dofile('loc/en.lua'),
admins = {
0
},
@ -41,7 +41,7 @@ return {
'whoami.lua',
'lmgtfy.lua'
},
people = { -- For interactions.lua; ID number and nickname
people = {
['55994550'] = 'topkecleon'
}
}

View File

@ -5,6 +5,8 @@
local PLUGIN = {}
PLUGIN.no_typing = true
PLUGIN.triggers = {
bot.first_name .. '%p?$',
'@' .. bot.username .. '%p?$',