lastfm.lua: Added timeout to prevent bot from locking up.
This commit is contained in:
parent
62e0aa12ad
commit
ec64f18138
@ -8,6 +8,9 @@ if not database.lastfm then
|
|||||||
database.lastfm = {}
|
database.lastfm = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local HTTP = require('socket.http')
|
||||||
|
HTTP.TIMEOUT = 1
|
||||||
|
|
||||||
local command = 'lastfm'
|
local command = 'lastfm'
|
||||||
local doc = [[```
|
local doc = [[```
|
||||||
/np [username]
|
/np [username]
|
||||||
@ -62,7 +65,7 @@ local action = function(msg)
|
|||||||
|
|
||||||
url = url .. URL.escape(username)
|
url = url .. URL.escape(username)
|
||||||
|
|
||||||
jstr, res = HTTPS.request(url)
|
jstr, res = HTTP.request(url)
|
||||||
if res ~= 200 then
|
if res ~= 200 then
|
||||||
sendReply(msg, config.errors.connection)
|
sendReply(msg, config.errors.connection)
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user