- Setze HTTP-Timeout korrekt
- convert_timestamp nutzt nun os.date()
This commit is contained in:
parent
db120805ac
commit
c37ad5a156
@ -23,7 +23,7 @@
|
|||||||
local bindings = {}
|
local bindings = {}
|
||||||
|
|
||||||
local https = require('ssl.https')
|
local https = require('ssl.https')
|
||||||
https.timeout = 10
|
https.TIMEOUT = 10
|
||||||
local json = require('dkjson')
|
local json = require('dkjson')
|
||||||
local ltn12 = require('ltn12')
|
local ltn12 = require('ltn12')
|
||||||
local mp_encode = require('multipart-post').encode
|
local mp_encode = require('multipart-post').encode
|
||||||
|
@ -62,7 +62,6 @@ end
|
|||||||
function bot:on_msg_receive(msg, config) -- The fn run whenever a message is received.
|
function bot:on_msg_receive(msg, config) -- The fn run whenever a message is received.
|
||||||
-- remove comment to enable debugging
|
-- remove comment to enable debugging
|
||||||
-- vardump(msg)
|
-- vardump(msg)
|
||||||
-- Cache user info for those involved.
|
|
||||||
|
|
||||||
if msg.date < os.time() - 5 then return end -- Do not process old messages.
|
if msg.date < os.time() - 5 then return end -- Do not process old messages.
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ mime = (loadfile "./otouto/mimetype.lua")()
|
|||||||
OAuth = require "OAuth"
|
OAuth = require "OAuth"
|
||||||
helpers = require "OAuth.helpers"
|
helpers = require "OAuth.helpers"
|
||||||
|
|
||||||
http.timeout = 5
|
http.TIMEOUT = 7
|
||||||
https.timeout = 5
|
https.TIMEOUT = 7
|
||||||
|
|
||||||
-- For the sake of ease to new contributors and familiarity to old contributors,
|
-- For the sake of ease to new contributors and familiarity to old contributors,
|
||||||
-- we'll provide a couple of aliases to real bindings here.
|
-- we'll provide a couple of aliases to real bindings here.
|
||||||
@ -387,10 +387,8 @@ function run_command(str)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function convert_timestamp(timestamp, format)
|
function convert_timestamp(timestamp, date_format)
|
||||||
local converted_date = run_command('date -d @'..timestamp..' +"'..format..'"')
|
return os.date(date_format, timestamp)
|
||||||
local converted_date = string.gsub(converted_date, '%\n', '')
|
|
||||||
return converted_date
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function string.starts(String, Start)
|
function string.starts(String, Start)
|
||||||
|
Reference in New Issue
Block a user