lastfm.lua: Added timeout to prevent bot from locking up.

This commit is contained in:
topkecleon 2016-03-04 13:06:13 -05:00
parent 62e0aa12ad
commit ec64f18138

View File

@ -8,6 +8,9 @@ if not database.lastfm then
database.lastfm = {}
end
local HTTP = require('socket.http')
HTTP.TIMEOUT = 1
local command = 'lastfm'
local doc = [[```
/np [username]
@ -62,7 +65,7 @@ local action = function(msg)
url = url .. URL.escape(username)
jstr, res = HTTPS.request(url)
jstr, res = HTTP.request(url)
if res ~= 200 then
sendReply(msg, config.errors.connection)
return