hearthstone.lua: Temporary fix. API does not play well with lua-sec, so using curl for now.

bindings.lua: Added support for kickChatMember and unbanChatMember methods.

utilties.lua: enrich_message() will rename the new_chat_member and left_chat_member values to the names
expected by plugins: new_chat_participant and left_chat_participant.

bot.lua: Removed migration code. Rewrite soon.

eightball.lua: Bugfix.
This commit is contained in:
topkecleon
2016-04-12 05:24:56 -04:00
parent 550d0743b7
commit 38b4b68ba2
8 changed files with 65 additions and 51 deletions

View File

@ -1059,6 +1059,7 @@ local commands = {
photo = drua.get_photo(msg.chat.id),
founded = os.time()
}
update_desc(msg.chat.id)
for i = 1, #flags do
database.administration.groups[msg.chat.id_str].flags[i] = false
end

View File

@ -39,10 +39,6 @@ local yesno_answers = {
local action = function(msg)
if msg.reply_to_message then
msg = msg.reply_to_message
end
local message
if msg.text_lower:match('y/n%p?$') then

View File

@ -4,23 +4,26 @@ if not database.hearthstone or os.time() > database.hearthstone.expiration then
print('Downloading Hearthstone database...')
database.hearthstone = {
expiration = os.time() + 600000
}
-- This stuff doesn't play well with lua-sec. Disable it for now; hack in curl.
--local jstr, res = HTTPS.request('https://api.hearthstonejson.com/v1/latest/enUS/cards.json')
--if res ~= 200 then
--print('Error connecting to hearthstonejson.com.')
--print('hearthstone.lua will not be enabled.')
--return
--end
--local jdat = JSON.decode(jstr)
local jstr, res = HTTPS.request('http://hearthstonejson.com/json/AllSets.json')
if res ~= 200 then
local s = io.popen('curl -s https://api.hearthstonejson.com/v1/latest/enUS/cards.json'):read('*all')
local d = JSON.decode(s)
if not d then
print('Error connecting to hearthstonejson.com.')
print('hearthstone.lua will not be enabled.')
return
end
local jdat = JSON.decode(jstr)
for k,v in pairs(jdat) do
for key,val in pairs(v) do
table.insert(database.hearthstone, val)
end
end
database.hearthstone = d
database.hearthstone.expiration = os.time() + 600000
print('Download complete! It will be stored for a week.')