Merge branch 'master' into less-magic

This commit is contained in:
Brayden Banks
2016-04-12 06:47:30 -07:00
8 changed files with 64 additions and 58 deletions

View File

@ -47,15 +47,6 @@ function administration:init()
flood = {}
}
-- Migration code: Remove this in v1.8.
-- Most recent group activity is now cached for group listings.
if not self.database.administration.activity then
self.database.administration.activity = {}
for k,_ in pairs(self.database.administration.groups) do
table.insert(self.database.administration.activity, k)
end
end
-- Migration code: Remove this in v1.9.
-- Groups have single governors now.
for _,group in pairs(self.database.administration.groups) do
@ -1011,6 +1002,7 @@ function administration.init_command(self_)
photo = drua.get_photo(msg.chat.id),
founded = os.time()
}
administration:update_desc(self, msg.chat.id)
for i,_ in ipairs(administration.flags) do
self.database.administration.groups[msg.chat.id_str].flags[i] = false
end

View File

@ -43,10 +43,6 @@ local yesno_answers = {
function eightball:action(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

@ -12,23 +12,26 @@ function hearthstone:init()
print('Downloading Hearthstone database...')
self.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 _,v in pairs(jdat) do
for _,val in pairs(v) do
table.insert(self.database.hearthstone, val)
end
end
self.database.hearthstone = d
self.database.hearthstone.expiration = os.time() + 600000
print('Download complete! It will be stored for a week.')